Get started with crafty CDN
(MIT OR GPL) licensed
Crafty is a lightweight library for building interactive HTML5 games and applications.
Tags:- framework
- javascript
Stable version
Copied!
How to start using crafty CDN
// Include CraftyJS library from CDN
document.write('<script src="https://cdn.cdnhub.io/crafty/0.9.0/crafty-min.js"></script>');
// Initialize the CraftyJS scene
Crafty.init();
// Create a new entity with a 2D position and a color
Crafty.e('2D, Color:red')
.text('Hello Crafty!')
.attr({x: 50, y: 50})
.on('Crafty.init', function() {
this.bind('MouseDown', function() {
Crafty.log('Entity was clicked!');
});
});
// Add the entity to the scene
Crafty('2DCanvas').add(Crafty('Entity'));
Copied!
Copied!