Skip to content

Instantly share code, notes, and snippets.

View ekelokorpi's full-sized avatar

Eemeli Kelokorpi ekelokorpi

View GitHub Profile
var sprite = new game.SpriteSheet('spritesheet.png', 80, 96);
sprite.frame(6); // Set texture to frame 6
sprite.addTo(this.stage);
game.createScene('Main', {
init: function() {
this.gameMusic();
},
gameMusic: function() {
var music = new game.Music('music.m4a');
music.play();
}
});
game.createClass('A', {
init: function() {
this.obj = new game.B();
}
});
game.createClass('B', {
test: 'hello'
});
game.module(
'game.utils'
)
.body(function() {
var seed = 0;
game.random = function () {
var x = Math.sin(.8765111159592828 + seed++) * 10000;
return x - Math.floor(x);
game.module(
'game.main'
)
.require(
'game.objects'
)
.body(function() {
});
game.module(
'game.main'
)
.body(function() {
game.createScene('Main', {
init: function() {
this.mob = new game.Mob();
this.mob.gfx.addTo(this.stage);
},
Amount amount = new Amount(
"USD",
total,
total,
0,
0,
"ROAM Discount",
0
);
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 November 11, 2014 08:32
Video: Basic usage
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 November 7, 2014 08:25
System: Pause/resume
game.system.pause(); // Pause game engine
game.system.resume(); // Resume game engine