Skip to content

Instantly share code, notes, and snippets.

@yonekawa
Created October 24, 2012 09:14
Show Gist options
  • Save yonekawa/3945014 to your computer and use it in GitHub Desktop.
Save yonekawa/3945014 to your computer and use it in GitHub Desktop.
Leak code
enchant();
var NewScene = enchant.Class.create(enchant.Scene, {
initialize: function() {
enchant.Scene.call(this);
for (var i = 0; i < 100; i++) {
var sprite = new Sprite(32, 32);
sprite.image = enchant.Game.instance.assets['chara1.png'];
this.addChild(sprite);
}
}
});
window.onload = function(){
var game = new Game(320, 320);
game.preload("chara1.png");
game.onload = function() {
var bear = new Sprite(32, 32);
bear.image = game.assets['chara1.png'];
game.rootScene.addChild(bear);
bear.tl.moveTo(200, 200, 30).moveTo(-200, -200, 30).loop();
game.rootScene.on('touchstart', function() {
for (var i = 0; i < 100; i++) {
var newScene = new NewScene();
game.pushScene(newScene);
game.popScene();
}
});
};
game.start();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment