Power Ups

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

  • ookami007ookami007 Member Posts: 581

    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:

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    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.

Sign In or Register to comment.