Game Development Reference
4. In the I]ej[Lh]ucnkqj`*]o file, add the following code in bold to the kjAjpanBn]ia event
5. Save the I]ej[Lh]ucnkqj`*]o file and test the project.
6. You'll see the words No collision displayed in the dynamic text field.
Use the arrow keys to move the lh]uan object into the ajaiu object,
and the text field will display Ouch!! Figure 7-5 shows what this
Not bad for a few simple lines of code, huh? If you move the lh]uan object
away from the ajaiu, the text field displays No collision again. (You'll find
the complete code for this example in the chapter's source files in I]ej[
It gets even better.
Figure 7-5. The text changes
when the two objects touch.
Triggering a change of state
You can put any directives you like inside the eb statement that checks for a collision. In this example,
you'll use a ckpk=j`Opkl method to change the state of the ajaiu object.
You might recall from Chapter 3 that you can give Movie Clip objects new states by changing some-
thing about how they look on another frame. The first thing you need to do is modify the enemy
Movie Clip symbol. Mine is called Ksh, but yours might be called something else.
1. Double-click the ajaiu object in the Library to enter symbol editing mode.
2. Add frames or keyframes wherever necessary to extend the graphics from frame 1 into frame 2.