Re: But it looked so simple!
For duplicates Spread Value. This will give a different ID to each of the enemies.
Marv
Re: But it looked so simple!
I think I tried something like that already. But just to make sure, I'll see if that works.
Re: But it looked so simple!
it WILL work if you use spread value. at the start of the frame (or on enemy creation) you need to spread a value (call it say, enemy ID) so that tgf can differentiate between each enemies collisions.
Re: But it looked so simple!
Err... What should I do after spreading a value?
Re: But it looked so simple!
The whole setup of events should generally look like:
Always
-> Spread value 0 in Alterable Value A of object [Enemy]
Always
-> Start loop "moveEnemies" NObject("Enemy") times
On loop "moveEnemies"
+ Alterable Value A of [Enemy] = LoopIndex("moveEnemies")
-> (Perform events related to movement of enemy in here)
The action "Spread value" gives each Enemy object a unique value in the alterable value that you give it, starting from the number you give it - so if there were four Enemy objects and you spread value 0 in them, they would be assigned values 0, 1, 2 and 3.
The fastloop event goes through each of the Enemy objects and selects them in turn, so that only one of them is selected at a time to perform events on. Make sure that you use the "Compare alterable value" condition of the Enemy object here, instead of the "Compare two general values" condition, so that the enemy is actually selected by the event. And, as said above, it's recommended to rename the alterable value to "ID" or something so that you can tell what it's used for.
Re: But it looked so simple!
So... by " NObject("Enemy") ", do you mean the "ID" value of the Enemy?
And then I just stick " On loop "moveEnemies" " in front of every event?
Re: But it looked so simple!
Nobjects("Enemy") is an expression in the Special object - it counts the number of Enemy objects that exist.
Put "On loop "moveEnemies" and "ID("Enemy") = LoopIndex("moveEnemies")" in front of every event that you want run in the fastloop, unless the event already has an "On loop" event that's called during the moveEnemies fastloop. In this case, you only need to add the "ID("Enemy") = LoopIndex("moveEnemies")" condition.
Re: But it looked so simple!
spread a value and then loop through them like DavidN suggested. It's a killer with multiple objects but that's the only way to do it in MMF2 sadly (unless you can deal with MMF2's inbuild object identification on collision... argh)
Re: But it looked so simple!
I meant to try this out sooner, but there was a problem with my computer's memory and I couldn't work on my game for a while. Anyways, I just tried what you said, but I think I'm doing it wrong still. Now nothing moves.
Re: But it looked so simple!
someone needs to hook you up with an .MFA file example so you can see how it all works together. Unfortunately I dont have the time right now. :(
Re: But it looked so simple!
Yeah, an example would be hugely appreciated! It's strange how complicated something like this would be, especially since MMF2 does such a terrific job making most other tasks quick and painless...