Added animations to node

This commit is contained in:
2023-02-27 09:28:21 +11:00
parent 572b809d1b
commit 2c16c10558
11 changed files with 366 additions and 115 deletions

22
assets/scripts/frames.toy Normal file
View File

@@ -0,0 +1,22 @@
import node;
fn onInit(node: opaque) {
node.loadTexture("sprites:/frametest.png");
//mapped to the given image
node.setNodeRect(0, 0, 32, 32);
node.setNodeFrames(3);
}
var counter = 0;
fn onStep(node: opaque) {
counter++;
if (counter >= 60) {
counter = 0;
node.incrementCurrentNodeFrame();
}
}
fn onDraw(node: opaque) {
node.drawNode(0, 0);
}