Sam Profile picture
Jan 26 9 tweets 4 min read
If you want to make your sprites stretch and scale like this, then you should be using nineslices! There's lots of uses for them. Here's how I use them in #gamemaker as a #gamedev
A thread🧵👇
A nine slice sprite is one that you can divide into nine sections. When you do, the sprite can stretch to different sizes while maintaining the shape of the outside edges. This is great for UI, and how they're usually used. Dialogue boxes, inventories, etc.
The corners will stay unstretched, but you can choose set the inner sections to "stretch" or "repeat." This let's us do interesting things, too. Here I've set the top to stretch and the bottom to repeat. Notice how it looks when I change the size of the sprite!
If I need this sprite to be 500 pixels tall, I can nineslice it along the shaft of the arrow, then just stretch it. Saves my texture page page for something more important. You might have to adjust the section borders a bit to get the desired result.
...and you can also scale the sprite or object in the room editor, and you'll see the effect, too! Here I used the sprite to define the min/max bounds of the spiky ball. It's great to have visual representation of this in the room editor!
This is my absolute favorite way of building levels! I don't get stressed out thinking about large, complicated buildings. I think of structures in small, modular pieces that can be scaled and reused. Feels like playing with blocks or Lego.
You can assign the sprites to an object, of course, and the nineslice sprite will STILL do its magic when you change the scale using image_xscale/image_yscale. A nineslice sprite can also be drawn with different sizes with draw_sprite_stretched() or draw_sprite_ext()
Like everything else, it's not a solution for every game, but it certainly works for me here. I have so much fun making new modular elements and building levels. This is all possible with nineslices! You can read more about them here: manual.yoyogames.com/GameMaker_Lang…
Comment and tell me about the cool ways you've used them in your projects!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Sam

Sam Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(