0 Favourites

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

• 3 posts
• 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!

• ## Buy Construct 3

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

Construct 3 users don't see these ads
• 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.

• 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
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
 Similar Topics Posts Views Last Post 0 Favourites Road to 1.0 - what's to be done by 16 Sep, 2010 1 ... 5 6 7 99 10,136 29 Jan, 2011 0 Favourites Done setting up IAP Phonegap, but IAP is not working??? by 22 Jan, 2015 56 4,729 8 Jun, 2016 0 Favourites What picture you used in your avatar? by 21 Jul, 2014 1 ... 4 5 6 76 9,273 11 Nov, 2016