Jump to content


Graviton Software

Member Since 28 Feb 2010
Offline Last Active May 17 2012 09:32 PM

Topics I've Started

enemy collision

12 March 2012 - 07:03 AM

platform game.

animated enemy left right moving.

you jump on it to destroy.

The issue is , when colliding with the enemy the player only gets hurt from
the enemy facing you, when it is moving away (back facing) the player can
walk right up behind it without being hurt.
i have used my basic enemy collision code for a long time with no problems till now,
i have checked and rechecked back on my other games and i can be 'hurt' from
front and behind the enemy and my code is the same
i dont understand why i can only be hurt from one side of the enemy now ?

player collision with enemy

///you squash
if (vspeed > 0 && y < other.y + 8)
{
    other.enemy_die=1;
    sound_play(snd_galkdeath);
    vspeed=-10;
    score+=10;
    with (other) instance_destroy();
}
else ///you hurt
{
    sound_play(snd_playerhurt);
    global.hearts-=1;
    x=xstart;
    y=ystart;
    FaceDirection = 1
    if (FaceDirection = 1)
    {
        sprite_index=spr_standright;
        image_index=-1;
        image_speed=0.2;
    }
    else
    {
        sprite_index=spr_standleft;
        image_index=-1;
        image_speed=0.2;
    }
}

Slope Conversion

15 February 2012 - 11:55 PM

Hi i need to figure out how to get my slopes into this movement code i made::::::::::
My floor solid is the obj_floor [solid checked].
I have two left-right 45 degree triangles for the slopes [solid not checked] i have the both parent set to obj_floor.



Right
---------------------------------
if keyboard_check(vk_right) == true
{
    if place_free(x+6,y)
    {
        IsRunning = true;
        x += 6;
        FaceDirection = 1;
        if IsJumping == false
        {
            sprite_index = spr_runright;
            image_speed = 0.3;
        }
    }
}

Release Right
--------------------------
if keyboard_check_released(vk_right) == true
{
    if IsJumping == false
    {
        sprite_index = spr_standright;
        image_speed = 0.2;
    }
}

I have tried 17 ways to get simple 45 degree up and down slopes into this engine over the course of a year and a half i am at my wits end with slopes. I almost had it correct on two occasions but then ruined it when i added more to it such as moving platforms ect. Im not a hardcore coder and i cannot really progress on anything further unless i can get slopes into this engine that i have worked very hard on. (it will be worth it)
I will try all and any suggestions.
Thank you.

Controllers

10 February 2012 - 04:29 PM

Hi dont know if this is a bit of a noob question but its somthing that has been bugging me for quite some time now. When using a controller object for lives ect how come the lives dont appear unless its in the first room?
For example i usualy have a few intro rooms then level 1 starts, unless i make a clone of the controller and place it hidden in the very first room the lives do not appear in level 1 room with the actual 'real' controller, i dont understand why this is still so even on gm8.1, has anyone else had this problem or understand what im talking about ? If so is there another way around the need for 2 controllers or another way to make a basic controller?
Your thoughts and help (mabye even an example) would help myself and others having the same problem.
Thank you.

Slope Glitches

26 October 2010 - 05:41 AM

create event :

image_speed = 0.4;
view_dir = 0;
IsJumping = false;
IsRunning = false;
can_jump = 2;

Step :

if place_free(x,y + 1)
{
    gravity = 1.5;
}
else
{
    gravity = 0;
}

Event for right key :

image_speed = 1;
if keyboard_check(vk_right) == true
{
    if place_free(x+6,y)
    {
        IsRunning = true;
        x += 5;
        view_dir=0;
        if IsJumping == false
        {
            sprite_index = spr_runright;
        }
    }
}

var i;
for (i=0; i<7; i+=1)
 {
  if (place_free(x + 4, y - i))
   {
        x += 4;
        y -= i;
        break;
   }
 }

step event for right release:

image_speed = 0.4;
if keyboard_check_released(vk_right) == true
{
    if IsJumping == false
    {
        sprite_index = spr_standright;
    }
}


Issues:


(slopes are 45 angle)
Sprite not displaying running animation going down either slope in either direction.
Cannot jump when moving forward on either slope.
Somtimes facing backwards while going up on either slope.
Ascending slopes is a tiny bit too slow (if i change this i cant go up a slope).

No matter how i change the numbers i'll always mess up the smoothness of the slopes
Can someone point out were i've gone wrong please ?

shooting

15 October 2010 - 07:04 PM

event keypress 'Z'  :

if (view_dir=180)
{
    if (global.ammo>0)
    {
        var obj;
        obj=instance_create(x+15,y+30,obj_bullet);
        with (obj) motion_set(180,12);
        sprite_index=spr_shootleft;
        image_index=1;
        image_speed=0;
        sound_play(snd_hairball);
        global.ammo-=1;
    }
}
if (view_dir=0)
{
    if (global.ammo>0)
    {
        var obj;
        obj=instance_create(x+15,y+30,obj_bullet);
        with (obj) motion_set(0,12);
        sprite_index=spr_shootright;
        image_index=1;
        image_speed=0;
        sound_play(snd_hairball);
        global.ammo-=1;
    }
}


facing right and shooting is fine, but if im facing left and then shoot it faces me right afterwards. er ?