Pixel Ninja!

Hey everybody!

I made a ludum dare game called Pixel Ninja.  The theme of the LD was Minimalism, so I made a game about a ninja made of pixels.  You run around collecting blue orbs in the 2000 by 2000 block map.  I’m waiting for a postmortem until my game gets scored, but I’m willing to make a prepostmortem.  So a mortem I guess?

But first, play Pixel Ninja!

What went right:

  • The art.
    I can do pixel art, so I use it whenever I can.  7/13 of the comments so far are people saying “I liked the Ninja/art”
  • The music.
    My friend rytonbay did the music for it, and it’s great!
  • It was a platformer.
    I can make platformers.

What went wrong:

  • My computer.
    I needed to switch browsers to k-meleon during the LD just because I didn’t have enough RAM 😥
  • My timing.
    I had just finished an RPG session when I notice “Oh, right, Ludum Dare already started.”
  • The theme.

It feels good to get back into game dev again when I had been doing other things for a while now.



New Software: NotPad!

I just made a new software tool called NotPad!  It’s like notepad, the tool that comes built into windows, but open source and has slightly less functionality.  It’s programmed in python, using the wxpython library.  If you’re a “free speech” sort of person, you can grab the source here, but you’ll need to download python and wxpython before you run it.  If you’re more of a “free beer” type, you can download a windows binary blob here (Mac and linux downloads coming shortly after you need them).  If you have no idea why I’m talking about free speech and free beer, read more about open source software.

NotPad is licensed under the WTFPL, with an added “no warranty” clause.

The current release is Beta 1.0.0

Here’s a screenshot:


AABB’s for complex objects in lua.

I touched on complex objects a bit in my previous collision detection post, and now I plan to talk more about them.  Specifically, creating AABB‘s for complex objects, and drawing complex objects.  You can find the example löve file here.

For the purposes of this post, I will define a complex object as a set of points that are connected in a specific order to create a shape.  What do I mean by that?  Something along the lines of this:

obj1 = {{10, 50},{20, 30},{30, 70},{70, 90},{20, 10},{70, 30}}

That would create this object:

Image broken, use link untill I fix it.

I have created 2 useful functions when dealing with complex objects.  A function to draw a complex object, and a function to calculate the AABB of a complex object.

To draw a complex object, use this:

function drawcompobj(obj)
    local ppx = obj[#obj][1]
    local ppy = obj[#obj][2]
    for i=1, #obj, 1 do
        love.graphics.line(ppx, ppy, obj[i][1], obj[i][2])
        ppx = obj[i][1]
        ppy = obj[i][2]

Line by line, here’s what it does:

    local ppx = obj[#obj][1]
    local ppy = obj[#obj][2]

This sets ppx and ppy to the last coordinates in the array.  these will be used as the starting point for each line it draws.

for i=1, #obj, 1 do

This loops through all of the coordinates in the array “obj.”  We will draw a line for each one of these points.

love.graphics.line(ppx, ppy, obj[i][1], obj[i][2])

This draws a line from the previous point to the current point.

ppx = obj[i][1]
ppy = obj[i][2]

This sets the previous points to the current points.

I also have a way to get an AABB for a complex object.  All this does is loops through all of the points, and gets the biggest and smallest X’s and Y’s.  Here is the code:

function makeaabb(obj)
    local minx, maxx, miny, maxy = obj[1][1], obj[1][1], obj[1][2], obj[1][2]

    for i=1, #obj, 1 do
        if obj[i][1] > maxx then maxx = obj[i][1] end
        if obj[i][1] < minx then minx = obj[i][1] end
        if obj[i][2] > maxy then maxy = obj[i][2] end
        if obj[i][2] < miny then miny = obj[i][2] end

    return {minx, miny, (maxx - minx), (maxy - miny)}

Here’s what it does, line by line:

local minx, maxx, miny, maxy = obj[1][1], obj[1][1], obj[1][2], obj[1][2]

This sets the default minimum and maximum values for X and Y.

for i=1, #obj, 1 do

This loops through all of the points in the complex object.

if obj[i][1] > maxx then maxx = obj[i][1] end
--Other similar stuff.

This sets the current highest x value to reflect it being compared to the previous highest x value.  The other 3 lines do basically the same thing.

return {minx, miny, (maxx - minx), (maxy - miny)}

This returns the x, y, width and height of the complex object.

I hope you find these functions useful, or at least that you enjoyed reading about them.

Once again, you can find the example löve file here.

Looping multiple songs in flashpunk

Hello!  Today I’m going to talk about looping multiple songs in flashpunk.  If you just want to loop one song, you can simply call:


But if you want multiple songs located in separate files to loop, then it gets harder.  I use the following code:

[Embed(source = '../assets/music/song1.mp3')] private const BGMusicEmbed1:Class;
public var BGMusic1:Sfx = new Sfx(BGMusicEmbed1);
[Embed(source = '../assets/music/song2.mp3')] private const BGMusicEmbed2:Class;
public var BGMusic2:Sfx = new Sfx(BGMusicEmbed2);

public var tracks:Array = new Array(BGMusic1, BGMusic2);
public var musicplaying:Boolean = false;

//Inside update loop:
musicplaying = false;

for (var i:Number = 0; i < tracks.length; i ++)
    if (tracks[i].playing)
        musicplaying = true;

if (!musicplaying)

Now I’ll explain what that does.

The first 5 lines embed 2 songs and put them in a array.

The first for loop finds out if any of the songs are playing.  If none are playing, it sets musicplaying to false.

The if statement plays a random song from the array if no songs are playing at the moment.

There are a number of ways this could be improved.  It could keep track of the song it was last playing and make sure not to play it twice in a row.  It could also loop through them, shuffling the array each time, so that it will have the maximum amount of time between each song repeating while still playing a random song.  This snippet is just a *simple* song manager.


Finished the Mini-LD, ready to do it again in 15 days!

Well, I finished my Mini-LD game, Gravity Flip, and had a lot of fun making it!  This whole post basicly a Post Mortem of my game.

What Went Right:

  • Game Idea  –  I aimed for something simple and fun.
  • Theme  –  I can do pixel art.
  • Flashpunk  –  It’s easy to use.
  • Level design  –  I’m great at creating evil levels.  Unfortunately, none of the playtesters beat them all without cheating 😦
  • Music  –  Sounds great!
  • Playtesting  –  I had 2 people playtest while I could watch them and hear them give me feedback.

What Went Wrong:

  • Flashpunk  –  It was the first time I used it!  Luckily it’s easy to learn 🙂
  • Submission process  –  I HATE U McFUNKYPANYS!!!  I never even got to submit my game, because the submission process makes no sense!
  • Sound  –  I’m not really happy with it.  It should stand out more.

What I Learned:

  • Know what you are allowed to use ahead of time.  I’m not sure if I was even allowed to use the music that I did for a Ludum Dare.
  • Sleep (But only when you need to.)  I slept, but not before it was affecting my programming skills.
  • Aim for something you can create.  I knew I could make a gravity switch platformer because I had made one before.

Well, I had fun with the mini LD, and I’m ready to do it again in 15 days!  Who’s with me?

My Ludum Dare game is semi-playable!

That’s right, it’s semi-playable, and YOU can play it!  The swf file is here, I haven’t gotten around to putting it in the funkytron yet.


Arrow keys: Move

Space: Switch gravity


I plan to add all of this stuff if I have time:

  • Doors
  • Buttons (?)
  • Disappearing blocks
  • Gravity switch blocks
  • Sound
  • Instructions
  • Enemies
  • A Boss
  • Credits
  • More levels

That’s probably shooting too high for a LD, but I’ll be happy if I put in 4 or 5 of them.

If you have any other suggestions, please comment and let me know!