set scale sprite from small to big?

Get help using Construct 3!

Post » Mon Aug 07, 2017 3:03 am

how to add 1 to size of sprite every 1 second or tick,
like the sprite increase from small to big?
Posts: 26
Reputation: 577

Post » Mon Aug 07, 2017 10:20 am

Here's a project that shows you how, it is very simple by the way. All you do is create an instance variable for the sprite, then every second add to the instance variable the size that you want. Last but not least, every tick | your sprite -> set size to Self.size (the instance variable we created, Self means that it is a variable of a sprite)

Project download:!u8tUzS5J!tjxPKv5_vQawD8HY77MKhQ
Posts: 159
Reputation: 3,276

Post » Mon Aug 07, 2017 12:24 pm

7Winter answered your question as exactly as possible.

But lets dive a little deeper in the problem. And then i have to start with putting your question in question.
Size(In C2 language) is (indeed) width & height combined. I suppose that when you want to add 1 to the size, that you want to add 1 to the height and 1 to the width. That will only work for square objects. And, if you keep adding 1 (a constant), the rate of the scaling will be different on a slow machine (compared to a fast device). And, obvious, adding 1 to a sprite with size 1000 pixels gives a total different perception than adding 1 to a sprite with a width of 1 pixel. (in the last case it just doubles, in the first case it is even hard to see a difference).

So, allow me to dive into this in steps. To start with, it easier to use 'scale' in stead of 'size'. ... .capx?dl=0

But this has still the problem that the scaling rate depends on the FPS linked to the device. We solve that with using dt. You should always use dt if you do something per tick. ... .capx?dl=0

To be complete lets do the same with 'size'. ... .capx?dl=0

Now both 'solutions' still have a 'perception' problem. The rate is unnatural. It seem to scale faster when it is small and slower when it is big. Lets do something about that. Here you see 2 sprites grow, so you can compare. I am not smart enough to do that using 'size'. So i fall back to using 'scale'. ... .capx?dl=0

Or, lets even do it even 'supernatural'. ... .capx?dl=0
Posts: 2,493
Reputation: 21,450

Return to How do I...?

Who is online

Users browsing this forum: No registered users and 0 guests