M
Matthew German
Guest
I am having trouble in Game Maker and I can't figure out what I'm doing wrong.
Basically I have an enemy in the middle of a room and an invisible object next to it that if the player collides with, it will set off a variable that causes the enemy to move towards the player.
This is my code, in the create event for the enemy I have a code block that says:
global.asleep1 = true;
Then for the invisible object I have a collision event with the player object with a code block that says:
global.asleep1 = false;
Then, in the enemy's step event, I have:
if global.asleep1 = false
{
move_towards_point(obj_player.x, obj_player.y, 6)
}
Yet when I put this into practice, the enemy does nothing and stays completely stationary. I've tried a number of different methods and I can't get it to work.
Maybe I'm just really bad at this, I don't know. But I can't figure out why it's not working.
Basically I have an enemy in the middle of a room and an invisible object next to it that if the player collides with, it will set off a variable that causes the enemy to move towards the player.
This is my code, in the create event for the enemy I have a code block that says:
global.asleep1 = true;
Then for the invisible object I have a collision event with the player object with a code block that says:
global.asleep1 = false;
Then, in the enemy's step event, I have:
if global.asleep1 = false
{
move_towards_point(obj_player.x, obj_player.y, 6)
}
Yet when I put this into practice, the enemy does nothing and stays completely stationary. I've tried a number of different methods and I can't get it to work.
Maybe I'm just really bad at this, I don't know. But I can't figure out why it's not working.