In the last post I provided the explanation of Level 1 -5 of Rolly Bear World, in this consecutive post I will do the same for Level 6 -8. I will only explain the key changes to the code. In case you missed some of the core functionalities build in Rolly Bear World, make sure you visit this page with all available tutorials.
If you are looking to increase your knowledge on Corona/ Lua development, I can highly recommend this resource, it was ground breaking for me personally to learn the Corona Framework.
Level six is not much different from level 3 with the exception that this time the spring is fixed in the gameplay and not an available platform for the user to change. Just look at the code of level 6 and you will see we use the exact same concepts for creating the animated spring object only now as a fixed object.
This is a short update on our Rolly Bear World project. I’m starting to create all the different levels for Rolly Bear World, and realized that some of the code will be reused across all levels. To avoid bugs in future changes I decided to make some of the code and functions available on a global level so that all separate level files can reuse these functions. I created a separate lua file called platformListeners.lua, which contain the listener functions for the platforms in the game. These are:
- movePlatform (the function to drag the platform around the screen)
- rotatePlatform (the function to rotate the platform on the screen).
In each level file we need to require this newly created .lua file, so that each individual lua level file can actually access these functions.
So make sure, in case you’re making this change as well to include in the level01.lua, level02.lua files:
local platformlisteners = require ("platformListeners")
The code listed below has been removed from level01.lua and added to the new .lua file called platformListeners.lua, I also made some additional changes which I explain below.
In my previous post I introduced TexturePacker to handle a lot of images in a simple way to improve i.e. game performance, the developer of TexturePacker created another program called PhysicsEditor. With PhysicsEditor you can easily trace your display objects so when the object bounce with other objects in your game it looks like the object has the real shape and not some bounding box around it. Often images have a transparent background which determines the real “image”, but when two display objects collide we want to images to collide as there shapes and not a collision of the larger transparent backgrounds. Well, this can be solved with the tracing tool of PhysicsEditor. Besides the tracing, another great thing about PhysicsEditor is that you can set your properties of each individual display object.
In case you’re new to PhysicsEditor, you can download the program here: http://www.codeandweb.com/physicseditor
In the last couple of days I have tried to create some kind of template for level selection for games build with Corona SDK. This template is a level selection which you often see in mobile games. The user can select a level based on a grid outline and based on the status of the level the grid changes (open, locked or completed).
In the video below you can see what the template is.
If you have been reading and coding along, you would now have a start screen and a game background with a start time counter from 3 till 0. In Part 3, and final part, we will program the actual gameplay of the little game. In case you missed Part 1 or 2, please navigate to these tutorials if you like:
In the previous post we created the title screen. In this post we will create the game. In case you missed the previous tutorial:
Part 1: Corona SDK: A Simple Race game.
In case your look for the complete source code, please scroll down in Part 1.
In this tutorial I show you how you can implement a Sprite animation in your game developed with Corona SDK. To make it a bit more fun, I have in total 2 Sprites which interact with each other. In this example I have used Ryu, a character from the game Street Fighter, who on a tap kicks a stag of crates down. Yeah!
So what will we code in this Corona SDK tutorial?
- 2 Sprites: one for Ryu and one for the crates
- Set the sheetData for the sprites
- Make some functions with timer.performWithDelay.