Reader small image

You're reading from  Corona SDK Mobile Game Development: Beginner's Guide

Product typeBook
Published inMar 2015
Publisher
ISBN-139781783559343
Edition1st Edition
Tools
Right arrow
Author (1)
Michelle M Fernandez
Michelle M Fernandez
Right arrow

Understanding the Corona physics API


Corona has made it convenient to add physics to your games, especially if you've never worked on one before. The engine uses Box2D and takes only a few lines to incorporate it into your application than what it normally takes to have it set up.

Working with the physics engine in Corona is fairly easy. You use display objects and set them as a physical body in your code. Images, sprites, and vector shapes can be turned into a physical object. This is substantial in visualizing how you want your objects to react in an environment you have created. You can see results right away rather than guessing about how they might act in the physical world.

Setting up the physics world

Making the physics engine available in your app requires the following line:

local physics = require "physics"

Starting, pausing, and stopping the physics engine

There are three main functions that affect the physics simulation. The following will start, pause, and stop the physics engine...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Corona SDK Mobile Game Development: Beginner's Guide
Published in: Mar 2015Publisher: ISBN-13: 9781783559343

Author (1)