Files
VampireToyvivors/assets/main.toy
T
Ratstail91 eb8115aa7e Each actor has an 'onStep' function, if set
Replaced the global 'onStep' with 'onFrame', otherwise it works the
same.
2026-05-13 17:55:35 +10:00

36 lines
717 B
Plaintext

var counter = 0;
var randi: Int = 69420;
fn rand() {
return randi = randi * 1664525 + 1013904223; //can be negative
}
fn wander(actor: Opaque) {
actor.setX(actor.x + rand() % 5);
actor.setY(actor.y + rand() % 5);
counter++;
}
//when the game is ready, load the "zombie" sprite
fn onReady() {
loadSprite("zombie", "assets/parvati.png", 32, 32);
//spawn some "zombies" looking for brains
spawnActorAt("zombie", wander, 250, 250);
spawnActorAt("zombie", wander, 250, 500);
spawnActorAt("zombie", wander, 500, 250);
spawnActorAt("zombie", wander, 500, 500);
}
fn onFrame() {
//debug
print counter;
}
//example API for the game
initScreen(1280, 720, "Oh no, Zombies!");
initLoop(onReady, null, null);