Ok, Update:
This is my Code:
Code:
//create
dir = round(random_range(-1,1));
//Step
//Get Enemy Foward
if (obj_enemy.y < 64)
{
y = y+1
}
//Move Left and Right
if dir = -1
{
x = x - 1;
}
if dir = 1
{
x = x + 1;
}
//Change Directions!
if (place_meeting(obj_moveLeft.x, y, obj_moveLeft))
{
dir = -1
}
if (place_meeting(obj_moveRight.x, y, obj_moveRight))
{
dir = 1
}
In the step, the first part basically makes my enemy fly foward into the screen, after that thye should randomly either go left or right. Once they collide with one of the objects which are places on either side of my room, they are supposed to change direction
My problem: The enemy ALWAYS goes right and then once my enemy collides with the object they don't switch directions, they just fly out of the room.