Game Development Reference
Creating objects that block movement
You can use the same technique of reversing an object's velocity to create an object that blocks the
movement of other objects. Here's how:
1. Create a new symbol called S]hh.
2. In the S]hh symbol's editing window, use Flash's drawing tools to design a 50-by-50 pixel
square stone block.
3. Drag an instance of the S]hh symbol onto the main stage and give it the instance name wall .
The stage in my ejpan]_peraLh]ucnkqj`*bh] file now looks like Figure 7-34.
Figure 7-34. Add a wall object to the scene.
4. Add the following code in bold text to the bottom of the kjAjpanBn]ia event handler. (The
complete code is in the I]ej[Lh]ucnkqj`[4*]o file in the chapter's source files.)