Calculating the distance between two points
In this recipe, you will create two graphics using LiveCode and Animation Engine. You will also create a button that animates the graphics. Finally, you will create a button that calculates the distance between the two graphics. Being able to calculate the distance between two objects can come in handy for game and simulation applications.
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 calculate the distance between two points:
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 complete the previous steps, you will see the animationEngine window with a Use me! checkbox (see the following screenshot). Check...