Page 1 of 2

how do i make enemies chase me?

PostPosted: Mon May 29, 2006 4:15 pm
by pavel329
how do i make enemies chase me to attak me?

PostPosted: Mon May 29, 2006 5:01 pm
by Diana Kennedy
There's a cool script Mak gave me once. In create actor (or what ever event you want) of the ennemey open sript editor and write:

Code: Select all
angle = direction(x, y, yourhero .x, yourhero .y);
directional_velocity = 10;



replace "yourhero" by the actor's name of your hero. replace the 10 after velocity if you want the ennemy to be faster or slower.

But this is only ONE way. I don't know if it suits your need. Just wanted to share this real cool script.

PostPosted: Mon May 29, 2006 5:04 pm
by pavel329
it worked!awesome thanx man

PostPosted: Mon May 29, 2006 5:10 pm
by pavel329
nm it did not work.the guy just kept on going in a diaganol line and never stopped

PostPosted: Mon May 29, 2006 5:11 pm
by pavel329
he went in watever direction i was when i started the game but he did not turn around to attack me.

PostPosted: Mon May 29, 2006 7:01 pm
by Troodon
You must put that code to draw actor instead of create actor. :)

PostPosted: Mon May 29, 2006 7:35 pm
by pavel329
oh ok thanx.oh and thanx for the code too.

PostPosted: Mon May 29, 2006 7:53 pm
by Diana Kennedy
pavel329 wrote:it worked!awesome thanx man


I'm a lady! ;)

PostPosted: Mon May 29, 2006 7:56 pm
by pavel329
i always say man.even to a lady but thanx girl.

PostPosted: Sun Jun 04, 2006 10:05 pm
by CrimsonX
I used that code and i have 2 question. How to get enemies to attack the main character. 2. How to make multiple attacks kill actors.

I've tried many ways but whenever i click to continue in the script editor. it give me an ex. Expected error ) or a Expected error ; on line 2 .

PostPosted: Tue Jun 06, 2006 9:07 pm
by pavel329
don't know that one.knowone would tell me.lol

PostPosted: Wed Jun 07, 2006 3:33 pm
by duracel92
hmm, im no pro but I had an idea. Make a draw actor event, which is the weapon. Make a collison with the draw actor event, and a script, this isnt right... I know it isnt, top of my head stuff but anyway... Its not even in script that would just bring ebarrsement on me :(

something like the variable of the characters health minus the a random damage number between a certain 2 numbers, like 15-28, 1-6. (Oh and just asking, is the random function "rand." like on a calculator).
make an event that checks the actors health, and when the health variable reaches 0, make a destroy actor event.

I think you shouldn't try that. Im gods dissaster at making code...

PostPosted: Fri Jun 16, 2006 1:06 am
by Zehper48
this thread helped me alot!

PostPosted: Fri Jun 16, 2006 12:22 pm
by pavel329
cool.

PostPosted: Sun Jun 18, 2006 11:28 pm
by zupernoc
In my topdown space shooter, similar to "Galaga" the moveto function was needed. Not angle and direction.


Code: Select all
MoveTo("Event Actor", ship.x, ship.y, 1.000000, "Creator Actor");