Game Development Reference
At this point, cannons can be placed anywhere, including on the road. This can make the
game too easy and it also looks a bit messy. Let's limit where you can place cannons. We will
build a few gun plaforms and place them within in the level. Cannons can only be built on
these plaforms, so the player has to start thinking about the cannon's range and opimal
placement. It also prevents the player from puing cannons in the middle of the road.
Follow these steps to create a plaform:
1. Click on the paintbrush icon to create a new sprite.
2. Select the Rectangle tool and choose a medium gray color.
3. Draw a verical rectangle.
4. Check the shape as it appears on the stage to determine the right size.
5. Pick a lighter color of gray and fill the rectangle with the Fill tool.
You can imagine this to be a raised concrete plaform when looked at from the top. You can
embellish the graphic if you wish, but it won't be necessary for the game. Remember to keep
your drawings clear so the player can easily understand what the drawing represents.
Rewriing the placement script is fairly simple. We will relocate the script that we already
wrote from the cannon sprite to the plaform sprite as shown in the following steps:
1. View the cannon's Scripts tab.
2. Drag the enire when this sprite is clicked script to the plaform in the Sprites view.
3. Click on the plaform sprite to see its scripts. You will ind a copy of the
when this sprite is clicked script there. If not, you have probably misplaced the
script. Try again in this case.
4. Make sure that the script creates a clone of <cannon> and not of <myself> . We
don't want the plaforms to start copying themselves. Correct this if needed.
5. After you have copied and edited the script, delete the original script in the
cannon by right-clicking on it and selecing delete .
6. Next, right-click on the plaform sprite in the Sprites view and select duplicate to
create a second plaform.