Added sorting layers to nodes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user