Monster spawning is controlled from the scripts
This commit is contained in:
+22
-1
@@ -2,4 +2,25 @@ var screenWidth = 1280;
|
||||
var screenHeight = 720;
|
||||
var screenCaption = "Hello raylib from Toy!";
|
||||
|
||||
//TODO: load monsters on a timer?
|
||||
var frameCounter: Int = 0;
|
||||
var posCounter: Int = 0;
|
||||
|
||||
//this runs before the game starts
|
||||
fn onReady() {
|
||||
loadMonsterSprite("parvati", "assets/parvati.png", 32, 32);
|
||||
}
|
||||
|
||||
//this runs each frame
|
||||
fn onStep() {
|
||||
frameCounter++;
|
||||
|
||||
if (frameCounter % 100 == 0) {
|
||||
spawnMonsterAt("parvati", posCounter*50, posCounter*50);
|
||||
posCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
//this runs as the game is closing down
|
||||
fn onFinished() {
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user