i want the enemy to go back and forth. right now i have it so that when the enemy touches and enemy wall it goes the opposite direction but its not working. Do you guys know of any other ways of doing this?
Comments
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi Jamwithno, a couple or more ways to do this; here's a straightforward way:
Make a game text attribute called Direction, set its value to right.
Place your Actor enemy wall for the left and right walls. Unlock both, in the left wall's Rules put: When Actor receives event overlaps or collides with actor of type Enemy Change Attribute game.Direction to right
and in the other wall: When Actor receives event overlaps or collides with actor of type Enemy Change Attribute game.Direction to left
Then in the Enemy (moving) actor's Rules:
When Attribute game.Direction is right Move Direction 0 relative to scene, chosen speed
When Attribute game.Direction is left Move Direction 180 relative to scene, chosen speed
It did not work but i think i might be doing it wrong
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
I've just run a test and it's working fine here; couple of things maybe to point out: make sure the 2 wall actors on-screen are unlocked i.e made instances, and make sure that in the Enemy actor's rules, that they are two seperate Rules, not one inside the other.
Comments
Make a game text attribute called Direction, set its value to right.
Place your Actor enemy wall for the left and right walls. Unlock both, in the left wall's Rules put:
When Actor receives event overlaps or collides with actor of type Enemy
Change Attribute game.Direction to right
and in the other wall:
When Actor receives event overlaps or collides with actor of type Enemy
Change Attribute game.Direction to left
Then in the Enemy (moving) actor's Rules:
When Attribute game.Direction is right
Move Direction 0 relative to scene, chosen speed
When Attribute game.Direction is left
Move Direction 180 relative to scene, chosen speed
Hope it helps. :-)