Basic easing demo, and some mouse event handling stuff
parent
2e4582b149
commit
29aab13dcd
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,33 @@
|
|||||||
|
$(->
|
||||||
|
manager = new ResourceManager("easing/assets")
|
||||||
|
engine = new Engine(manager)
|
||||||
|
window.debug_engine = engine
|
||||||
|
|
||||||
|
# Configure game assets
|
||||||
|
manager.addImages([
|
||||||
|
"images/cursor.png"
|
||||||
|
])
|
||||||
|
|
||||||
|
manager.prepare()
|
||||||
|
manager.preload(null, ->
|
||||||
|
engine.addCanvas($("#gamecanvas"));
|
||||||
|
|
||||||
|
scene = engine.createScene("main")
|
||||||
|
|
||||||
|
engine.createSprite("cursor", "images/cursor.png")
|
||||||
|
|
||||||
|
cursor = engine.createObject("cursor")
|
||||||
|
cursor.sprite = engine.getSprite("cursor")
|
||||||
|
|
||||||
|
cursor.onClickGlobal = (event) ->
|
||||||
|
@x = @engine.ease.quadInOut(@x, event.x - 41, 15)
|
||||||
|
@y = @engine.ease.quadInOut(@y, event.y - 41, 15)
|
||||||
|
|
||||||
|
cursor.onStep = ->
|
||||||
|
return true
|
||||||
|
|
||||||
|
scene.createInstance(cursor, 0, 0)
|
||||||
|
|
||||||
|
engine.start()
|
||||||
|
)
|
||||||
|
)
|
@ -0,0 +1,7 @@
|
|||||||
|
body {
|
||||||
|
background-color: #ebebeb; }
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
background-color: white; }
|
||||||
|
|
||||||
|
/*# sourceMappingURL=easing.css.map */
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"file": "",
|
||||||
|
"sources": ["easing.scss"],
|
||||||
|
"names": [],
|
||||||
|
"mappings": "AAAA;EAEC,kBAAkB;;AAGnB;EAEC,kBAAkB"
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
// Generated by CoffeeScript 1.7.1
|
||||||
|
(function() {
|
||||||
|
$(function() {
|
||||||
|
var engine, manager;
|
||||||
|
manager = new ResourceManager("easing/assets");
|
||||||
|
engine = new Engine(manager);
|
||||||
|
window.debug_engine = engine;
|
||||||
|
manager.addImages(["images/cursor.png"]);
|
||||||
|
manager.prepare();
|
||||||
|
return manager.preload(null, function() {
|
||||||
|
var cursor, scene;
|
||||||
|
engine.addCanvas($("#gamecanvas"));
|
||||||
|
scene = engine.createScene("main");
|
||||||
|
engine.createSprite("cursor", "images/cursor.png");
|
||||||
|
cursor = engine.createObject("cursor");
|
||||||
|
cursor.sprite = engine.getSprite("cursor");
|
||||||
|
cursor.onClickGlobal = function(event) {
|
||||||
|
this.x = this.engine.ease.quadInOut(this.x, event.x - 41, 15);
|
||||||
|
return this.y = this.engine.ease.quadInOut(this.y, event.y - 41, 15);
|
||||||
|
};
|
||||||
|
cursor.onStep = function() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
scene.createInstance(cursor, 0, 0);
|
||||||
|
return engine.start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}).call(this);
|
@ -0,0 +1,9 @@
|
|||||||
|
body
|
||||||
|
{
|
||||||
|
background-color: #ebebeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas
|
||||||
|
{
|
||||||
|
background-color: white;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
coffee -w -c -j easing.coffee -o easing/ easing/*.coffee&
|
||||||
coffee -w -c -j gemswap.coffee -o gemswap/ gemswap/*.coffee&
|
coffee -w -c -j gemswap.coffee -o gemswap/ gemswap/*.coffee&
|
||||||
coffee -w -c -j radium.coffee -o compiled/ radium/*.coffee
|
coffee -w -c -j radium.coffee -o compiled/ radium/*.coffee
|
||||||
|
Loading…
Reference in New Issue