Fixed global bug

This commit is contained in:
2023-07-05 01:31:09 +10:00
parent 8476935208
commit 77cd869ffc
4 changed files with 51 additions and 72 deletions

View File

@@ -4,8 +4,8 @@ import node;
//lifecycle functions
fn onLoad(node: opaque) {
node.setNodeScaleX(CAMERA_SCALE_X);
node.setNodeScaleY(CAMERA_SCALE_Y);
// node.setNodeScaleX(CAMERA_SCALE_X);
// node.setNodeScaleY(CAMERA_SCALE_Y);
}
fn onDraw(node: opaque) {
@@ -20,8 +20,8 @@ fn onDraw(node: opaque) {
var height: int const = node.getNodeRectH();
node.drawNode(
floor(posX * scaleX) + globalCameraX,
floor(posY * scaleY) + globalCameraY,
floor(posX * scaleX),
floor(posY * scaleY),
floor(width * scaleX),
floor(height * scaleY)
);

View File

@@ -2,6 +2,24 @@ import standard;
import engine;
import node;
//constants for generating maps
var TILE_PIXEL_WIDTH: int const = 16;
var TILE_PIXEL_HEIGHT: int const = 16;
var ROOM_MIN_WIDTH: int const = 4; //minimum safe value 4
var ROOM_MIN_HEIGHT: int const = 4;
var ROOM_MAX_WIDTH: int const = 12;
var ROOM_MAX_HEIGHT: int const = 12;
var CELL_WIDTH: int const = 16; //minimum safe value ROOM_MAX_* + 4
var CELL_HEIGHT: int const = 16;
var CELL_COUNT_X: int const = 3;
var CELL_COUNT_Y: int const = 3;
var tilemap: [int] = null;
//lifecycle functions