how do i make enemies chase me?

Game Editor comments and discussion.

how do i make enemies chase me?

Postby pavel329 » Mon May 29, 2006 4:15 pm

how do i make enemies chase me to attak me?
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Diana Kennedy » Mon May 29, 2006 5:01 pm

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.
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby pavel329 » Mon May 29, 2006 5:04 pm

it worked!awesome thanx man
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby pavel329 » Mon May 29, 2006 5:10 pm

nm it did not work.the guy just kept on going in a diaganol line and never stopped
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby pavel329 » Mon May 29, 2006 5:11 pm

he went in watever direction i was when i started the game but he did not turn around to attack me.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Troodon » Mon May 29, 2006 7:01 pm

You must put that code to draw actor instead of create actor. :)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby pavel329 » Mon May 29, 2006 7:35 pm

oh ok thanx.oh and thanx for the code too.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Diana Kennedy » Mon May 29, 2006 7:53 pm

pavel329 wrote:it worked!awesome thanx man


I'm a lady! ;)
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby pavel329 » Mon May 29, 2006 7:56 pm

i always say man.even to a lady but thanx girl.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby CrimsonX » Sun Jun 04, 2006 10:05 pm

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 .
CrimsonX
 
Posts: 28
Joined: Wed May 24, 2006 2:38 am
Score: 0 Give a positive score

Postby pavel329 » Tue Jun 06, 2006 9:07 pm

don't know that one.knowone would tell me.lol
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby duracel92 » Wed Jun 07, 2006 3:33 pm

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...
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby Zehper48 » Fri Jun 16, 2006 1:06 am

this thread helped me alot!
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Postby pavel329 » Fri Jun 16, 2006 12:22 pm

cool.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby zupernoc » Sun Jun 18, 2006 11:28 pm

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");
zupernoc
 
Posts: 17
Joined: Thu Jun 01, 2006 9:12 pm
Score: 0 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron