How do I math for numbers?

0 favourites
  • 9 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • I have 2 variables:

    Skill

    Accuary

    when Skill is low, for example 1 Accuary is 10

    but when Skill is for example 50 Accuary is 5

    when Skill is 100 Accuary is 0

    So when Skill varieble is higher Accuary variable is lower

    what expression or event i should use?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Accuracy=10-int(skill/10)

  • Accuracy=10-int(skill/10)

    great!

    other question to understand how this works:

    when i need to make Skill up to 300 to receive Accuracy 0 ? how code should be looks like?

  • If you start with 10 and want it to be 0, you'll need to subtract 10. What does 300 skill need to be divided by to equal 10?

    You're going to want a basic understanding of algebra, or you're not going to get very far making a game.

  • If you start with 10 and want it to be 0, you'll need to subtract 10. What does 300 skill need to be divided by to equal 10?

    You're going to want a basic understanding of algebra, or you're not going to get very far making a game.

    im trying, i try modify your code but i dont understand how it works, how i receive not rounded digits? i need to receive for example 9.5, 1.4, 0.5 etc (maximum should be 10, but minimum 0)

  • You can manipulate values with math functions such as int() or clamp()

    int( 'your number' ) will round down in construct

    ie: int(13.5451) gives you 13

    round( 'your number' ) will round to nearest

    ie: int(13.5451) gives you 14

    clamp( 'your number ' , 'min number ' , ' max number ') will stop your number from passing the bounds designated

    ie: clamp(13.5451, 0, 10) gives you 10 (Can't be lower than 0 or higher than 10

  • ie: int(13.5451) gives you 13

    thanks for explonation of all system expressions

    i need receive: "13.5451"

    not 13

  • Construct will automatically return the true value AKA 13.5451. If you are receiving only integers then you will need to rework your equation to be more complex

  • > ie: int(13.5451) gives you 13

    thanks for explonation of all system expressions

    i need receive: "13.5451"

    not 13

    Take out the int() part. If you know what an expression is you should be able to figure this out.

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