How do I increase/descrease the sprite size?

  • 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!

  • 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)

  • 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 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

  • 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! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Does anyone else have an idea?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I rather use like animation and adjust the speed for the time frame of 2 sec. Its how im doing explosion of circles.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)