The Mumu Guide to 2D Video Game Design (1)

Darmie Akinlaja
3 min readNov 27, 2012

--

Hello there! You must have been wondering how games were developed or you have been searching out the internet about how you can get started making your own Video game.

Well in this blog series, I’ll be taking you through 2D video games design with LÖve, LÖve is an awesome framework that harnesses the lua scripting language for the development of 2D games, you can download it at http://love2d.org.

First things first:

  • Recall your basic maths (arithmetic)
  • Lua programming is easy, don’t panic
  • Just love what you are doing!

If you have downloaded and installed LÖve, let’s roll! LÖve have three basic components, love.load(), love.draw() and love.update(), they are the three basic functions you will use mostly in your codes.

  1. love.load() — This function loads all the stuff we need to build our game (Think of it like the stage where you need to get all the materials you need to build your house)
  2. love.update(dt) — This is where you will apply the simple arithmetic jargon you’ve gathered all the while you were in primary school. dt is called delta-time, it is the amount of time it will take your PC (hopefully not a snail-PC) to render a frame (of maybe animation or event).
  3. love.draw() — The function you’ll use to draw whatever 2D graphics on the screen (…like you didn’t spot the obvious ( -_-) )

You see let’s stop this story and do some test stuff already.

Open your favorite text editor (Mine is Notepad++), create a new file called main.lua, and save it in a folder. In main.lua write out these three functions:

Just follow that order jejely

Next we’ll do the usual “Hello World!” the Naija way, so let’s make a game yo!

Edit main.lua and write the following:

Let me explain what we just did, we used the love.graphics module. It simply draws lines, shapes, texts, images and other drawable stuff on the screen. So we loaded our font size love.graphics.newFont(45), set our font color love.graphics.setColor(R, G, B) and set our background color love.graphics.setBackgroundColor(R, G, B) in the love.load function. Then we draw the text we want to display with the love.graphics.print(‘text’, x-position, y-position) function. Pretty neat unh?! Well… I hope so!

So let’s Run our game

To run a love game, compress your project folder into a zip file (in the top-level directory), change the .zip extension to .love, now right-click on it and select “Open in Love” , if you didn’t see this image, read this whole post again.

Now, we are getting there! This is all for today, I’ll cover how to draw 2D objects, animations, character movements in the next episode. Stay Tuned!!!

Originally published at codejitsu.wordpress.com on November 27, 2012.

--

--