Grow a sprite (scale) at a steady rate?

Get help using Construct 2

Post » Sat Feb 09, 2013 1:12 am

So adding 1px to a sprite size or 0.01 to the scale causes a sprite to grow too quickly at first and then as it gets bigger it grows slower and slower.

So what I need help with is a math equation. What would be the proper way to grow a scale a sprite evenly over time?

I think this can only be achieved using scale as sprites are all different heights and widths so doing this with sprite.height and sprite.width would cause strange results.

Would "dt" be the answer here?

Thanks in advance!





B
45
S
12
G
7
Posts: 339
Reputation: 7,899

Post » Sat Feb 09, 2013 2:52 am

I think the word LERP might be in the answer you are looking for... Wish I knew more to help :)

B
56
S
13
G
1
Posts: 151
Reputation: 4,499

Post » Sat Feb 09, 2013 3:00 am

Maybe this is what you want~

Instance Variable for the objects you want to scale:
// Scale speed. Lower value = Faster scale.
// Using power of 2 value for suggestion.
var scaleRate = 64

Every tick:
Set objects size to:
X = self.Width + (self.Width / scaleRate)
Y = self.Height + (self.Height / scaleRate)AkiraWong2013-02-09 03:01:38
B
13
S
5
G
3
Posts: 63
Reputation: 3,989

Post » Sat Feb 09, 2013 3:29 am

Thanks AkiraWong!

I'll give this a try and see what happens!

Not too sure about LERP :D
B
45
S
12
G
7
Posts: 339
Reputation: 7,899

Post » Sat Feb 09, 2013 4:18 am

Worked perfectly thank you!!
B
45
S
12
G
7
Posts: 339
Reputation: 7,899


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, currypuff, DemantDigitalArt, Unconnected and 31 guests