0 Favourites

How do I manage variables

  • Hello everyone,

    I started a game on Construct yesterday, so I'm pretty much a beginner. That's why I will have many questions.

    My project is a shoot em up and the concept is when the player shoot he will use some of his life. So when he doesn't shoot his life come back with some time.

    Player (P): 100PV

    P: shoot 10 times >>>100PV-10PV=90PV

    P: wait and dont shoot 5sec

    P: regen 10PV >>> 90PV+10PV=100PV

    But even if P wait 10 more second his life will still stay at 100PV because it's his normal MAX PV.

    It was easy to do that, but the other point is when the player kill an ennemi, he will receive a part of the ennemi life.

    Player (P): 100PV

    P: shoot 2 times >>> 100PV-2PV=98PV

    P: kill MOB so P receive 10PV in bonus

    P: 108PV

    But after that :

    P: 108PV

    P: shoot 15 times >>> 108PV-15PV= 93PV

    P: wait 20 sec

    P: Regen to 100PV (and not 108PV !! the player loose his 8PV bonus points )

    And I'm pretty lost with this last part unfortunately. But like I said I'm a beginner with Construct 2, so if somebody could help me with that it will be amazing.

    Thank you very much

  • Change Max HP to a variable if it's not already (PV means private variable?), if player is still alive and gets a health bonus, add that bonus to Max HP. When player dies if you want their Max HP to reset to 100 then just have it set to another variable like DefaultMaxHP.

    Hope that helps!

  • I believe PV means HitPoints. He's probably portuguese or spanish speaker.

    Like Jayjay said, Shoy, you should create a Global or Instance Variable (which in fact would be a Constant), called MAX_PV, and set it to 100.

    When you're adding PVs because of time, add a condition, before adding, which checks if PV <= MAX_PV and only add PVs if current value is lower than MAX_PV.

    When receiving the bonus for killing do not compare against MAX_PV, so you can add beyond that value.

  • brunopalermo ahh okay, also I was suggesting he instead adds to MAX_PV, as it sounds like he wants players to get a health bonus that auto-regenerating can go back to, but they lose that bonus on death. Either way works though

  • As far as I got it he wants the regeneration by time to be limited to the MAX, which goes unchanged forever. When you get the bonus for killing an enemy, you would go beyond that MAX, but, once you're down to below MAX, regeneration would only take you back to the original MAX value...

  • brunopalermo Ahh, I can see that reading of it now looking back at his request. I was thinking he was reporting what currently happens rather than what he'd like to happen. Thanks!

  • As far as I got it he wants the regeneration by time to be limited to the MAX, which goes unchanged forever. When you get the bonus for killing an enemy, you would go beyond that MAX, but, once you're down to below MAX, regeneration would only take you back to the original MAX value...

    Hey Yes Bruno you understood my question.

    PV means for me : "Point de Vie", it's french and means Life Point.

    I will try something tomorrow and tell you if it works.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Good to know it's PV in French too. These latin languages...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,158
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,736
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
64 12,948
trollface's avatar
trollface