# How do I... use a non-integer in variables?

0 favourites
• 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
• Hi guys-

I'm really not sure how to word what it is I want to do, but I'll try anyways!

Being new to construct and making my first game, I'm wonder if it possible to "split" a point scored in the game into two different variables.

For instance, if the player successfully picks up an object- instead of earning "1" point they would instead earn "2/3rd"s of a point in one category/variable and the remaining "1/3rd" of the point into another category/variable.

Any help would be very much appreciated as I'm my game is actually for a project!

Thanks!

• VarPoints=3 (divisible by 3)

VarScore = VarPoints/3

VarScore would equal 1 in this case

Player only sees "I have five points" but the variable will read 15. This way the single digits can be put in the proper category? I recommend this way because you don't have to work with decimals. From here you can say "one point to this category, two points to that one. Just a suggestion.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• or perhaps more simply

score1 = score1 + new_points*033

score 2 = score2 + new_points*0.66

total_score = score1 + score2

or you could do

score1 = score1 + new_points

score 2 = score2 + new_points

total_score = (score1 + 2*score2)/3

lots of different ways to do this. what I would say is that sometimes it's nice to convert scores back to integer numbers or a fixed number of decimals.. so

integers, use floor or round or ceil

fixed decimal places, I use (floor ( score*100))/100

• 3 posts