36 lines
555 B
Plaintext
36 lines
555 B
Plaintext
//"global" variables
|
|
var frameCounter: Int = 0;
|
|
var posCounter: Int = 0;
|
|
|
|
fn onReady() {
|
|
loadSprite("zombie", "assets/parvati.png", 32, 32);
|
|
}
|
|
|
|
fn onStep() {
|
|
frameCounter++;
|
|
|
|
// if (frameCounter % 10 == 0) {
|
|
spawnActorAt("zombie", posCounter*5, posCounter*5);
|
|
posCounter++;
|
|
// }
|
|
|
|
if (posCounter > 150) {
|
|
posCounter = 0;
|
|
}
|
|
}
|
|
|
|
fn onClose() {
|
|
//
|
|
}
|
|
|
|
//example API for the game
|
|
initScreen(1280, 720, "Hello raylib from Toy!");
|
|
initLoop(onReady, onStep, onClose);
|
|
|
|
//test
|
|
fn brains(actor: Opaque) {
|
|
actor.setX(actor.x + 1);
|
|
}
|
|
|
|
setActorStep(brains);
|