While I’ve used Unity (which you’ve heard of) to create and publish 2D games, what I turn to first is a game framework that you’ve probably never heard of — Solar2D. It’s been around for about a decade, although the first nine years it was known as Corona SDK — which you’ve probably also never heard of.
Solar2D is a cross-platform framework for quickly making apps and games for mobile devices, desktop, TV, and HTML5. Create your project once and publish it to iPad, Android smartphones, Kindle Fire, Windows desktop, etc.
Solar2D has one big difference than the more well-known game engines such as Unity, Godot, or GameMaker — it’s not just code first, it’s code only. In other words, there is no graphical interface.
Let me tell you why that doesn’t suck.
If you’re at least a little familiar with programming — you know what a variable is, you know what functions are — then you can have a sprite moving around the screen in minutes. Seriously. But with every one of those other tools I mentioned, you’re going to have a learning curve that’s like a cliff. It will take you hours or even days before you’re familiar with the interface and figure out how to get things going.
Examples, Please!
Create a file called main.lua and type this into it:
1 2 3 |
local player = display.newImage("froggy.png") player.x = 100 player.y = 150 |
Assuming you have an image file named froggy.png in the same folder as that main.lua file, when you open main.lua file with the Solar2D simulator, that line of code will create a frog character at the X/Y location 100/150.
Want to make it move across the screen? Put this underneath that line:
1 |
transition.to(player, {time=1500, x=450}) |
That moves (transitions) the player object to the X coordinate of 450 over the course of 1500 milliseconds (or 1 and a half seconds for normal people).
No, it’s not a game, but in two lines of code you put a cute character on the screen and moved it!
Of course your game will be more complicated than that, but when the basics are that simple, it makes working on an entire game easier than most other game engines/frameworks.
Behind the Scenes
The language used by Solar2D is Lua. I’d never even heard of it when I discovered Solar2D, but if you know any programming language at all, it will be easy for you to pick up. You can get comfortable with it while you’re making your game. (It has many similarities to Javascript, although I like Lua a LOT more than I like JS.)
Here’s the official page for Solar2D (oh yeah, it’s free and open source under the MIT license):
Here’s where you can grab the simulator that allows you to test your game without copying it to a mobile device:
https://github.com/coronalabs/corona/releases
And here’s a link to the official documentation site:
Download Solar2D (Windows, Mac, and Linux is available) and see how quick and easy 2D game development can be!