I admit, I really suck at math. But maybe some1 can help me with this:
The player can create a shield consisting of a maximum of 4 objects that spin around him. Each object has a fixed distance between eachother.
But if you only have 3 or less objects flying around you, every one has also the same distance between eachother. It should calculate different distances so for example if you only have 2 objects they are at front and back side. And they always rotate around the player wherever he goes...
Kinda like this:
I can imagine this is only a very simple math thing for most of you, but my brain evacuates itself if I only try to begin doing math
I'm happy if I get MMF2 to do what I want without the use of extensive coding... excessive coding means for me trial and error until everything runs like I want
Anyway would be gr8 if you can help me a little with this
Thx!
If you want a non-math and inefficient way (and how I'd do it most likely) just make an active object called "shields" or whatever that has different animations for 0 shields, 1 shield, 2 shields, 3 shields, and 4 shields. Draw them, space them apart how you like, and manually move each orb around a little at a time for the next frame, until you have a complete circle and loop the animation.
Then you can test collision against this orb shield object to deflect enemy bullets. Just set an alt value on the player somewhere called NumShields and use that to control which animation of the orb shield object is always playing. You can even give the shield object HP so if it takes enough damage it'll downgrade and subtract an orb or just fizzle out altogether when they're all gone.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
When you create your shields, do a "Spread 90" in their Value A. This will set their Value A's to 90,180,270 & 360.
Then just create an "Always: Add 1 to Value A", and watch them spin. The number "30" represents the pixel distance that they will always keep, and value A is the angle of each one from the enemy
Something like this should work. I'm calling the objects "Player" and "Orbital" here. And the angle of rotation is based off of one of the Player's alterable values in order to keep everything consistently spaced:
Always
Set Alterable Value A( "Player" ) to (Alterable Value A( "Player" )+5) mod 360
Spread 0 In Alterable Value A( "Orbital" )
Set X( "Orbital" ) to X( "Player" )+32*Sin(Alterable Value A( "Player" )+Alterable Value A( "Orbital" )*(360/NObjects( "Orbital" )))
Set Y( "Orbital" ) to Y( "Player" )+32*Cos(Alterable Value A( "Player" )+Alterable Value A( "Orbital" )*(360/NObjects( "Orbital" )))
The 5 refers to the rotation speed, the 32 refers to the radius. If you want it spinning the other direction, just change the X to -32 instead of +32.
Oh yeah I forgot that spread 90 doesn't work, Fifth's is right. To initialize as something like 0,90,180,270, you need to do:
Spread 0 in value A
Set value A to Value A * 90