Flying Enemy Coding Help

R

Retnuh

Guest
Hello everyone. I'm having some trouble getting this to work. I'm trying to create an enemy
that will fly until he hits obj_solid, at which point he will turn around and go the other way.
Here is a pic of what i have:
Link

for some reason the enemy just stops when he gets to the wall.
all help is appreciated
 

M. Idrees

Member
You can make this whole in a little script.

In the [ create event ] of obj_enemy put this code
Code:
 hspeed = choose(2,-2);
In the [ step event ] of obj_enemy put this code
Code:
if ( place_meeting(x,y,obj_solid) ) { hspeed = -hspeed; }
 
Last edited:
R

Retnuh

Guest
You can make this whole in a little script.

In the [ create event ] of obj_enemy put this code
Code:
 hspeed = choose(2,-2);
In the [ step event ] of obj_enemy put this code
Code:
if ( place_meeting(x,y,obj_solid) ) { hspeed = -hspeed; }

oh, ofcourse. works like a charm. thanks!
 
Top