39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
//the overarching scene
|
|
import node;
|
|
|
|
|
|
//util to generate and init a child node of a given parent
|
|
fn makeChild(parent: opaque, fname: string) {
|
|
var child: opaque = loadNode(fname);
|
|
parent.pushNode(child);
|
|
child.initNode();
|
|
return child;
|
|
}
|
|
|
|
|
|
fn onInit(node: opaque) {
|
|
//load the tile map node
|
|
var tilemapNode = node.makeChild("scripts:/tilemap/tilemap.toy");
|
|
|
|
tilemapNode.callNodeFn("loadLayer", "layer-background.toy");
|
|
tilemapNode.callNodeFn("loadLayer", "layer-walls.toy");
|
|
tilemapNode.callNodeFn("loadLayer", "layer-walls.toy");
|
|
//tilemapNode.callNodeFn("loadLayer", "layer-walls.toy"); //TODO: remove this
|
|
//tilemapNode.callNodeFn("loadLayer", "layer-maze.toy");
|
|
}
|
|
|
|
|
|
//global accessors
|
|
fn getTileWidth(node: opaque): int { return 64; }
|
|
fn getTileHeight(node: opaque): int { return 64; }
|
|
|
|
fn getRoomWidth(node: opaque): int { return 10; }
|
|
fn getRoomHeight(node: opaque): int { return 10; }
|
|
|
|
fn getLevelXCount(node: opaque): int { return 9; }
|
|
fn getLevelYCount(node: opaque): int { return 9; }
|
|
|
|
//TODO: move this into the engine
|
|
fn getScreenWidth(node: opaque): int { return 1080; }
|
|
fn getScreenHeight(node: opaque): int { return 720; }
|