10 October 2014
From the Forum — Issue #41
Welcome to the latest installment of From the Forum. In this series, guest blogger Alex Jackson highlights outstanding threads from the Corona Forum. The goal is to bring attention to the most captivating, interesting, and thought-provoking discussions taking place in our very own backyard.
Please visit the forum to join these conversations or start your own!
1. Detecting collisions on different parts of an image
In this wild game of development, we want to excel, but learn new things at the same time. Corona is a great platform, which encourages furthering your knowledge while simultaneously building apps and games. One great lesson to learn, specifically for game development, is getting a firm understanding of the collision API.
Corona, with physics based on the Box2d model, has a robust collision system which allows you to detect several different phases of a collision between two bodies. When we are talking about a “complex”, or multi-element body, the complexity is multiplied, instead of being exponential in difficulty. So when you have your game idea, and you have a character with a body, a shield and a sword, Corona makes it easy to identify where and when the collision took place.
If you’re on your way to a really cool game but want to get collisions sorted first, have a read over the below forum post. Have a suggestion or a question? Feel free to add it in!
2. Big animations? Consider your options
I’m a sucker for really fluid animations. It doesn’t have to be high-resolution; I like pixel-art Link swatting chickens as much as I like Commander Shepard holstering. A smooth animation can provide texture and that little something extra that your app was missing before.
However, trying to create our own animations can be daunting. Should I use a spritesheet? Would it be better to animate through separate images? Should I roll my own method? There are lots of things to consider. There is a conversation taking place in the forum that focuses on this exact question. It’s always useful to get another pair of eyes on a problem, and the Corona community has responded!
Quite a few devs are providing their own insights and solutions to the question in the below forum post, so head over and see what they are suggesting. If you have your own way of doing things, we’d sure like to hear about it!
3. New to game development? Here’s some collision pointers!
We’re continuing with our theme of game development here with another interesting conversation about collisions and resulting sprite animations in a 2D platformer. The quandary faced here is: what is the best method to go about having a character “go through” a physical platform, but also fall off the left or right sides of the platform, and have the correct animation play?
A somewhat hard-to-explain problem, with a relatively simple solution. Using a pre-collision listener and some deductive math on the bottom of our character and the platform in question, you can easily identify whether or not the character should go through the platform.
Check out the original thread for the code snippet provided for this logic to function. Have your own solution, or seeing a better way of handling the problem? Let us know!
Alex Jackson is an indie developer and the founder of Panc Software, specializing in retro-style gaming. He has created several mobile applications, enjoys long walks on the beach, pixel art, and reading the Corona forums. Contact him by email or follow him on Twitter: @pancsoftware. Check out his new game Crosstown Smash on iOS, Android, and Amazon devices!