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:
Open LiveCode.
Create a new main stack.
Open the
animationEngine
stack. With LiveCode already running, you can simply double-click on theanimationEngine.livecode
file.Once you...