Help Working with percentages

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Good morning, I'm having difficulty working with percentage, for example I want to change the frame of an object, whenever it reaches a% of a value,

    if it is 10% of the value of the score, I want the frame to be 1,

    if it's 20% of the score, I want it to be 2 ...

    I'm doing this because I'm going to work with "sessions" and each "session" will have a higher score limit, so working by percentage would be the best option ....

    I'm doing this format, (but the percentage is still not working) I would like help for how I can know the value of 10% of my score in this comparison, or some other tip to change the logic.

    thankful

    http://prntscr.com/lqjhw6 if image can`t be opened

    ///-------------------------------------//---------------------------------//----------------------

    Bom dia pessoal, estou com dificuldades para trabalhar com porcentagem, por exemplo eu quero trocar o frame de um objeto, sempre que chegar em uma % de um valor,

    se for 10% do valor do score, quero que o frame seja 1,

    se for 20% do valor do score, quero que seja 2...

    Estou fazendo isso, pois vou trabalhar com "sessoes"e cada "sessao" terá um limite maior de pontuação, então trabalhar por porcentagem seria a melhor opção....

    Estou fazendo desse formato, ( mas a porcentagem ainda não está funcionando) gostaria de ajuda pra como posso saber o valor de 10% do meu score nessa comparação, ou alguma outra dica pra mudar a lógica.

    Grato

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • pct = int(loadingprogress*100)

    someVar = pct/10

    object . setFrame to int(someVar)

    Just off the top if my head, as they say, haven't tried it , but it should work

    or shortened into one line object > setFrame > int((int(loadingprogress*100)/10))

    prob. do not need both int either

  • pct = int(loadingprogress*100)

    someVar = pct/10

    object . setFrame to int(someVar)

    Just off the top if my head, as they say, haven't tried it , but it should work

    or shortened into one line object > setFrame > int((int(loadingprogress*100)/10))

    prob. do not need both int either

    Thank you, i`l try this.. is some complicated for me yet, but i`l try and send the result here :)

  • > pct = int(loadingprogress*100)

    >

    >

    > someVar = pct/10

    >

    >

    > object . setFrame to int(someVar)

    >

    >

    > Just off the top if my head, as they say, haven't tried it , but it should work

    >

    >

    > or shortened into one line object > setFrame > int((int(loadingprogress*100)/10))

    >

    > prob. do not need both int either

    Thank you, i`l try this.. is some complicated for me yet, but i`l try and send the result here :)

    I do this, i create some Local variables, and defined the value to then...

    but i can`t find the "variable" to create a comparison, i need to make a GLOBAL variable to this??

    Thx

  • Sorry I used loading progress because I usually use this when loading game.

    You do not need all of those variables only these:

    scorelimit

    score

    scorePCT

    every time you score calculate % by setting scorePCT variable to scorePCT = (score/scorelimit)*100

    and under that another action to set frame of object

    object > setFrame > int(scorePCT/10)

  • Thx for help bro, i`l not use percentage anymore XD

    its too complicated to me yet...

    but really thank you =)

    Sorry I used loading progress because I usually use this when loading game.

    You do not need all of those variables only these:

    scorelimit

    score

    scorePCT

    every time you score calculate % by setting scorePCT variable to scorePCT = (score/scorelimit)*100

    and under that another action to set frame of object

    object > setFrame > int(scorePCT/10)

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