Posted By
|
Message
|
Robert Dowling
Registered 06/02/2009
Points 104
|
27th March, 2009 at 01:40:56 -
Hello, I have multiple duplicates of an enemy chasing and attacking the player in a sidescroller. How can I stop the instances hiding behind one another?
I have detectors attached to the enemy to detect the player.
I've just started the movement code on the enemy:
*On loop "enemymove"
+ID of enemy=Loopindex("enemymove")
+Combat of enemy=1
+X position of enemy <X("player")
-enemy:Set X position to X("enemy")+2
-enemy:Change animation sequence to Running
Then I have another event that's similar but in the opposite direction.
How should I go about preventing the enemy from sharing the same X coordinate with its fellow instances?
P.S I've also asked this in the clickteam forums, just going for the wide reach.
Edited by Robert Dowling
n/a
|
Cecilectomy noPE
Registered 19/03/2005
Points 305
|
27th March, 2009 at 02:18:31 -
check for collisions with other enemies as well. and have them stop for a second, or do something, bounce, etc.
i did this in my abandoned project. its not that hard.
http://create-games.com/download.asp?id=7100
n/a
|
Robert Dowling
Registered 06/02/2009
Points 104
|
27th March, 2009 at 02:53:25 -
Cheers Cecil, How would you go about having an instance detect collision of one of its other instances?
To add to that, how would you go about having the instance furthest from the player perhaps slow down for example, while the other instance (closest to the player) not be effected?
I don't really want to use a bounce and I would like the seperation to be smooth and as unnoticable as possible.
n/a
|
Cecilectomy noPE
Registered 19/03/2005
Points 305
|
27th March, 2009 at 03:39:21 -
i mostly linked you to that because its open source. all the events are there for you to look at.
there are many ways for you to handle the collision once it happens. as for instances farther being slower to the ones closest to the player, i have no idea. havent had a need to do it.
n/a
|
Robert Dowling
Registered 06/02/2009
Points 104
|
27th March, 2009 at 04:00:17 -
cheers for a link to your open source, Cecil. But it's asking for an extention called KCres.mfx which I don't seem to have. And unfortunately can't view it.
n/a
|
Cecilectomy noPE
Registered 19/03/2005
Points 305
|
27th March, 2009 at 05:09:11 -
are you using mmf2?
sadly its in the games factory and you need certain extensions for backwards compatibility.
and some extensions dont work. ill try and cut everything out that doesnt need to be in it and upload it. unfortunately there are certain extensions that you HAVE to have. like KCfloop.mfx
ok i have added an .mfa without any extensions that it doesnt absolutely need. if it errors calling for KCfloop.mfx you need to update. and if youre using a demo of tgf2 then i cant help you.
re download and use the .mfa
Edited by Cecilectomy
n/a
|
Robert Dowling
Registered 06/02/2009
Points 104
|
27th March, 2009 at 06:22:32 -
Thanks so much for doing that Cecil, I'm having a look through it now.
n/a
|
|
|