var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5); self.speed = 5; self.move = function () {}; self.punch = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5); self.speed = 3; self.move = function () {}; }); var Punch = Container.expand(function () { var self = Container.call(this); var punchGraphics = self.createAsset('punch', 'Punch Graphics', .5, .5); self.speed = 10; self.move = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x000000); var hero = self.addChild(new Hero()); var enemies = []; var punches = []; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; var tickOffset = 0; hero.x = 2048 / 2; hero.y = 2732 / 2; hero.on('down', function (obj) { var punch = new Punch(); punch.x = hero.x; punch.y = hero.y; punches.push(punch); self.addChild(punch); }); LK.on('tick', function () { hero.move(); for (var i = 0; i < enemies.length; i++) { enemies[i].move(); if (hero.intersects(enemies[i])) { isGameOver = true; } } for (var i = 0; i < punches.length; i++) { punches[i].move(); for (var j = 0; j < enemies.length; j++) { if (punches[i].intersects(enemies[j])) { enemies[j].destroy(); enemies.splice(j, 1); punches[i].destroy(); punches.splice(i, 1); scoreTxt.setText(parseInt(scoreTxt.text) + 1); break; } } } if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } if (tickOffset++ % 60 == 0) { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = Math.random() * 2732; enemies.push(enemy); self.addChild(enemy); } }); });
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
self.speed = 5;
self.move = function () {};
self.punch = function () {};
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5);
self.speed = 3;
self.move = function () {};
});
var Punch = Container.expand(function () {
var self = Container.call(this);
var punchGraphics = self.createAsset('punch', 'Punch Graphics', .5, .5);
self.speed = 10;
self.move = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
LK.stageContainer.setBackgroundColor(0x000000);
var hero = self.addChild(new Hero());
var enemies = [];
var punches = [];
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
LK.gui.topCenter.addChild(scoreTxt);
var isGameOver = false;
var tickOffset = 0;
hero.x = 2048 / 2;
hero.y = 2732 / 2;
hero.on('down', function (obj) {
var punch = new Punch();
punch.x = hero.x;
punch.y = hero.y;
punches.push(punch);
self.addChild(punch);
});
LK.on('tick', function () {
hero.move();
for (var i = 0; i < enemies.length; i++) {
enemies[i].move();
if (hero.intersects(enemies[i])) {
isGameOver = true;
}
}
for (var i = 0; i < punches.length; i++) {
punches[i].move();
for (var j = 0; j < enemies.length; j++) {
if (punches[i].intersects(enemies[j])) {
enemies[j].destroy();
enemies.splice(j, 1);
punches[i].destroy();
punches.splice(i, 1);
scoreTxt.setText(parseInt(scoreTxt.text) + 1);
break;
}
}
}
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
if (tickOffset++ % 60 == 0) {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 2732;
enemies.push(enemy);
self.addChild(enemy);
}
});
});
Boxing glove, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A golden glowing star, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art "bap!" explosion Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art explosion that says "TKO" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
ball of fire sprite art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute anthropomorphic cat wearing boxing shorts and boxing gloves, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art view from inside boxing ring, floor near middle of image Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
anthropomorphic dog wearing boxing shorts and boxing gloves, boxer, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.