I don’t actually remember the first platformer I ever programmed, but I don’t think it was ever published. I’m about to fix that thanks to a jump-start I got while competing in the 48-hour GIG Jam put on by Glitch Games.
Sidebar: I did have levels for a platformer published in the early 90s. The Dangerous Dave engine was created by John Romero (yeah, that John Romero) for the Apple II and I created 10 more levels for a sequel, Dangerous Dave Returns. That’s my claim to fame, slight though it be.
The GIG Jam started on a Friday afternoon (Alaska time) and the theme was announced: The Elements
Design Mode
My first thought was to do a game based on the R&B group Earth, Wind & Fire looking for their lost Water, but kicked that to the curb pretty quickly. I brainstormed some ideas for maybe 30 minutes and couldn’t come up with anything really clever so decided to go with the Periodic Table of Elements as my interpretation.
I’d been wanting to work on a platformer for years so decided this would be my best chance to work on something I wanted to work on rather than something I should work on (things that pay the bills).
So platformer, chemical elements — guy runs around, jumps on platforms, and finds the missing elements. And since there are 117 elements (give or take) that means I could create lots of levels. 🙂 My plan was to do the first 10 elements for the game jam.
By the time the first hour was up I’d decided on my direction.
Even before the jam started I knew I wasn’t going to create my own graphics — I have a ton of game graphics on my hard drive so I started looking at what was available and chose a set I’d recently purchased.
For the player character I decided to start off with the Crash Dummy sprite created by Chris Hildenbrand – his BlockBuddies sprites are just too cool. And the Crash Dummy is available to use for free.
That was basically my “get ready” as far as design went. I’d make some changes later, but that’s what I started with.
The Tools I Used
The GIG Jam was for Corona SDK developers so I didn’t have to make any decisions on which framework to use (although I doubt I would have made a different choice even if I could have).
I used the Outlaw IDE to write my code and keep all the project assets organized.
TexturePacker and PhysicsEditor from CodeAndWeb were indispensable, especially TexturePacker. I’ve done games using sprites that I packed into image sheets by hand, and I’ve done games using TexturePacker. There is no comparison — and really no sense in doing that kind of stuff by hand.
Sidebar: If you’re new to using sprites, an image sheet (or sprite sheet, or texture atlas – they all mean the same thing, basically) is a file that contains all the frames of your animation. If you have a running character that consists of 5 frames, and you also have 4 frames of him jumping, 5 frames of falling to his doom, etc., you throw all those into something like TexturePacker and it spits out a single image with all of them included, plus a “map” that allows you to easily reference the frames you need.
Since this platformer was going to be a tile-based game I needed something to create the tile maps. Tiled is probably the most popular map editor around (used for laying out the levels of tile-based games). It’s cross-platform and free so what’s not to like? The latest version also has some really handy new features.
Once I had the maps I was going to need to display them using Corona. There’s a 2D tile-based library called Lime that’s now open-source. Lime was the first “engine” for doing tile-based games in Corona and it got a rep for being too slow to be any good. That, despite the fact that some high-speed platformers made with Lime were being sold in the App Store. And honestly, there were some performance problems with it. Some of that had to do with the way Corona handled graphics, and some had to do with the fact that Lime is *very* full-featured. Add a feature, take a performance hit.
But again, this was my chance to dig into Lime (which I needed to do because Outlaw Game Tools (me) is kind of in charge of it now) so I decided to see what it could do. More on that later…
And, of course, Twitter, the Corona Labs forums, and the online docs. As much as I know about Corona SDK I always assume there’s someone smarter out there who can tell me about a shortcut (and I’m not usually disappointed).
With everything ready to go I started coding.
The First Roadblock
There were some things I’d poked at in the past, but never really pushed all the way to completion. Such as using Lime to handle drawing the tile-based levels. Yeah, I’d gone through the tutorials, but hadn’t struck off into the weeds on my own.
I also hadn’t used TexturePacker to its fullest extent — I’d been using it at its most basic.
But now here I was trying to get an animated sprite moving on the screen, in a tile-based world run by Lime, and interacting with different physics objects. Within a couple hours I was stuck. Hard. Plus, I had to go to the bank before it closed so while the jam was just gearing up, I was stalled and headed away from my computer for about 3 hours (the bank run turned into more than that, of course).
Settling Down to Serious Coding
Back at my computer for the first evening I switched gears — instead of continuing to bang my head on the problem and hoping it I could beat it into submission, I stopped and used a method that I knew would work. It didn’t do what I needed, but it got me halfway there. And because things were suddenly more simple, I discovered the solution to the problem I’d been having.
Game on!
You know, it is super simple to make a physics object jump when you touch the screen. In fact, here’s the code to do that:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
local physics = require("physics") physics.start() local ground = display.newRect(0,0,display.contentWidth, 10) ground.x = display.contentCenterX ground.y = display.contentHeight-10 physics.addBody(ground, "static", {bounce=0}) local player = display.newRect(0, 0, 50, 70 ) player.x = display.contentCenterX player.y = display.contentHeight - 50 physics.addBody ( player, "dynamic", {density=1, bounce=0}) local function jump() player:applyLinearImpulse(0, -30, player.x, player.y) end Runtime:addEventListener("tap", jump) |
You do that and think, “Yo, I’m a rock star! A platformer is going to be easy-peasy!”
Ummm…
Yes, that is easy, but your guy has to run back and forth, right? Now you’re going to have to figure out which method is going to work best for lateral movements. And what about when he’s jumping and going sideways? Really, the Box2D physics engine inside Corona SDK is awesome and handles a lot of this stuff for you, but it’s not easy-peasy.
More on the code for doing a platformer in an upcoming tutorial.
Time Management in a Game Jam
I’m 50-freaking years old; I have to sleep. So about 5AM I went to bed and slept for 7-8 hours and was back at it. I was about to hit the halfway point and had a decision to make…
Do I keep going or completely switch gears and do a different/simpler game?
I know, crazy to think of starting from scratch, but I knew that I could come up with something fun, but that would be much easier to write. See, I was still having problems with the player action in my platformer. He could jump and run around, but the action was wonky.
However, by that point I’d had enough success that I decided to stay the course. I figured I’d get the rest of the game playable and then if I had time go back and work on the player action.
The rest of that day was spent adding features, testing, and finding more artwork. I’d started thinking about the GUI for the game and ended up spending $9 for a set of GUI artwork. Then found out I really needed something like Illustrator to get all the pieces out of it. Argh! I ended up installing the latest version of Inkscape and was able to export some PNG files that I could chop into pieces later.
Times like that are when you realize how much work could be saved if you had an artist working with you.
By the wee hours of the morning I had a lot of things done and was really tired. I decided to push on through because if I’d gone to sleep at that point and overslept I’d have been sunk. And even if I slept for 5 hours and had 4 hours of work time left before the end of the game name…
…what if I needed 5 hours in order to finish everything?
So I kept working. At that point I knew I wouldn’t get 10 levels completed so went with six. I also added sound effects and background music and a Prefs section so you could turn them on and off. Added some more gameplay elements, a timer, etc. The last few hours were a real scramble.
Hitting the Finish Line
I think I was actually sleep when the game jam officially ended. I’d uploaded my entry about an hour before and then headed for bed. “Idaho Williams: Search for the Elements” was done! Well, as done as it was going to get that day.
The jumping action was still wonky (which I improved after I woke up — too late for the contest), but the game looked good and was playable.
After messing with it again after waking up I remembered a BUNCH of things I’d meant to add but forgot. That’s where making a list during design time would have come in handy. 🙂
For one thing, you can’t die. There’s code in there that looks to see if you fell into a pit, but it does nothing and there are no pits in any of the levels. There are also no “bad guys” or anything else to zap you. But, there is a time limit for each level so it’s not completely stress-free.
There’s a list here now as long as my arm of things I want to add — and I intend to. Idaho Williams is going to be “finished” and put into the App Store at some point. I’m not sure exactly when I’ll finish it, but the GIG Jam gave me a really good start on a game I’d been wanting to do for a long time.
Very cool post… That’s a pretty ambitious project you took on in such short time. I’m sure it was a good learning experience even if it cost you a few hours of sleep. And 3 hours for the bank? I guess you don’t have banks on every corner in Alaska like we have in NY. I hope you get to finish it and get it into the AppStore. Good luck!
looks great!!
can you make a tutorial on how to make a platformer game? 🙂
great post and great page btw
Thanks! I am working on a platformer tutorial, but it’s kind of “on the back burner” right now while I get some other projects done. But it is coming. 🙂
Awesome! Looking forward to it 🙂