Added sorting layers to nodes

This commit is contained in:
2023-06-29 13:47:35 +10:00
parent 51a0c94ba2
commit 2d6ad5efcc
10 changed files with 39 additions and 44 deletions

View File

@@ -15,12 +15,12 @@ fn onLoad(node: opaque) {
fn onInit(node: opaque) {
print "onInit() called";
node.loadNodeTexture("sprites:/little_plane.png");
node.loadNodeTexture("airport:/little_plane.png");
}
fn onStep(node: opaque) {
//TODO: move
}
// fn onStep(node: opaque) {
// //
// }
fn onFree(node: opaque) {
print "onFree() called";
@@ -30,18 +30,8 @@ fn onFree(node: opaque) {
fn onDraw(node: opaque) {
// print "onDraw() called";
var parent: opaque = node.getParentNode();
var px = 0;
var py = 0;
//TODO: get world position
if (parent != null) {
px = parent.getNodePositionX();
py = parent.getNodePositionY();
}
node.drawNode(node.getNodePositionX() + px, node.getNodePositionY() + py, WIDTH, HEIGHT);
node.drawNode(node.getNodeWorldPositionX(), node.getNodeWorldPositionY(), WIDTH, HEIGHT);
}
//event functions

View File

@@ -28,14 +28,11 @@
mapInputEventToKeyDown("character_attack", "space"); //event, keysym
//TODO: escape to kill the game
//this function must always be called, or the engine won't run
initWindow("Airport", 800, 600, false); //TODO: custom FPS setting
initWindow("Airport", 800, 600, false);
//kick off the logic of the scene graph
loadRootNode("scripts:/airplane.toy");
loadRootNode("airport:/airplane.toy");
}
//Globals go here