var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5); self.move = function () {}; self.shoot = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5); self.move = function () {}; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', .5, .5); self.move = function () {}; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet', .5, .5); self.move = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var hero = self.addChild(new Hero()); var enemies = []; var heroBullets = []; var enemyBullets = []; hero.x = 2048 / 2; hero.y = 2732 / 2; LK.on('tick', function () { hero.move(); for (var i = 0; i < enemies.length; i++) { enemies[i].move(); } for (var i = 0; i < heroBullets.length; i++) { heroBullets[i].move(); } for (var i = 0; i < enemyBullets.length; i++) { enemyBullets[i].move(); } }); stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); hero.x = pos.x; hero.y = pos.y; hero.shoot(); }); });
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
self.move = function () {};
self.shoot = function () {};
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5);
self.move = function () {};
});
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', .5, .5);
self.move = function () {};
});
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet', .5, .5);
self.move = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var hero = self.addChild(new Hero());
var enemies = [];
var heroBullets = [];
var enemyBullets = [];
hero.x = 2048 / 2;
hero.y = 2732 / 2;
LK.on('tick', function () {
hero.move();
for (var i = 0; i < enemies.length; i++) {
enemies[i].move();
}
for (var i = 0; i < heroBullets.length; i++) {
heroBullets[i].move();
}
for (var i = 0; i < enemyBullets.length; i++) {
enemyBullets[i].move();
}
});
stage.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
hero.x = pos.x;
hero.y = pos.y;
hero.shoot();
});
});