How do I increase/descrease the sprite size?

Get help using Construct 2

Post » Sun Dec 27, 2015 3:57 pm

Hello friends!

How do I increase the sprite size in C2 from, let's say, 1 pixel to 60 pixels? When I press a button, I want to create a sprite object on my layout and increase it's size from 1 pixel to 60 pixels in 1-2 seconds (or less)...like an animation. I want it to look like the object is getting closer to the player. Do I have to make an animation in C2 or there is some kind of effect (like the fade behavior) inside C2...or do I have to make an animation with some kind of external program?

Thanks!
B
9
S
4
G
3
Posts: 157
Reputation: 2,300

Post » Sun Dec 27, 2015 4:24 pm

sivricmarijan wrote:Hello friends!

How do I increase the sprite size in C2 from, let's say, 1 pixel to 60 pixels? When I press a button, I want to create a sprite object on my layout and increase it's size from 1 pixel to 60 pixels in 1-2 seconds (or less)...like an animation. I want it to look like the object is getting closer to the player. Do I have to make an animation in C2 or there is some kind of effect (like the fade behavior) inside C2...or do I have to make an animation with some kind of external program?

Thanks!


You can use the sine Behavior in Construct 2..

1)Click any Object
2)Properties Bar --> Find Behaviors
3)Add Behavior names Sine
4)Set Movement to Size
5)Wave to whatever you like, but I don't think the option Square works here.
6)Set Period to the Time it takes to do the transition
7)Set Magnitude to 60pixels
8)Be sure to set the object's size to 1 pixel
9)Set the active on start to yes if you want the transition to activate immediately on startup but if you don't you can do it using the event sheet.
10)Use the event sheet to make a stop event.

But I really recommend you to just use lerp but it will do mostly in the event sheet

1) Set the Object size (1,1)
2)In the event sheet:

Condition: If Object.Size is less than 60 then
Action: lerp(Object.Size, 60, Speed * dt)
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Sun Dec 27, 2015 4:39 pm

Hey @sivricmarijan hi.
I think the most right way its with the lerp function as @chadorireborn mention.
http://www.filedropper.com/spritesize
But if you want to mess with behaviors do it with the litetween behavior is more powerful than the build-in sine behavior.
Cheers.
B
36
S
15
G
1
Posts: 59
Reputation: 3,441

Post » Sun Dec 27, 2015 4:54 pm

chadorireborn wrote:Thanks chadorireborn!!!


But I'm missing something. What is "lerp"? Here is what I have now (I am creating my sprite with every click):

https://www.dropbox.com/s/a9r9kw9idm6qcu8/sine.png?dl=0
B
9
S
4
G
3
Posts: 157
Reputation: 2,300

Post » Sun Dec 27, 2015 4:55 pm

saour wrote:Hey @sivricmarijan hi.
I think the most right way its with the lerp function as @chadorireborn mention.
http://www.filedropper.com/spritesize
But if you want to mess with behaviors do it with the litetween behavior is more powerful than the build-in sine behavior.
Cheers.


Thanks! I will try this! :)
B
9
S
4
G
3
Posts: 157
Reputation: 2,300

Post » Mon Dec 28, 2015 11:07 am

Does anyone else have an idea?
B
9
S
4
G
3
Posts: 157
Reputation: 2,300

Post » Tue Dec 29, 2015 8:31 am

I rather use like animation and adjust the speed for the time frame of 2 sec. Its how im doing explosion of circles.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests