Animate Title Logo on screen...

Get help using Construct 2

Post » Mon Jan 23, 2012 10:11 pm

Hi guys, it seems that i'm stuck on the simplest task. How can i animate my game logo moving automatically from offscreen left to center of the screen while changing size from small to big in the simplest of ways. Do i have to use behaviors or can it be done through the set position commands. Any samples will be greatly welcomed. Thank you...
B
82
S
11
G
8
Posts: 153
Reputation: 10,215

Post » Mon Jan 23, 2012 10:12 pm

Set its x to this:

lerp(self.x, WindowWidth/2, 0.8*dt)

Hope that helps, Let me know if you need me to explain it to you.
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Mon Jan 23, 2012 10:12 pm

I mean set its x to that through events by the way
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Mon Jan 23, 2012 10:13 pm

Thank you, smitchell. I am not at all familiar with lerp, can you explain how this works. Thanks for your prompt response.
B
82
S
11
G
8
Posts: 153
Reputation: 10,215

Post » Mon Jan 23, 2012 10:40 pm

Explanation of lerp - LINK from the how do I FAQ

For the size you can lerp it too, or check in the FAQ there's an example listed in the "sprite" section.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Jan 23, 2012 10:53 pm

Lerp takes 3 perameters, a a, b and c.

the a is allways the start of what your lerping, It tends to only work if you call something like: sprite.opacity. ect then b is what you want it to lerp to, so if i want the sprite to animate from a opacity of 100 to 0 then i set b to 0. And c is the time it takes to do it. Usually 0.8 is a nice number buy you can play around with it. and then you times the number by dt this just makes things happen in real time.

So for a opacity of 100 to 0:

Sprite.setOpacity{lerp(Sprite.Opacity, 0, 0.8*dt)}

To animate its x position to the center of the stage:
Sprite.setX{lerp(Sprite.x, WindowWidth/2, 0.8*dt)}

To animate its y to center of stage:
Sprite.setY{lerp(Sprite.y, WindowHeight/2, 0.8*dt)}

Hope that was some help.
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Tue Jan 24, 2012 1:04 am

smitchell, thank you for explaining something that seems complex in a such simple manner. LERP is definitely going to be my new friend. Hope this also helps others as well. Going to start applying it right away.
B
82
S
11
G
8
Posts: 153
Reputation: 10,215

Post » Tue Jan 24, 2012 1:06 am

Thanks for pointing me to the right links!
B
82
S
11
G
8
Posts: 153
Reputation: 10,215


Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, Skebab, spcsmrf and 19 guests