Book Image

LiveCode Mobile Development Cookbook

By : Dr. Edward Lavieri
Book Image

LiveCode Mobile Development Cookbook

By: Dr. Edward Lavieri

Overview of this book

Table of Contents (17 chapters)
LiveCode Mobile Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using collision listeners


A collision listener is a type of physics software that detects the collisions between two objects. In this recipe, you will create two graphics and listen for collisions between them. Detecting collisions (we do this by "listening" for them) in a mobile app can be very useful when developing games and simulations. As a game example, your hero shoots an arrow at an enemy; we want to know whether the arrow collided with the enemy's armor or body.

Getting ready

Before using this recipe, you will need to have the Animation Engine external downloaded and available on your development computer. See the Setting up Animation Engine recipe discussed earlier in this chapter.

How to do it...

Follow the steps in this recipe to create two objects and add the necessary script to detect collisions between them:

  1. Open LiveCode.

  2. Create a new main stack.

  3. Open the animationEngine stack. With LiveCode already running, you can simply double-click on the animationEngine.livecode file.

  4. Once you...