A Simple Library For Game Making With Webdevelopment
npm install linterforge
js
const box = new createSquare(100, 100, 50, 50, "red");
box.render();
box.moveX(20);
`
$3
`js
const player = new Sprite(200, 200, 64, 64, "player.png");
player.render();
`
Player Movement (WASD)
`js
const controls = enableWASD(player, 3);
// Disable movement
controls.setMovementEnabled(false);
`
Supports collision with solid tiles when provided.
Collision Detection
$3
`js
if (isColliding(a, b)) {
console.log("Collision!");
}
`
$3
`js
onCollide("table", (table) => {
//this code runs when the Collision is called and returns true
});
`
You can check Collisions with
`js
checkCollisions(table, player)
// this will run the onCollide code
`
Level System
`js
const level = [
"####",
"#..#",
"####"
];
const tileMap = {
"#": {
width: 32,
height: 32,
sprite: "wall.png",
id: "wall",
area: true
}
};
const { sprites, solidTiles } = addLevel(level, tileMap);
`
Scenes & Events
`js
scene("menu", () => {
console.log("Menu scene");
});
scene("game", () => {
console.log("Game scene");
});
go("game");
`
Automatically clears the DOM and event listeners when switching scenes.
Screen Shake
`js
screenShake(10, 300); //screenShake(intensity, duration)
`
Utilities
$3
`js
await wait(1000);
console.log("1 second later");
`
Notes
* Uses DOM elements, not