Ask here your questions to get help using GDevelop.
User avatar
By MythikAngel
#64620 This may be a bit of a newb question, but that's because I'm a newb.

I know I can change the scale/size of an object using the "Modify the scale of the specified object" action. But the scaling occurs instantly. How do I add a transition to the scaling, that you can visually see the object changing in size? For example, the player collects a coin, and a sphere object somewhere in the scene gets 20% bigger during a time of three seconds?
Last edited by MythikAngel on Sat 6 Jan 2018, 23:44, edited 1 time in total.
User avatar
By Lizard-13
#64622 I'm busy right now, so I can't make an example, but I would do it this way:
  1. Create a variable "target_size" and set an initial value of 1 (or your object default scale). If the object you want to scale is only one this variable can be a scene variable, if there are many objects and you want to scale them independently this variable has to be an object variable.
  2. When you collect a coin, add 0.2 to the "target_size" variable (0.2 is 20% in a base of 1, and the scale is in a base of 1). If you have many scalable objects you'll have to select the right one before.
  3. The last event, always, if the scale of the object is < the "target_size" value, add TimeDelta()*0.1 to the scale of the scalable object, adding TimeDelta()*0.1 means increasing the scale in 0.1 per second, replace 0.1 with your own value.

If it isn't very clear (lot of information in a few words), give me one hour or two to make an example for you (if somebody wants to make it is very welcomed), you'll see its pretty easy actually :D
User avatar
By ddabrahim
#64623 I have just quickly created an example (realized I haven't done any in my collection).
I did it different than Lizard-13 suggested, I'm increasing and decreasing the scale of the object every x seconds with a specified amount directly without using any variable. It is useful in case you want it to be a smooth transition and the most simple way if you want to scale only one object at the time.
But the way Lizard-13 suggesting might fit your needs better if you want to change back and forth between different sizes and for more than one object at different times:

Example:
https://gametemplates.itch.io/template- ... f-a-sprite
User avatar
By MythikAngel
#64624 I was able to achieve the wanted result using Lizard-13's method. But ddabrahim's example certainly helped me to widen my knowledge of the software. Thanks to both of you! ^^
User avatar
By ddabrahim
#64625 Just in case if someone needs it. I have created one more example using variables because realised it might be important to some to scale multiple sprites in different intervals:
https://gametemplates.itch.io/template- ... le-sprites