Posted By
|
Message
|
xXBlazefirelpXx
Registered 14/06/2010
Points 45
|
26th November, 2010 at 01:32:14 -
Okay so I am making homing attack in my engine however I can't find a way to make it work depending on the closest detected enemy. How do I achieve this? "Without Extensions".
I have included the MFA, in-case helpful : http://dl.dropbox.com/u/5505419/MFA/SonicBaseEngine_Homing.mfa
Thanks in advance. :3
-----------------------------------------------
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
26th November, 2010 at 01:38:18 -
always
-
enemy set alt value A to distance beetween player and enemy
homing missile
pick enemy with lowest alt A
Code me a sausage!
|
xXBlazefirelpXx
Registered 14/06/2010
Points 45
|
26th November, 2010 at 01:43:04 -
Don't quite understand what you're trying to say there. Care to elaborate? Bare in mind I want to not use any extensions.
-----------------------------------------------
|
Don Luciano Heavy combat pancake
Registered 25/10/2006
Points 380
|
26th November, 2010 at 01:53:56 -
always
enemy - set alterable value A to distance beetween enemy and player
without extensions you need an article like this for distance, i suck at math so...: http://www.create-games.com/article.asp?id=1898
2nd event
picking an enemy with lowest alt A can be done is several ways, you can for instance do it with a loop
set global A to 999
enemy spread value 0 in value B
3d event
start loop"a"
enemy value B = loopindex"a"
enemy value A < global A
-
set global value A to enemy value A
4th event
and then just pick the enemy with
enemy value A = global A
pick at random so it picks only one in case if there are two objects with the same value
Edited by Don Luciano
Code me a sausage!
|
Jon Lambert Administrator
Vaporware Master
Registered 19/12/2004
Points 8235
|
26th November, 2010 at 02:03:04 -
He is saying make an event that sets the enemy's alterable value a to the distance between itself and your character, and then in the event where the player activates the homing attack, run a fastloop a number of times equal to the number of enemies, and on each loop, compare the alterable value a of the object whose other value (a value you'll spread a value in) is equal to the index of the fastloop, and store that value in a counter or some value on the player character only if it is within a certain distance. At the end, send Sonic towards that enemy.
EDIT: He got it while I was writing.
Edited by an Administrator
Sandwich Time!Whoo!
JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364
|
xXBlazefirelpXx
Registered 14/06/2010
Points 45
|
26th November, 2010 at 02:06:05 -
I think I get it. Not exactly sure....I also suck at maths haha. Thanks for the input so far though guys. Maybe if it was made into the mfa it would probably make a lot more sense to me.
-----------------------------------------------
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1971
|
26th November, 2010 at 03:20:01 -
Seriously, just use the extension ("Select Object" extension) - it will make things a lot easier for you.
And do a search while you're at it - this has been discussed so many times before...
n/a
|
|
|