Is there a way to increase the standard 24 directions shooting, to more directions. at least to 360.
I am making tbstrategy and...
My enemies are 16x16 pixels, and bullets if shooten from far away from them just go above or underneath my enemies. Making it hard to check for collisions.
Is there maybe some other simple way not using shooting to simulate 360 direction shooting?
Any tips or help is welcome.
I searched a little over the board. and found some tuts and stuff, yet there are nothinig regarding mmf2.360
If you couldn't find anything on 360 degree shooting, then you weren't looking hard enough, as that is probably one of the most freqently asked questions on these forums. And it's the same for MMF2 as for MMF1; trigonometry and math doesn't change in any way.
Here's how you do it:
[event]
- Create Bullet at (0;0) from Player
- Bullet: Set angle to [some angle]
- Bullet: Set Xpos to X("Player")
- Bullet: Set Ypos to Y("Player")
* Always
- Bullet: Set Xpos to Xpos("Bullet") + Cos(Angle("Bullet")) * Velocity("Bullet")
- Bullet: Set Ypos to Ypos("Bullet") - Sin(Angle("Bullet")) * Velocity("Bullet")
- Bullet: Set X position to Xpos("Bullet")
- Bullet: Set Y position to Ypos("Bullet")
[event] is the event which makes the player fire the bullet. [some angle] should be the angle in which the bullet is fired (it depends on what sort of game you're making). Xpos, Ypos and Velocity are all alterable values. Remember to give Velocity an initial value.
thx very much axel...
One more question.
How do i determine the angle based on xy distance from shooter to target?
I use mouse right click on enemy to shoot the bullet.