Power Ups
Ayolabi12345
Member Posts: 30
How would I make power ups in the game that can:
Make it invincible
and another that makes it double jump (I use the jump only once template)
Comments
You need to set attributes... I'm guessing invincible would be limited and double jump would be permanent.
So, playerInvincibleTimer and set it to 0
When the player picks up the invincible powerup, set the playerInvincibleTimer = timer + 3 (that gives 3 seconds of invincibility so set it however long).
In your routine for collissions with harmful objects (enemies, bullets, etc), put them all inside of a rule that says IF playerInvincibleTimer < timer then do the collision checking, normal stuff that happens.
For the double jump, there are plenty of tutorials on that:
I have a tutorial about power ups you might want to check out. It includes double jumps and a shield. But the tutorial is also good for the overall idea of how any power up might function.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page