Corona SDK: Display Object Rotation

We already have the platforms in Rolly Bear World and we can move them around. In this post we extend our code base so that the user can rotate them. In case you missed the post about making display objects in Corona SDK drag and moveable on the screen, click here.

Watch the movie of the implementation.

Continue reading

Going Object-Oriented with Corona SDK and Rolly Bear World

I have been working on Rolly Bear World now for almost two months and some of my lua files are getting very crowded with code blocks and repetition of similar code patterns. In this post, we will not add any additional functionality to Rolly Bear World; but we will be restructuring some of the code and creating some Object-Oriented patterns.

Start with creating a new lua file in your project and call it fixedScene.lua. In this lua file we will add all the static scene objects of the levels: the invisible walls, the 2 bushes, the background bush, the floor, the two wooden signs, the chest, and the rock. In fixedScene.lua create a function called createStaticBackgroundElements and copy/ paste all the static elements in this function. Next create a global group variable called: myStaticgroup = display.newGroup. We need to insert each background element in this group. So we can handle the removal of these objects between scenes later via our Storyboard implementation.

Continue reading

PhysicsEditor and Corona SDK

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

Continue reading