Scale Behavior

This forum is currently in read-only mode.
1 favourites
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hello, everybody, and above all talented plugin devs

    Having worked with Construct for a little while the need for one behavior pops up most often and that is � Scaling. Sure, it can be done with timers and events by doing some math, etc.

    But what would be AWESOME would be a decent Scale behavior. Something that lets easily scale a given object both statically and over time. I took the liberty of thinking up some functions it might have. To help illustrate here is our friend the gray rectangle:

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB1.png">

    And now for all the functions:

    PROPORTIONAL SCALING

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB2.png">

    Scales the object proportionally.

    Would be great: Resize proportionally by width, Resize proportionally by height.

    SCALE WIDTH

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB3.png">

    Scales only width.

    SCALE HEIGHT

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB4.png">

    Scales only height.

    PROPORTIONAL SCALING OVER TIME

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB6.png">

    Set the time in ms and amount to scale the object proportionally.

    SCALE WIDTH OVER TIME and SCALE HEIGHT OVER TIME

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB7.png">

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB8.png">

    Also awesome would be a feature to set the size by both pixels (for a straight up fixed size) and percent (to scale object to a given percentage of itself).

    If anyone would manage to build a behavior which does all this that would be simply amazing (a guaranteed place in the pantheon of godlike plugin coders for sure). Would try to do it myself, but C++ just isn�t a programming language I can digest.

  • And now for all the functions:

    PROPORTIONAL SCALING

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB2.png">

    Scales the object proportionally.

    Would be great: Resize proportionally by width, Resize proportionally by height.

    SCALE WIDTH

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB3.png">

    Scales only width.

    SCALE HEIGHT

    <img src="http://i244.photobucket.com/albums/gg36/some9000/SB4.png">

    Scales only height.

    How is this any different from the "Set width" and "Set height" actions?

    And I'm not entirely sure that there would be a need for a plugin to change the scale over time, as that's easy enough to do with events. Here's just one method (I can think of several):

    http://dl.dropbox.com/u/529356/scale.cap

    I don't mean to disparage your idea, I'm just wondering what would make this plugin worth the trouble of creating when it's already got built-in actions for one half and there are really easy methods to do the other half with events. And yeah, I know there are Rotate and Fade behaviors that do simple tasks for you as well, but I doubt their necessity too

  • How is this any different from the "Set width" and "Set height" actions?

    It's lazy people friendly and lets you enter a single value instead of doing something like this.height = this.height * percentage/100 or so.

    And those commands don't do it proportionally, do they?

    I'm just wondering what would make this plugin worth the trouble of creating

    Well, yeah, it's mostly a convenience thing and I must agree development would probably take more time and nerves than most users using it instead of events save. I'd still love an easily animatable Scale behavior. Using extra variables in objects always seems so... "dirty"

  • I could probably pull something like this together in around a day, so I'll probably take a crack at it. Not immediately, though, as I've got more important plugin related things I need to finish up at the moment.

  • Well you mentioned changing the sine behavior to have a z axis setting, why not add a deactivate for a percentage of the sine?

    You would probably need to add something where it would ask to continue the sine, or restart it on activation.

  • I could probably pull something like this together in around a day, so I'll probably take a crack at it.

    If you manage to make animatable proportional scaling... you'd probably get a big golden shrine in my little shmup (along with deadeye who'd probably be represented as an acquirable ally WWII fighter pilot who disappeared over the Bermuda triangle, is VERY good at shooting, hence the name and now flies his fighter plane ... IN SPACE ... we far enough off topic yet? )

    Seriously, though, would be great if you could do it some day.

    Not immediately, though, as I've got more important plugin related things I need to finish up at the moment.

    Yeah, the sprite button project looks pretty good. Actually all the previous ones are great as well - using Orbiter in a project as we speak. Keep up the great work

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • check out the lerp and cosp system expressions for scaling over time

    , and for "scale" scaling do some cross multiplication, and you can figure out the scale height or width based upon a chosen/known width or height. or you can multiply them both by a known scale factor.

  • I support this. Would be cool to have a scale behavior!

  • Yes, it's very easy to do with events and a bit of math, but everything that Construct does can be put in that category.

    Why wouldn't anyone want a quick way of doing this without events.

    If you need to do something that the plugin doesn't do, then it's time to do the maths.

    I also support this plugin.

    Krush.

  • Because of all this talk about how easy it is to get the same effect using lerp, timedelta, etc. I decided to give it a try. And while it's certainly possible it's at the same time sort-of cumbersome and would REALLY benefit from a nice and easy behavior plugin

    Still, the result is interesting, check it out here, if you please: http://dl.dropbox.com/u/1328856/DT.zip

    It's an exe, since it uses the latest unstable build and an extra effect. The Escape key will eject you and the R key will do something as well.

    Might just turn it into a full little game, above all if this behavior becomes available, heh, heh.

  • That is really nice looking =)

  • I'll have time to work on this come Tuesday, but it would be helpful if you could pull together a list of actions that you'd like to see before then. It would also be helpful if you could be as descriptive as possible about each one that way I don't make the plugin in a way that seems fine to me but odd to others.

  • Id say you'd want a setting for min, and max, as well as starting increment, you know up, or down.

    The question is are you going to make it like sine, so that it can work as a wave, or will it just be one cycle?

    Also are you just going to do size, or do you want to include angle, opacity, x, and y, etc?

  • I'll have time to work on this come Tuesday, but it would be helpful if you could pull together a list of actions that you'd like to see before then. It would also be helpful if you could be as descriptive as possible about each one that way I don't make the plugin in a way that seems fine to me but odd to others.

    Ok, I'll give it a shot - surely others may have ideas as well, but here's how I'd see it (having taken a big knife to the initial description and trimmed off all the fat):

    I'll use a mockup of how it may look in the editor, seems to help with describing it. So Anyhow:

    <img src="http://i244.photobucket.com/albums/gg36/some9000/ScaleBahavior.png">

    Basically like the Fade behavior, but for Scaling. Let's go over the options:

    Activate at startup - same as Fade.

    Scale over time - if this is greater than 0 then it's an animated scale and you set the time in ms to go from current size to the new one.

    Horizontal Scale (px or %) and Vertical Scale (px or %) - this would be the meat and potatoes right here - if it could understand % then there's no need for a separate proportional scale behavior - just set both Horizontal and Vertical Scale to, say, 150% and you get proportional scaling.

    Set the size in pixels and it scales to that (up or down, as needed).

    Destroy afterwards - same as Fade. So you could have it scale to 1 px and then disappear. Or combine with Fade, scale to 200% or more and get some nice puffs of smoke.

    Show in Layout Editor - Not sure if this can be done, but it would be cool - check this to see the end size of the scale - would help with some decisions without starting the layout all the time.

    Now onto the editor side:

    <img src="http://i244.photobucket.com/albums/gg36/some9000/ScaleBahavior2.png">

    I'm not sure if a separate Set Up window is possible, looks like all the Behaviors so far use single-link settings. So just a mock-up for that. Should work the same here - enter scale in pixels or %, etc.

    As for Conditions - not sure if On Scale start is necessary, since mostly it would already be there because of some event. On Scale complete could be useful, though.

    Well, that's the idea - hopefully it's not looking too imposing and not too much like terrible linkman exploitation on my part I'd gladly help with something within my skillset (mostly graphics work), that's for sure.

  • Perhaps a Loop setting, for pulsing things.

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