Value Issues

For questions about using Classic.

Post » Wed Jul 14, 2010 8:11 am

I'm trying to represent values using sprites, but it's not working.
http://www.mediafire.com/?zyqwmyzj3gxtriy
There's the cap. I have a value of 50, but numbers doesn't come out at 50.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Jul 14, 2010 10:41 am

Could it be because frames are one based?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Jul 14, 2010 11:05 am

What newt said and the formula used with sprite2 didn't need the "/10".
It sould look like this:
[code:pudjgm3v]-> Sprite: Set animation frame to (Sprite4.Value('DamageValue')%100)/10+1
-> Sprite2: Set animation frame to (Sprite4.Value('DamageValue')%10)+1[/code:pudjgm3v]
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Wed Jul 14, 2010 11:12 am

Okay, I got. However, I have a new issue. I'm trying to generate random damage pops like in RPGs, but all the created numbers keep being the same.
http://i61.photobucket.com/albums/h53/Sodisna/pci01.png


Here's the update cap.
http://www.mediafire.com/?5mwenymoimyemdn

I tired setting it to the private value every time it creates, but it just return a 0.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Jul 14, 2010 11:20 am

You could just use Lucid's sprite font plug.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Jul 14, 2010 12:44 pm

Doesn't work with any movement. I can't add any type of behavior, nor can I modify it's X/Y Position.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Jul 14, 2010 8:52 pm

Hi. Simple fix.

The way that you ordered the events, you were trying to set the frame on the digit sprites before actually creating them, so it changed all of the sprites each time. You have to pick instances of objects somehow if you don't want the actions to apply to all of the instances.

In this case, Construct will automatically pick the 3 new sprites upon their creation, if you put the actions after that, like so:

[code:1u6u1rcd]+ System: Every 5 ticks
-> Sprite4: Set 'DamageValue' to 1+random(150)
-> System: Create object Sprite on layer 1 at (-16, -13) from ene_Baddie 's pivot point
-> System: Create object Sprite2 on layer 1 at (0, -13) from ene_Baddie 's pivot point
-> System: Create object Sprite3 on layer 1 at (16, -13) from ene_Baddie 's pivot point
-> Sprite: Set animation frame to (Sprite4.Value('DamageValue')%1000)/100+1
-> Sprite2: Set animation frame to (Sprite4.Value('DamageValue')%100)/10+1
-> Sprite3: Set animation frame to (Sprite4.Value('DamageValue')%10)/1+1
[/code:1u6u1rcd]
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Thu Jul 15, 2010 12:22 am

Worked Perfectly.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests