every 100 Coins = 1 life (mario bros)

0 favourites
  • 7 posts
From the Asset Store
This sound pack comes with 100 high quality, ready-to-use sound effects for all kinds of games.
  • Hello


    Hello good, I wanted to know how I can perform the command every 100 coins or points 1 life is added, if they could help me thanks and regards


    Hola buenas, queria saber como puedo realizar el comando de que cada 100 monedas o puntos se agregue 1 vida, si me podrian ayudar gracias y saludos

  • I assume your coins and life are already variables.


    System - Compare two values: CoinsVariable = 100


    Add 1 to LifeVariable

    Set CoinsVariable to 0

  • I guess you already have a variable for coins. What you have to do now, is this: one way is to use modulo. I think that's the simplest, because you don't need any additional variables.

    Add an event:

    System|Compare two values: Coin%100 = 0 (and) Trigger once while true -> System|Add 1 to Life

    (Assuming Coin is the variable for coins and Life for lifes)

    https://www.dropbox.com/s/yyaxf6pw0emqt ... o.jpg?dl=0

    Maybe you may want to add another condition: Coin /= 0, so 1 life isn't added on start when you have 0 coins.

    https://www.dropbox.com/s/gyhd4vxhz3u6y ... 2.jpg?dl=0

    What is modulo?

    Modulo is actually the remain of dividing. In C2, it is represented with percent sign (%).


    50%100 = 50 (50/100 = 0, 50 remains)

    100%100 = 0 (100/100 = 1, 0 remains)

    200%100 = 0 (200/100 = 2, 0 remains)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much friend, but finished before yesterday, a friend helped me a tutorial, but equal to I made something similar oosyrag.


    Add variable global: variable number|Extras = 100

    And In Add Event: System|Monedas = Extras | system add 1 life -->(compare variable: monedas = Extras)

    | system add 100 extras


    and thereby completing 100 coins system adds 1 life and 100 extras, so to reach 200 coins 1 life and 100 extras, and so on is added: D Thanks alike, if it serves this would be great

    Thank You Friends

  • See also, as one can reset a global variable, and no reset all?

  • See also, as one can reset a global variable, and no reset all?

    I guess the only way to do that is System|Set value to 0 (or whatever you have at start).

  • thank you friend grigrizljac and the others, greeting

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