Reader small image

You're reading from  Gideros Mobile Game Development

Product typeBook
Published inNov 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781849696708
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Arturs Sosins
Arturs Sosins
author image
Arturs Sosins

Arturs Sosins is a developer living with his wife Anna and son Tomass. He has a Master's degree in Computer Science and even though he is working as a developer full time, he still loves coding and shares his knowledge with others in his spare time. In his last years at the university, he started chasing the dream of creating his own mobile games for fun and personal satisfaction in his spare time. After trying out lots of different cross-platform frameworks for mobile game development, he found Gideros SDK in January 2012 and liked it so much that he decided to stick with it when developing his games. In the summer of 2012, he founded a group of like-minded developers/designers who go under the indie label Jenots.com (http://jenots.com/). They released Mashballs (http://jenots.com/mashballs), their first game, in September 2012 and are currently working on a couple of bigger game projects. As there was a lack of learning materials and tutorials for Gideros and writing was one of the his favorite hobbies, he started creating different tutorials on how to accomplish simple things in Gideros. This led him to create his new blog http://appcodingeasy.com. Due to popularity of his tutorials and the support he provided on the Gideros community forum, he became the most active community member. In February 2013, the Gideros team offered him the position in the Gideros developers' team, where he has been working since then, while continuing to work on games in his spare time.
Read more about Arturs Sosins

Right arrow

Chapter 3. Implementing Game Logic

We have set up our Gideros project just the way we need, using all the needed features from automatic scaling and proper logical dimensions to setting up the scene manager and creating couple of simple scenes.

Now is the time to jump into a little more complicated logic where we will manage multiple levels and packs of our game, as well as implement the game logic itself.

These are the topics we'll be covering in this chapter:

  • Creating the scene for the main game logic

  • Learning to use physics in Gideros

  • Using Gideros OOP to manage different kinds of game objects

  • Manipulating multiple levels and level definitions

  • Creating scenes for choosing packs/modes and levels

  • Managing game progression by unlocking new levels

Implementing the main game scene


The main game scene is where all the action will be happening. This is the place where we will have objects bouncing and hitting each other just like in the Mashballs game.

Usually, when you have an idea about the game, you don't think about the number of levels, packs, scores, and so on. You think about main gameplay and you act similarly with game development. You should jump straight to the main gameplay and create a minimum viable prototype to understand:

  • Is it possible to implement it as you've imagined?

  • Is the game playable at all?

  • Is it attractive, fun, and something you will play yourself?

Otherwise you would have spent a huge amount of time, just to understand that the gameplay you imagined is not very usable.

That is why we will also start implementing the main game logic first.

In the start scene of the previous chapter, we created a Start Game button, which should lead to level scene. Let's now create this scene as we did before. First create a LevelScene...

Managing packs and levels


Now that we have finished the prototype of our game and see that it works, let's implement the pack and level logic, as well as player progression between levels.

This is the part where you take your game out of prototype state and gamify it with more engagement loops and sense of progression, and make it into something you could show to others. I usually start to bother my friends with trying the new game after implementing the simple tutorial level pack.

Defining packs

First let's create a simple file, where we would define our packs and the number of levels in them. So head to your Gideros Studio and add a packs.lua file to your project. Inside it we will define a simple packs table which would contain subtables, representing each pack with name of the pack, and the number of levels in it.

packs = {
  {
    name = "First pack",
    levels = 15
  },
  {
    name = "Second pack",
    levels = 15
  },
}

Now based on this definition, we can create a scene, where we can...

Summary


Now we have implemented our main game logic and we can define multiple packs and levels, as also create, read, and interpret level definitions and create different game objects as separate Gideros classes. Additionally, we can manage unlocking levels upon completion of the previous level.

In the next chapter, we will make our game more advanced and polished by adding animations and sound effects, and also by changing how we interact with the game and its controls, and making the game more engaging by adding scores.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Gideros Mobile Game Development
Published in: Nov 2013Publisher: PacktISBN-13: 9781849696708
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Arturs Sosins

Arturs Sosins is a developer living with his wife Anna and son Tomass. He has a Master's degree in Computer Science and even though he is working as a developer full time, he still loves coding and shares his knowledge with others in his spare time. In his last years at the university, he started chasing the dream of creating his own mobile games for fun and personal satisfaction in his spare time. After trying out lots of different cross-platform frameworks for mobile game development, he found Gideros SDK in January 2012 and liked it so much that he decided to stick with it when developing his games. In the summer of 2012, he founded a group of like-minded developers/designers who go under the indie label Jenots.com (http://jenots.com/). They released Mashballs (http://jenots.com/mashballs), their first game, in September 2012 and are currently working on a couple of bigger game projects. As there was a lack of learning materials and tutorials for Gideros and writing was one of the his favorite hobbies, he started creating different tutorials on how to accomplish simple things in Gideros. This led him to create his new blog http://appcodingeasy.com. Due to popularity of his tutorials and the support he provided on the Gideros community forum, he became the most active community member. In February 2013, the Gideros team offered him the position in the Gideros developers' team, where he has been working since then, while continuing to work on games in his spare time.
Read more about Arturs Sosins