Scale Behavior

New releases and general discussions.

Post » Wed Feb 24, 2010 1:37 am

Here's the first beta of the scale behavior as requested by Somebody. I'm fairly confident in how this turned out, so perhaps this will also be the final release. :)

[size=150:2foj8til]Scale Behavior - v0.9b[/size:2foj8til]
[size=125:2foj8til]Download Now(no example) - 98KB[/size:2foj8til]

This doesn't include an example(I'll try to get around to that eventually), but everything should be pretty self-explanatory.

First you setup your scaling animation settings in the behavior's properties. You can either choose to have this scaling animation played at the start of the object's life or start it later using the "Start scale" action. Alternatively, you can use the "Scale over time" action to do the same thing but entirely at runtime.

All scale values are given as percentages and scale the object according to the size of the current image. So if you have an object that is 64x64, but its image is 128x128, a scale value of 200% would set the object's size to 256x256.

Be sure to leave your comments concerning suggestions and bugs. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Feb 24, 2010 1:58 am

Excellent mate!!!

I really like the ability to loop back and forth or reset, and the cosine interpolation.
How many people will be using both those features to make their "collectables" pulsate. :)

I haven't found any problems yet, but I've only just started playing with it.

Who says we don't need shortcuts like these?
Regardless of whether it's easy enough to do with events, this is exactly what Construct is all about.

Nice work (and quick too!)

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Wed Feb 24, 2010 7:29 am

Awesome! Thanks, linkman! Will try to make a nice simple example as well.

I think it has turned out great - nice, simple, quick to use. Will have to play around a little, check it out more. Try layering it, stuff like that (like pulse a little and get smaller over time).

One little thing - in Actions there are two links to "Scale over time" - one has almost all settings, the other only settings for interpolation. Is there a limit to how many settings can appear in one link or it just ended up there? :)

Evil edit: Ok, just tried layering the effect, but it always takes the first behavior. Would be actually be possible to layer them? Because that would allow for even more crazy stuff - like set one to Scale down to 1% over 5 seconds, other to pulse every 100ms, etc. Well, if it's not too much work. This is super great already. :)

Extra evil edit: Also... Would it be possible to work off off the current size instead of the base image size? So you could, say, set the size to 400% and then start a behavior to scale it down to 1%? That would be really handy.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Wed Feb 24, 2010 9:26 am

Neato, thanks! :)
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Sun Feb 28, 2010 4:08 am

Thanks, guys. :)

The two scale over time actions was an accident. One of those is supposed to say "Set interpolation". :P

As for stacking behaviors, as you point out it's not currently possible, but I'll try to throw in support for that. And about the scaling from the base image size, I really don't want to change from that. Perhaps make I could make your suggestion an optional feature, but I feel it works fine as is. I'll see what I can do, though.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sun Feb 28, 2010 4:17 am

Why does it scale from original image size rather than sprite size? If someone has a 64x64 image but they set the sprite to 32x32, they always have to remember to scale straight from 50% if they want it to scale from 32x32.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sun Feb 28, 2010 5:05 am

[quote="Mr Wolf":3h9c07tr]Why does it scale from original image size rather than sprite size? If someone has a 64x64 image but they set the sprite to 32x32, they always have to remember to scale straight from 50% if they want it to scale from 32x32.[/quote:3h9c07tr]
Not the way the behavior works. When you initiate a scale the behavior figures out what the current scale value is and scales up from that, so it doesn't matter what size the sprite is, it will always scale up from the proper size.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sun Feb 28, 2010 2:17 pm

So if you tell something to scale to 100%, it shouldn't do anything?
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sun Feb 28, 2010 4:14 pm

[quote="Mr Wolf":67z0abtq]So if you tell something to scale to 100%, it shouldn't do anything?[/quote:67z0abtq]
Sure, if the sprite is the same size as the base image size. However, if the sprite is smaller than the base image size, it will scale up to the size of the base image.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sun Feb 28, 2010 9:30 pm

Okay, I thought that may have been unintentional when I was using a sprite smaller than the base image.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests