Enemy move to player and avoid bullets

You must understand the Game Editor concepts, before post here.

Enemy move to player and avoid bullets

Postby motorollin » Mon Aug 20, 2007 9:45 am

I want one of my enemy actors to move towards the player but move out of the way to avoid its bullets. I have put the following command in the Draw Actor event for the enemy actor:

Code: Select all
MoveTo("Event Actor", 0, 0, 2, "player", "bullet");


When I run the game the enemy actor sits still until the player starts shooting, and then the enemy moves very slowly towards the player but seems to ignore the bullets. If a bullet does hit the enemy, the bullet seems to bounce off in the opposite direciton - which is definitely not right as the bullet is supposed to destroy the enemy on collision!

Any ideas how I can achieve this?
motorollin
 
Posts: 54
Joined: Sun Aug 12, 2007 8:05 am
Score: 1 Give a positive score

Postby d-soldier » Mon Aug 20, 2007 2:52 pm

Check to verify that you have a collision-event setup (bullet actor) to destoy itself and the enemy when it collides with enemy. (no physical response). I dont have much experience with the "avoid" feature, but if your using a velocity of "2" then that doesn't really allow the enemy to move out of the way fast enough, even if it did calculate the speed and distance of the projectile coming at it... but I think the avoid thing may be designed for static objects..
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby motorollin » Mon Aug 20, 2007 3:49 pm

Yes the bullet has a collision event to destroy itself. I tried decreasing the velocity of the bullet and increasing the velocity of the enemy and it did actually move to avoid the bullet. But I want it to move slowly towards the player but quickly ¨strafe¨ out of the way of the bullet, so increasing the speed of the enemy overall to allow it to get out of the way of the bullet is not ideal. Also, the enemy only moved when the player started shooting and stopped moving when the player stopped shooting for some reason. I think I might have to forget MoveTo() and code the enemy's movements myself :shock:
motorollin
 
Posts: 54
Joined: Sun Aug 12, 2007 8:05 am
Score: 1 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest