1. As always, inside the
game
class, create a new method calledCreateComets
. Its parameter will be the amount of comets that have to be created.Method SpawnComets:Int (ccount:Int)
2. Add a FOR loop from
1
to the amount of comets you want to create.For Local i:Int = 1 To ccount
3. Call up the method CreateComet with the size set to
large
, and random values for position, angle, and speed.obj = CreateComet(cmLarge,Rnd(64,eng.canvasWidth-64),Rnd(64,eng.canvasHeight-64),Rnd(1,4)/2,Rnd(0,359))/
4. Close the FOR loop, and the method.
Next Return 0 End
To actually spawn comets, you have created a method that will do this randomly over the canvas area. You just tell how many comets you need and it will spawn them.