
上QQ阅读APP看书,第一时间看更新
Time for action — spawning some cities in the game
To spawn some cities, follow the ensuing steps:
- Open the
mainClass.monkey
file, if you haven't done so already. - Inside the
SetupGame
method, to create three cities, we will use a FOR loop.score = 0 'Create 3 cities For Local i:Int = 1 To 3
- Call the
CreateCity
function. Thex
position will be at one-fourth of the canvas width. After that, close the FOR loop.CreateCity((cWidth/4) * i) Next
What just happened?
We told our script to create three cities once the game starts.