[Solved] How do I grow up a variable

Get help using Construct 2

Post » Wed Oct 28, 2015 6:20 pm

Hello,
I have a little problem, but I'm sure it is resolved quickly. :D I used a text plugin that indicates the players score. Now I want to "animate" the score (like growing up). How I can do this, only with "set text" action and delta time? (Note: It may be that there is a large number!) ;)
Last edited by wossi on Thu Oct 29, 2015 2:54 pm, edited 1 time in total.
B
9
S
4
Posts: 103
Reputation: 1,195

Post » Wed Oct 28, 2015 7:08 pm

Last edited by Gweely on Wed Oct 28, 2015 7:12 pm, edited 2 times in total.
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Wed Oct 28, 2015 7:10 pm

@Gweely

You've linked to the .caproj, which is no good without the rest of the project files.

Much easier to save as a single file - .capx - and link to that.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,547
Reputation: 60,438

Post » Wed Oct 28, 2015 7:13 pm

@zenox98
my mistake

amended
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Thu Oct 29, 2015 6:32 am

@Gweely: Yes, this is what I want, but it's not working with odd scores. For example: 1563 or something like that. ;)
B
9
S
4
Posts: 103
Reputation: 1,195

Post » Thu Oct 29, 2015 7:01 am

This should do it:
Every tick:
---- set text to min(float(self.text)+100*dt, score)

But personally I'd use a second global var that increases toward the score. Then I'd just show a rounded number.
global number display=0
Every tick:
---- set display to min(display+100*dt, score)
---- set text to int(display)
B
94
S
33
G
118
Posts: 5,392
Reputation: 75,845

Post » Thu Oct 29, 2015 12:52 pm

R0J0hound wrote:This should do it:
Every tick:
---- set text to min(float(self.text)+100*dt, score)


Yes, you're right! That's exactly what I need. But... I want to make some little changes:
Code: Select all
Every tick:
--- int(min(float(self.text) + 100 * (60 * dt), score))


Why? If you have a much higher value for score (for example: 14587), your method runs very slow. However, it runs like it should. :D Thanks for all of your replies!

~solved
B
9
S
4
Posts: 103
Reputation: 1,195


Return to How do I....?

Who is online

Users browsing this forum: draiza and 11 guests