Skip to content

Instantly share code, notes, and snippets.

Avatar

Eemeli Kelokorpi ekelokorpi

View GitHub Profile
View sample.js
var sprite = new game.SpriteSheet('spritesheet.png', 80, 96);
sprite.frame(6); // Set texture to frame 6
sprite.addTo(this.stage);
View gist:e7a85c6271fac3fbd597a2bb6b36e5cb
game.createScene('Main', {
init: function() {
this.gameMusic();
},
gameMusic: function() {
var music = new game.Music('music.m4a');
music.play();
}
});
View gist:e2f26e5d9d33e7b1d60d653fd87552f2
game.createClass('A', {
init: function() {
this.obj = new game.B();
}
});
game.createClass('B', {
test: 'hello'
});
View gist:a56ebc214c4ad19e3dcfee0a63216592
game.module(
'game.utils'
)
.body(function() {
var seed = 0;
game.random = function () {
var x = Math.sin(.8765111159592828 + seed++) * 10000;
return x - Math.floor(x);
View gist:9cb4067170ed1a232ae388f1dfd9c6c7
game.module(
'game.main'
)
.require(
'game.objects'
)
.body(function() {
});
View gist:de8413dd1d499644af0774314adabbe6
game.module(
'game.main'
)
.body(function() {
game.createScene('Main', {
init: function() {
this.mob = new game.Mob();
this.mob.gfx.addTo(this.stage);
},
View gist:545f07717939586f20e2f2e9fcdea33c
Amount amount = new Amount(
"USD",
total,
total,
0,
0,
"ROAM Discount",
0
);
View gist:636e5686d2d1614ba2f3
game.module(
'game.main'
)
.body(function() {
game.createScene('Main', {
init: function() {
var sprite = new game.Sprite('panda.png');
sprite.addTo(this.stage);
}
@ekelokorpi
ekelokorpi / main.js
Created Nov 11, 2014
Video: Basic usage
View main.js
var video = new game.Video('video.mp4');
video.sprite.anchor.set(0.5, 0.5);
video.sprite.position.set(game.system.width / 2, game.system.height / 2);
video.sprite.addTo(this.stage);
video.onLoaded(function() {
// Video loaded
});
video.onComplete(function() {
@ekelokorpi
ekelokorpi / main.js
Created Nov 7, 2014
System: Pause/resume
View main.js
game.system.pause(); // Pause game engine
game.system.resume(); // Resume game engine