How to use copys of an active in different places
I am building a mega man style game.
One of the enemies is a bat, the bat is activated when the player gets close, once activated the bat will follow the player around.
I have attempted to set up the following event that will activate the bat.
XPosition"player" < XPosition"bat" +70
XPosition"player" > XPosition"bat" -70
YPosition"player" < YPosition"bat" +70
YPosition"player" > YPosition"bat" -70
This sets up an invisible box 140x140 around the bat that if the player steps into the bat will activate.
It works fine with one bat on screen.
The problem I am having is when I try to use multiple bats as seen in the following screen shot. When the player gets close to one of the bats all of them activate.
Is there a way to use copies of the same active, but get them to act at different times or will I need to create a separate active for every bat I want to use.
This is the screen with all the bats inactive.
http://i294.photobucket.com/albums/m...oks2000/mm.png
This screen is once the player has gotten close to one of the bats. The bat at the top has still activated despite the player being far away. One bat activates all.
http://i294.photobucket.com/albums/m...s2000/mm-1.png
I hope that all makes sense.
Re: How to use copys of an active in different places
I believe the reason it is not working for you is because the event is not selecting which bat to test the distance from.
Try setting an alterable value for x and y within each of the bats... and then rewrite your events. ie:
ALWAYS set an alterable value to X("bat")-X("megaman") and another to Y("bat") - Y("megaman")
Then make your activation conditions something like:
abs(Alterable Value A( "bat" ))<70
abs(Alterable Value B( "bat" ))<70
//edit//
Oops, I just tried that and I led you astray. Apparently comparing two general values didn't work. Instead, set the alterable values to abs(X("bat")-X("megaman")) and abs(Y("bat")-Y("megaman")) and make your activation conditions:
alterable value A < 70
alterable value B < 70...
I've made a quick example: http://mfa.aquadasoft.com/view/1310229095-move2
Re: How to use copys of an active in different places
Worked like a charm.
Now all of the bats move individually.
Thanks for the help.
Re: How to use copys of an active in different places
The simple alternative is to use your original events, but rewrite the conditions so the bat is on the left.
eg.
XPosition"bat" > XPosition"player" -70
XPosition"bat" < XPosition"player" +70
YPosition"bat" > YPosition"player" -70
YPosition"bat" < YPosition"player" +70
It's *very* important to understand that this makes a big difference to the way MMF2 interprets your events.
Have a read of this:
http://www.create-games.com/article.asp?id=1975