Well, basically I am creating a platformer/shooter, and it's come to a point where I'd like to implement grenades into the gameplay. The problem is - I haven't got the slightest idea how to code the grenade's physics. The top priorities are that you can choose the direction to throw in, speed/power, the fall/gravity of it, collisions with the walls. What I'd appreciate the most is for someone to actually code such physics so I can see how it's done, understand it and then modify it further to my needs, I doubt I'd understand it if someone would explain how to do this to me.
Ploo
n/a
-Dark Martin- The dark is most certainly not your friend
Currently only supports 1 grenade on screen at a time (you'd need to fastloop through all grenades otherwise). You can probably get away with just limiting the rate of fire so the last grenade will have exploded before the player can throw another.
The bouncing will only work with horizontal and vertical walls. If you want proper bounces off walls at other angles it becomes a fair bit more complicated (every face of every wall must be a separate active object with its angle stored in an alterable value). If you *really* need it let me know, but like I said, it's more hassle both in terms of the number of objects needed and of the complexity of the events.
EDIT: hope you've got MMF2 after all that! If not I guess I could convert to MMF1 (don't have TGF or anything else though)
no problem. let me know if you need anyhting explaining.
by the way; line 36 should read "alterable value C = 100" not 150.
Ideally you want to use fastloops to move the grenade only a pixel or two at a time, before checking for collisions (stops it going through very thin walls when moving fast). Depends on the game though - might not need to.
Should help you if you want a little more physics than just grenades
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Lol, it's better that way. It says exactly everything I was going to say!
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.