Keeping Powerups After Player Death.

  • Hello!

    I am currently working on a Metroidvania style game. I have run into a issue where my character, after collecting an upgrade, say double jump boots, where upon being killed in the level, no longer has the ability to double jump, and the pick-up item is gone. I have tried a Global boolean, and setting the platform behavior double-jump enabled and nothing seems to work. Does the problem lie within the Player object itself?

    Thanks!

  • Hello. That is, weird. And will be difficult to help without taking a look at some code. If you can, take a screenshot of only the parts that are supposed to make this work. It could be a syntax problem

    I will assume you are not using Local Variables or Instance Variables.

    Also, I'll assume that you are not just setting the player's Platformer's double jump status to true. Also that there aren't events that clear your powerup.

    Now there is a behaviour on Construct2 that keep objects the same even when reloading, it's called "Persist". Maybe it will help.

  • I have the Persist Behavior on my Player, and I do not have Double Jumped Checked in his Properties. I do not have a Local Variable, just an Global Variable for activating Double Jump, and I have tried with and without the Global Variable too. I attempted to upload screen shots but an error keeps occurring so I pasted the Events here instead.

    Double Jump Boot Event:

    + Gamepad: On gamepad 0 Button A pressed

    + Player: Is overlapping DoubleJumpBoots

    -> BootsInfo: Set Visible

    -> DoubleJumpBoots: Destroy

    -> Player: Set Invisible

    -> Player: Start ignoring Platform user input

    -> System: Set time scale to 0

    -> Player: Set Double_Jump to True

    -> Player: Set Platform double-jump Enabled

    + Gamepad: On gamepad 0 Button B pressed

    -> System: Set time scale to 1.0

    -> BootsInfo: Set Invisible

    -> Player: Stop ignoring Platform user input

    -> Player: Set Visible

    -----------------------------------------------

    Player Death/Respawn Event:

    + Player: Health ≤ 0

    + CheckPoint: Number = CurrentCP

    -> System: Create object Blood on layer "Entities" at (Player.X, Player.Y)

    -> Player: Destroy

    -> Camera: Destroy

    -> System: Wait 1.5 seconds

    -> System: Create object Camera on layer "Entities" at (CheckPoint.X, CheckPoint.Y)

    -> Camera: Set Invisible

    -> System: Create object Player on layer "Entities" at (CheckPoint.X, CheckPoint.Y)

    -> System: Create object Respawn on layer "Entities" at (Player.X, Player.Y)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Making a GLOBAL Variable is the right approach. The problem with your method is:

    When Collecting

    1 -> Player: Set Double_Jump to True

    2 -> Player: Set Platform double-jump Enabled

    When Respawning.

    3 -> Player: Destroy

    4 -> System: Create object Player on layer "Entities" at (CheckPoint.X, CheckPoint.Y)

    You could solve this in 2 ways:

    , instead, spawn the blood at the death location, then, teleporting it to the last checkpoint.

    Alternatively, you can to like I do in my game, The Skylings:

    [Global number canDoubleJump = 0] (Global Variable)

    On Collecting:

    Replace

    "Player: Set Double_Jump to True" and "Set Platform double-jump Enabled"

    with

    System set canDoubleJump to 1

    On Respawning: just keep it the same

    Then add another block like this:

    + System | canDoubleJump = 1

    -> Player : Set Platform double-jump Enabled

    + System | Else

    -> Player: Set Platorm double-jump Disabled

    This way, the double-jump status is not stored at the player, it's just affecting it.

    HOPE IT HELPED :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)