Best Practices in Corona SDK

Hi,

Some time ago I’ve posted a few tips & tricks when dealing with Corona SDK, and finally I got my hands on posting another portion of useful things in there! Below you can read about code style, saving persistent data, and getting community help.

Code style and work environment

  • Keep all in module manageable functions
  • Use camel-case style for functions and variables
  • Keep in mind 200 max variables limit per module
  • Always add one blank line to separate nested blocks, for example before the if block above (more than one line is unnecessary)
  • Keep game settings as a separate class, so it’s not mixed with screen’s lifecycles
  • Sublime 3 Beta is recommended for the development and for Sublime Corona plugin

Further info

Best Practices for Organizing Projects

Tutorial: The value of well-formatted code

Tutorial: Scope for beginners

Continue reading Best Practices in Corona SDK

Like and share:

Tips and Tricks in Corona SDK

Hello,

Today I’m gonna share a few things which I have learned while working with Corona SDK. Those are things I wish somebody told me at the very beginning of my journey with Corona, so hopefully you find them useful as well 😉

Anchor Points

Anchor points are the properties which allow you to change the alignment of the object within its own bounding box. As difficult as it may sound, we’re just changing a gravity of some control (it can’t be a group, as groups don’t respect anchor points).

Whenever you see setReferencePoint, xReference, or yReference in some tutorial, just know – they are deprecated. There are now anchorX and anchorY isntead, and they’re default values are 0.5, which can be changed with the call like:

display.setDefault("anchorX", 0)

Further info

Transforms and Anchors

Anchor Points in Graphics 2.0

Continue reading Tips and Tricks in Corona SDK

Like and share:

Tutorial: Scrolling background in Corona SDK

Hello!

Today I’m gonna talk about a scrolling background in Corona SDK. I’m sure you’ve seen this effect in many games and most likely the time has come to implement it in your own one. So, how is this being done?

The first question that might be asked is How many images do I need? The answer is – as many as you wish. I’ve chosen 1, because it’s super easy and fast – there is exactly one graphics and it’s enough.

The second question is In which direction it should scroll? It can be any direction, really, but this tutorial focuses on a vertical top > bottom scrolling. It’s like we’ve been flying higher and higher in sky.
Continue reading Tutorial: Scrolling background in Corona SDK

Like and share: