Replaced polyfills with real implementations

This commit is contained in:
2023-07-30 18:11:19 +10:00
parent a20cfdd13e
commit ad0539be68
9 changed files with 34 additions and 95 deletions

View File

@@ -23,7 +23,7 @@ var stepAI: int = 0;
var health: int = 2;
var requestFree: bool = false;
//polyfills - animating different cycles on one image
//animating different cycles on one image
var walkAnimationCounter: int = 0;
@@ -52,7 +52,7 @@ fn isRequestingFree(node: opaque) {
if (requestFree) {
var parent = node.getParentNode();
var explosion: opaque = parent.loadChild("scripts:/entities/explosion.toy");
var explosion: opaque = parent.loadChildNode("scripts:/entities/explosion.toy");
explosion.callNodeFn("setGridPosition", gridPositionX, gridPositionY);
return true;
}
@@ -161,22 +161,3 @@ fn faceDirection(node: opaque, dir: int) {
node.setNodeFrames(2);
walkAnimationCounter = 12;
}
//polyfills - move these to standard
fn normalize(x): int {
if (x > 0) {
return 1;
}
if (x < 0) {
return -1;
}
return 0;
}
fn loadChild(parent: opaque, fname: string) {
//TODO: add this to the API proper
var child: opaque = loadNode(fname);
parent.pushNode(child);
return child;
}

View File

@@ -11,7 +11,7 @@ var TILE_PIXEL_HEIGHT: int const = 16;
var gridPositionX: int = null;
var gridPositionY: int = null;
//polyfills - animating different cycles on one image
//animating different cycles on one image
var walkAnimationCounter: int = 0;
var ticksToDeath: int = 4 * 8 - 1;

View File

@@ -26,7 +26,7 @@ var direction: int = null; //BUGFIX: animation not looping properly
var attackPositionX: int = null;
var attackPositionY: int = null;
//polyfills - animating different cycles on one image
//animating different cycles on one image
var walkAnimationCounter: int = 0;
var attackAnimationCounter: int = 0;
@@ -272,14 +272,3 @@ fn faceDirection(node: opaque, dir: int) {
node.setNodeFrames(4);
walkAnimationCounter = 12;
}
//polyfills - move these to standard
fn normalize(x): int {
if (x > 0) {
return 1;
}
if (x < 0) {
return -1;
}
return 0;
}