@AdventureMtn @cgbarrett ah, yeah shoebox: t.co/gQ43XXGnBb (Today)

@AdventureMtn @cgbarrett I used the video timeline in Photoshop, you can do render video to export each frame as a png (Today)

Here's hoping for more dog focused action sequences in Independence Day: Resurgence t.co/SHJoMo2LDG (Yesterday)

@Tawnithan ah the ole run the shower, sink faucets, and hair dryer style. (Yesterday)

@Endraxial Now that's what I call a close encounter. (Yesterday)

@MANvsGAME I write in Thomas Whitmore every election. (Yesterday)

I'm just so happy there's a day every year where we can put aside our differences and agree that Independence Day is the greatest movie ever (Yesterday)

@Dan_Adelman Just as planned... (Yesterday)

@NoelFB get confused, live stream hair cut instead (2 days ago)

@mguniverse 48 (2 days ago)

@TommyRefenes @BenRuiz @SanatanaMishra resteroni in pastramalamidingdongerino (2 days ago)

@floatvoid foreach (var sushi in sushiPlatter) { Eat(sushi); } (3 days ago)

@saracecilia the dark ui ;_; (3 days ago)

@floatvoid @C418 yeah the dark ui is pro version only uuugguhfufnsiej3oqbnd (3 days ago)

@C418 Yeah it's like "Oh boy I can try it out for a month for $75!... oh wait I have to pay $900." (3 days ago)

I really don't understand the point of Unity's $75 a month thing when there's a 12 month minimum... :I (3 days ago)

@ADAMATOMIC (the games I've shipped seem big ish to me but are still small compared to most stuff I think) (3 days ago)

@ADAMATOMIC making stuff seems way harder since releasing big ish things. I'm kinda happy but kinda not? (3 days ago)

I was going to do some tests in Unity today, first time I opened it in like 2 years, and of course the licensing server is down #rip (3 days ago)

@achebit I make sure to push them out of the wall entirely before reversing the speed. if (x < wallLeft) { x = wallLeft; speed.X *= -0.9f;} (3 days ago)


2013 - 3 - 6 / 2:14 pm / general

A Flashpunk 9-Slice Object

A Flashpunk 9-Slice Object

As I've been working on this Global Game Jam game remake, I've been trying to come up with solutions for problems that I can hopefully reuse for more projects in the future. One of the things I've been thinking a lot about is managing and drawing the various user interfaces for the game. Even though I'm not quite sure how much UI stuff this game will need, I wanted to have some sort of solid base to start with so that I could get stuff up and running quickly.

One of the most basic core structures of drawing a cool UI (in my opinion!) is a 9-slice graphic object. What's a 9-slice graphic object?! Well, here's a quick example of one that I have working in Flashpunk right now.

The box that is being drawn above the red player rectangle is a working example of my NineSlice class. It's being drawn from a source image of nine tiles. The source file has four tiles for the corners, four tiles for the sides, and one tile for the center. Here's what the source looks like (blown up 4x because it is tiny.)

This is incredibly useful because it's now possible for me to draw stylized boxes for potential UI components at any size without having to draw each one individually. One thing that I wish that I had spent more time on in Offspring Fling is the UI for the menus, so in the future I want to make my menus and interfaces as awesome as they can be, and having some functions do a lot of the fancy work for me is a big step in that direction. Here's what it looks like right now: NineSlice.as

Here are some snippets of code from the example shown above:

//initial set up
private var nineSliceTest:NineSlice = new NineSlice(Assets.IMG_NINE_SLICE_TEST, 3, 3, 3, 3);
//in the entity's constructor
nineSliceTest.scrollX = nineSliceTest.scrollY = 0;
nineSliceTest.width = 40;
nineSliceTest.height = 40;
nineSliceTest.x = 50;
nineSliceTest.y = 50;
//in the entity's render function

Right now this is a very rough first pass on this kind of thing. Ideally it would be some sort of Flashpunk graphic extension that would plug directly into the Flashpunk rendering system. For now it makes use of the Flashpunk Draw class, and some utility functions that I've written for myself. Feel free to use it or improve it, and if you end up improving it then let me know!


2013 - 3 - 11 3:45 PM


excuse me but i see a diagonal tile how can i dothat in FP?


2013 - 3 - 11 8:02 PM


I posted about slopes a few weeks ago, if you just go back through the posts in February you'll find some info about that.


Post your comment!




Hi there, my name is Kyle, and I'm a kid disguised as a grown up. I'm making video games and living the indie game developer life in Tempe, Arizona. Here you will find my thoughts, games, websites, doodles, and other stuff like that. I worked on Snapshot, Offspring Fling, and a whole bunch of other games. I also created and maintain Otter, a 2d game making framework. If you want to get a hold of me use the form on the bottom of the page, leave a comment, or just tweet at me. I try to post three times a week. Thanks for stoppin' by! You're the coolest.



Do you want to make a Let's Play of one of my games, or a just a video featuring footage of my games? You have my full permission to do so! Even if you are monetizing your videos, you still have my full permission to use any footage from any of my games. Go for it!


Your message has been sent! Thanks :)