Game Development Reference
In-Depth Information
3. Click on the choose sound from library icon and select the pop sound.
4. Click on OK to add it to the available sounds for the project.
5. In the stage sprite script, after emptying the lists, set funds value to 40 by using the
set < funds> to block. This will be the staring amount of credits.
6. Go the the irst plaform's Scripts tab. We will make some addiions to the script.
7. Get an if … else … block.
8. Get a > operator for the condiion slot.
9. Place the funds variable on the left of the > operator.
10. Type in 19 on the right of the > operator. We will make the price of cannons 20
credits, so you need to have at least that amount in your funds.
11. Inside if , add a change <funds> by - 20 block.
12. Also drag the clone block inside the if block.
13. Inside the else block, place a play sound <pop> block. When there aren't
enough funds to create a cannon, this will make a sound to let the player
know about it.
14. Copy the whole script to the second plaform.
15. Click on Delete to delete the original script from the second plaform.
A plaform script should look like the following screenshot:
The player can now spend funds. Next, let's create a way to gain funds so the player can
keep building as the game progresses. The following are the steps given to do it:
1. Click on the red enemy.
2. In the enemy clone script that checks for cannonball hits, add a change <funds> by 2
block just before the clone is destroyed.
3. Do the same for the blue and the yellow enemy but with different values. Killing a blue
enemy will reward 3 credits. Killing a yellow one will give the player 4 credits.
Search WWH ::

Custom Search