User prompt
Make score text impact and add a black dropshadow
User prompt
fix it
User prompt
axe follows the pointer along the bottom
User prompt
show the axe at bottom in the last position you threw
User prompt
spawn 3 targets at a time, only spawn the next wave of targets when the previous wave is fully cleared
User prompt
only have 3 targets at a time. for every 3 targets you kill, speed them up slightly
User prompt
turn the background in to a green grassy field
User prompt
turn the background in to a nice grass field
User prompt
gain points when you break a target, if an axe hits the top of the screen its game over
User prompt
double the speed of the axe throwing
User prompt
targets cant spawn near the bottom of the screen
User prompt
spawn targets randomly. make the axe spin when its being thrown
User prompt
pressing throws the axe
User prompt
axe stays at the bottom of the screen and can only move side to side as well
User prompt
Make targets move side to side instead
Initial prompt
Axe Attack
var Target = Container.expand(function () { var self = Container.call(this); var targetGraphics = self.createAsset('target', 'Moving Target', .5, .5); self.speed = 5; self.direction = 1; self.move = function () { self.x += self.speed * self.direction; if (self.x <= 0 || self.x >= 2048) { self.direction *= -1; } }; }); var Axe = Container.expand(function () { var self = Container.call(this); var axeGraphics = self.createAsset('axe', 'Thrown Axe', .5, .5); self.speed = 20; self.move = function () { self.y -= self.speed; self.rotation += 0.1; }; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('green_grass_field', 'Green Grassy Field Background', 0, 0); background.width = 2048; background.height = 2732; var targets = []; var axes = []; var score = 0; var kills = 0; var targetSpeed = 5; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff", font: "Impact", dropShadow: true, dropShadowColor: "#000000" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var spawnTargets = function () { for (var i = 0; i < 3; i++) { var target = self.addChild(new Target()); target.speed = targetSpeed; target.x = Math.random() * 2048; target.y = Math.random() * (2732 - target.height * 2); targets.push(target); } }; LK.on('tick', function () { if (targets.length == 0) { spawnTargets(); } }); var axe; stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); axe = self.addChild(new Axe()); axe.x = pos.x; axe.y = 2732 - axe.height; axes.push(axe); }); LK.on('tick', function () { for (var i = 0; i < targets.length; i++) { targets[i].move(); } for (var i = 0; i < axes.length; i++) { axes[i].move(); if (axes[i].y < -50) { axes[i].destroy(); axes.splice(i, 1); } if (axes[i].y <= 0) { LK.showGameOver(); } } for (var i = 0; i < axes.length; i++) { for (var j = 0; j < targets.length; j++) { if (axes[i].intersects(targets[j])) { var distance = Math.sqrt(Math.pow(axes[i].x - targets[j].x, 2) + Math.pow(axes[i].y - targets[j].y, 2)); score += Math.max(0, 100 - distance) + 50; scoreTxt.setText(score); axes[i].destroy(); axes.splice(i, 1); targets[j].destroy(); targets.splice(j, 1); kills++; if (kills % 3 == 0) { targetSpeed += 1; } break; } } } }); });
===================================================================
--- original.js
+++ change.js
@@ -30,9 +30,12 @@
var kills = 0;
var targetSpeed = 5;
var scoreTxt = new Text2('0', {
size: 150,
- fill: "#ffffff"
+ fill: "#ffffff",
+ font: "Impact",
+ dropShadow: true,
+ dropShadowColor: "#000000"
});
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var spawnTargets = function () {
@@ -51,18 +54,28 @@
});
var axe;
stage.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
- var axe = self.addChild(new Axe());
- axes.push(axe);
+ axe = self.addChild(new Axe());
axe.x = pos.x;
axe.y = 2732 - axe.height;
+ axes.push(axe);
});
LK.on('tick', function () {
for (var i = 0; i < targets.length; i++) {
targets[i].move();
}
for (var i = 0; i < axes.length; i++) {
+ axes[i].move();
+ if (axes[i].y < -50) {
+ axes[i].destroy();
+ axes.splice(i, 1);
+ }
+ if (axes[i].y <= 0) {
+ LK.showGameOver();
+ }
+ }
+ for (var i = 0; i < axes.length; i++) {
for (var j = 0; j < targets.length; j++) {
if (axes[i].intersects(targets[j])) {
var distance = Math.sqrt(Math.pow(axes[i].x - targets[j].x, 2) + Math.pow(axes[i].y - targets[j].y, 2));
score += Math.max(0, 100 - distance) + 50;
axe sprite Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon shooting target sprite Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon field background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.