var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5);
self.speed = 10;
self.move = function () {
self.y -= self.speed;
};
});
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5);
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero Graphics', .5, .5);
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('enemy', 'Enemy Graphics', .5, .5);
});
var Game = Container.expand(function () {
var self = Container.call(this);
var heroBullets = [];
var enemyBullets = [];
var enemies = [];
var hero = self.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 - 200;
var spawnEnemy = function () {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = 0;
enemies.push(enemy);
self.addChild(enemy);
};
var fireHeroBullet = function () {
var bullet = new HeroBullet();
bullet.x = hero.x;
bullet.y = hero.y;
heroBullets.push(bullet);
self.addChild(bullet);
};
var fireEnemyBullet = function (enemy) {
var bullet = new EnemyBullet();
bullet.x = enemy.x;
bullet.y = enemy.y;
enemyBullets.push(bullet);
self.addChild(bullet);
};
var handleMove = function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
hero.x = pos.x;
};
stage.on('move', handleMove);
LK.on('tick', function () {});
});
===================================================================
--- original.js
+++ change.js
@@ -56,24 +56,6 @@
var pos = event.getLocalPosition(self);
hero.x = pos.x;
};
stage.on('move', handleMove);
- LK.on('tick', function () {
- for (var i = 0; i < heroBullets.length; i++) {
- heroBullets[i].move();
- }
- for (var i = 0; i < enemyBullets.length; i++) {
- enemyBullets[i].move();
- }
- for (var i = 0; i < enemies.length; i++) {
- if (Math.random() < 0.01) {
- fireEnemyBullet(enemies[i]);
- }
- }
- if (Math.random() < 0.01) {
- spawnEnemy();
- }
- if (Math.random() < 0.1) {
- fireHeroBullet();
- }
- });
+ LK.on('tick', function () {});
});
Simple flat icon, 200x200pixels, one bright color square with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color circle with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color diamond with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color romb with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color smiley with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
1024x1366 pixels, totally black no more than 20 very small, barely visible, stars here and there. Simple Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single Game Texture, 50x50pix. In-Game asset. 2d. Blank background. High contrast. No shadows. Light green circle with border. Simple. No other objects. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.