1.0.1 • Published 4 years ago
xray-game-engine v1.0.1
Xray Game Engine
Installation
npm install xray-game-engine
Game
const { Engine } = require("engine");
var game = new Engine(
[...modules, Game],
properties
);
game.run();
Properties
Window
properties.window = {
title: "Raylib Game Engine",
size: {
width: 960,
height: 540
},
fullscreen: false,
resizable: false,
decorated: true,
transparent: false,
targetFPS: 60
};
Debugger
properties.debugger = {
showFPS: false
};
Modules
In xray everything is a module, even the games code.
Built-In Modules
- EventSystemModule
- Scene2D
Custom Modules
const { colors } = require("engine");
class Game {
init() {
this.enemy = {
position: {
x: 10,
y: 10
},
size: 20
};
}
onUpdate() {
this.enemy.position.x += 6 * this.deltaTime;
this.enemy.position.y += 6 *this.deltaTime;
}
on2dDraw() {
this.raylib.DrawRectangle(
this.enemy.position.x - this.enemy.size / 2,
this.enemy.position.y - this.enemy.size / 2,
this.enemy.size,
this.enemy.size,
colors.red
);
}
}