0.1.6 • Published 3 years ago
smallyjs v0.1.6
SmallyJS
smallyjs is a javascript library that creates a small HTML5 game easily.
Status
This project is under development. Don't use it on the production.
Installation
- CDN
<script src="https://cdn.jsdelivr.net/npm/smallyjs@0.1.5/dist/smallyjs.min.js"></script>
- npm
npm install smallyjs
Hello World
<script src="https://cdn.jsdelivr.net/npm/smallyjs@0.1.5/dist/smallyjs.min.js"></script>
<script>
// Create new game
const game = Smally.Game({
title: "Hello World",
bg: "#efefef",
});
// Create new scene
const mainScene = Smally.Scene();
// Title text
const centerPos = {
x: mainScene.getConf().width / 2,
y: mainScene.getConf().height / 2,
};
const title = Smally.Text({
content:"Hello World",
posX: centerPos.x,
posY: centerPos.y
});
// Add title to the main scene
mainScene.addChild(title);
// Add main scene to our game
game.addMainScene(mainScene);
// Start game
game.start();
</script>
For more, please see the exemples/ directory.