• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Zombie Moon Walking/Walking Backwards(Solved)

W

WolfYouTube

Guest
///Sprite Zombie
if(obj_enemy) mp_potential_step_object(obj_Player.x,obj_Player.y,1,obj_enemy)
sprite_index = spr_ZombieMove
image_speed = .5
 
O

OBV10U3_NINJA

Guest
If you mean your object animation is going backwards, then you're in the wrong spot.
If you mean the object itself is actually moving the wrong way, you're still in the wrong spot.

I'd ask you for the project file so I can check it out and tell you the issue, but idk if the mods would be okay with that.
 

KurtBlissZ

Member
Is your zombie animating backwards or moving back wards?

And assuming obj_enemy is an object, do you have if (obj_enemy) ? That's pretty munch does nothing, it will never be false.
 
W

WolfYouTube

Guest
If you mean your object animation is going backwards, then you're in the wrong spot.
If you mean the object itself is actually moving the wrong way, you're still in the wrong spot.

I'd ask you for the project file so I can check it out and tell you the issue, but idk if the mods would be okay with that.
No when I go behind the zombie it walks backwards
 
W

WolfYouTube

Guest
Is your zombie animating backwards or moving back wards?

And assuming obj_enemy is an object, do you have if (obj_enemy) ? That's pretty munch does nothing, it will never be false.
moving backwards when I walk behind him
 
I

IndieCrypt

Guest
moving backwards when I walk behind him
Ah so you need to simply change the image_xscale... Simply do:

Code:
if(Obj_Player.x > x) {
  image_xscale = 1;
} else {
  if(Obj_Player.x < x) {
  image_xscale = -1;
}
}
Make sure this is in the Zombie Step event
 
W

WolfYouTube

Guest
Ah so you need to simply change the image_xscale... Simply do:

Code:
if(Obj_Player.x > x) {
  image_xscale = 1;
} else {
  if(Obj_Player.x < x) {
  image_xscale = -1;
}
}
Make sure this is in the Zombie Step event
FATAL ERROR in
action number 2
of Step Event0
for object obj_enemy:

Variable obj_enemy.Obj_Player(100007, -2147483648) not set before reading it.
at gml_Object_obj_enemy_StepNormalEvent_2 (line 5) - if(Obj_Player.x > x) {
 

KurtBlissZ

Member
moving backwards when I walk behind him
Is there any other code that may be relavant?

Only thing that I can think that would cause this is your player's sprite origin is all the way to the right. Maybe try opening up all of your player's sprite and hit center then okay. It's hard to say by what information we have because that code should work just fine. Only thing I would do with it is take out if (obj_enemy) like this

Code:
///Sprite Zombie
if mp_potential_step_object(obj_Player.x,obj_Player.y,1,obj_enemy)
sprite_index = spr_ZombieMove;
    image_speed = 0.5;

Edit: I'm sorry probably more like this, But

Code:
if distance_to_object(obj_Player) > 1
{
    sprite_index = spr_ZombieMove;
    image_speed = 0.5;
    mp_potential_step_object(obj_Player.x,obj_Player.y,1,obj_enemy)
} else {
    speed = 0;
}
If you have any more code to share that you think might help would be nice.
 
Last edited:
I

IndieCrypt

Guest
FATAL ERROR in
action number 2
of Step Event0
for object obj_enemy:

Variable obj_enemy.Obj_Player(100007, -2147483648) not set before reading it.
at gml_Object_obj_enemy_StepNormalEvent_2 (line 5) - if(Obj_Player.x > x) {
Do you have an Object called "Obj_Player"? This was just an example, you need to use your own player object name...
 
W

WolfYouTube

Guest
Is there any other code that may be relavant?

Only thing that I can think that would cause this is your player's sprite origin is all the way to the right. Maybe try opening up all of your player's sprite and hit center then okay. It's hard to say by what information we have because that code should work just fine. Only thing I would do with it is take out if (obj_enemy) like this

Code:
///Sprite Zombie
if mp_potential_step_object(obj_Player.x,obj_Player.y,1,obj_enemy)
{
    sprite_index = spr_ZombieMove;
    image_speed = 0.5;
}
I centered everything still happening
 

KurtBlissZ

Member
Ah so you need to simply change the image_xscale... Simply do:

Code:
if(Obj_Player.x > x) {
  image_xscale = 1;
} else {
  if(Obj_Player.x < x) {
  image_xscale = -1;
}
}
Make sure this is in the Zombie Step event
His player's name is obj_Player not Obj_Player. lol.
 

KurtBlissZ

Member
Now they are coming at me from behind and attacking me from their backs
Oh if your using IndieCrypt's code switch the image_index = 1 for the first one and image_index = -1 for the second..

Or just do this,
Code:
if(obj_Player.x > x) {
  image_xscale = 1;
} else {
  image_xscale = -1;
}
edit: change Obj_Player to obj_Player. lol.
 
W

WolfYouTube

Guest
Oh if your using IndieCrypt's code switch the image_index = 1 for the first one and image_index = -1 for the second..

Or just do this,
Code:
if(obj_Player.x > x) {
  image_xscale = 1;
} else {
  image_xscale = -1;
}
edit: change Obj_Player to obj_Player. lol.
still moon walking
 

KurtBlissZ

Member
Then this? I'm not even sure what's going on but.

Code:
if(obj_Player.x > x) {
  image_xscale = 1;
} else {
  image_xscale = -1;
}
I'm still confused on what the problem is... BUt aparantly he moves towards to, but he's facing away from you.. Is there any more code where you try to make him face in one direction or the other? Lol, basically IndieCrypts question I guess.
 
I

IndieCrypt

Guest
Yes is that a problem?
Yes, flip him so he is facing to the right... Or simply change the code so:

Code:
if(Obj_Player.x < x) {
  image_xscale = 1;
} else {
  if(Obj_Player.x > x) {
    image_xscale = -1;
  }
}
 
Top