Visual Values.

For questions about using Classic.

Post » Tue Mar 03, 2009 2:32 pm

I'm trying to do visual values, but it's not working out so hot. I know most of will say use the text tool, but I want to use animated values.
I tried something like this:
HPOnes: Set animation frame to Marisa.Value('HP')/1
HPTens: Set animation frame to Marisa.Value('HP')/10
HPHundreds: Set animation frame to Marisa.Value('HP')/100

It doesn't work too well. It you stay at like 199, then when I reach 100 it would start to count down by 10s even though it suppose to go down by ones.

http://www.mediafire.com/download.php?2mte1nbdyva
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Tue Mar 03, 2009 3:10 pm

You need the modulus operator, %, the remainder after division.
Ones is value % 10
Tens is (value % 100) / 10
Hundreds is (value % 1000) / 100
and so on.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Mar 03, 2009 3:31 pm

Like this?
Values.Value('HP')%1000/100
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Tue Mar 03, 2009 5:15 pm

Yes, but better put brackets around it like this:
(Values.Value('HP')%1000)/100
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests