Stencyl 3.4.0 is now out. Get it now!

Scaling Utilites (Optimize Pixel Art and More!)

harryzun

  • *
  • Posts: 24
Scaling Utilities
Tools for Scaling Actors in Stencyl

Finally, a way to reliably work with pixel art at any size! Scale tiny pixel art graphics to fit any theme or purpose, and most importantly, at no cost to functionality.

However, this isn't only for pixel art. Basically, this extension fixes the unreliable scaling system that Stencyl currently has in place. It allows you to scale actors and easily manipulate those actors once they've been scaled. It gives you access to many properties for scaled actors that are either incorrect or missing from the default blocks. See the documentation for screenshots and more details.

Scaling is especially useful for pixelated retro games, allowing you to import artwork smaller than 1x, and scaling it up later to save space. Note: you should have anti-aliasing turned off when you upscale pixel art. You can turn it off in the game settings.

It has only been tested on Flash and iOS, but it should work on all platforms.

7 New Blocks!

Action Blocks
  • Set Scale by Percent
  • Set Scale by Size

Normal / Value Blocks
  • Get Scale Percent
  • Get Size
  • Get Coordinate
  • Offset Coordinate
  • Is Scaled? (Boolean)


Additional Links

Based loosely on a StencylForge behavior by Rob1221.

« Last Edit: August 05, 2014, 10:04:31 pm by harryzun »

LIBERADO

  • *
  • Posts: 2125
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.


yoplalala

  • *
  • Posts: 1366
Thanks, just used it, really helpful :)

yoplalala

  • *
  • Posts: 1366
I have a suggestion, you could make a new block so if you change your height to 100px for example the width changes proportionally.

yoplalala

  • *
  • Posts: 1366
Scaled X  and Scaled Y doesn't work if you have grown your actor with the origin centre not in the middle

harryzun

  • *
  • Posts: 24
Hey yoplalala, thanks for your suggestions! I'm a little busy at the moment, but I'll look into it soon!

Sunny

  • Posts: 53
Hey thanks for making this! It seems to work but seems glitchy, not sure what I did wrong here, could someone help me check?

I have spawned two of these actors on the scene, and I want them to expand if the mouse is pressed on them:
It only works sometimes and i'm not sure why

It seems to work when I only have one actor on the screen though

LIBERADO

  • *
  • Posts: 2125
It seems to work when I only have one actor on the screen though
I have replicated your code, and it does not work for any actor.
However, I have created a new blank game, replicated again your code, then it works for any number of actors.
Weird...
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

yoplalala

  • *
  • Posts: 1366
What is the origin of the actors ? If I remember well, the scaling extensions only works well when it's in the centre.

LIBERADO

  • *
  • Posts: 2125
In my first attempt, the origin point was set in the center, but the extension didn't work until I created a new blank game.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Sunny

  • Posts: 53
Thanks for trying guys, I don't really know either, might make a forum post see if others can help, maybe its bad programming technique :P

yoplalala

  • *
  • Posts: 1366
I don't think it's your fault, sometimes illogical weird things happen and it's nobody bad programming technique ( or so I tell myself :P) .

purplelava

  • Posts: 82
You are actually saving my life with this one. Finally I get the proper width/height of actors I have scaled in the editor.

By scaling actors in the editor, Stencyl would simply not update their width at runtime. I don't know if I missed something as this is just very weird.  This would create issues such as not rotating actors correctly if their origin point isn't at the center.

This extension seems like it's fixing my problems. Thank you!

Konig Studios

  • *
  • Posts: 65
awesome job on this. Helps out a lot. I think Jon should incorporate this into the actual build since its way more useful than the current functions.