User prompt
Make archers shoot
User prompt
Archers can shoot bullets towards enemies in range
User prompt
Pressing the new button should spawn a player archer
User prompt
Add a new solider type which is an archer.
User prompt
use other art for the new button
User prompt
On the left of the existing button, add one more button
User prompt
I should earn money when I kill an enemy soldier, enemy should earn money when they kill my soldiers.
User prompt
My soldiers should not auto spawn, instead my soldiers should spawn when the top right Botton is press, assuming I have enough cash
User prompt
Add a graphics button to the top right corner, about 120px from the top.
User prompt
Bases should get full health points when game restarts and update the health bar accordingly
User prompt
My soldiers should stop when attacking the enemy base. Enemy soldiers should stop while attacking my base.
User prompt
Update the base class to start with 10x as much health
User prompt
fix: [Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: money (anonymous function) rejectPromise promiseReactionJob
User prompt
Restart game should remove all soldiers, reset cash and start the game over
User prompt
Make takeDamage on bases return if the base died or not, use that in the main game loop to call restart
User prompt
My soldiers seems to be removed when they touch the enemy base
User prompt
Soldiers should do stop and do damage to bases. If my base is destroyed I should be game over, if the enemy base is destroyed alert "you won" then restart the game.
User prompt
Draw a shadow below soldiers using graphics
User prompt
Enemy and player should use separate solder graphics
User prompt
Player and enemy should have separate money economies
User prompt
Soldiers should spawn from the middle of bases
User prompt
Ground y should be 2732 - 150
User prompt
ground asset should have an y anchor point of 0
User prompt
Make trees positioned at y 2732-50
User prompt
Trees should have their graphics bottom aligned, and be placed such that the bottom of the tree is on the ground.
===================================================================
--- original.js
+++ change.js
@@ -265,96 +265,102 @@
function handleTick() {
for (var i = 0; i < playerSoldiers.length; i++) { //{105}
var soldier = playerSoldiers[i];
soldier.move(playerSoldiers, enemySoldiers);
- for (var j = 0; j < enemySoldiers.length; j++) { //{106}
- var enemy = enemySoldiers[j]; //{107}
+ if (soldier instanceof Archer) { //{106}
+ soldier.shoot(enemySoldiers);
+ } //{107}
+ for (var j = 0; j < enemySoldiers.length; j++) { //{108}
+ var enemy = enemySoldiers[j]; //{109}
if (soldier.intersects(enemy)) {
if (soldier.takeDamage(10)) {
playerSoldiers.splice(i, 1);
- i--; //{108}
- enemyMoney += 100; //{109}
- } //{110}
+ i--; //{110}
+ enemyMoney += 100; //{111}
+ } //{112}
if (enemy.takeDamage(10)) {
- enemySoldiers.splice(j, 1); //{111}
- j--; //{112}
- playerMoney += 100; //{113}
- } //{114}
- } //{115}
- } //{116}
+ enemySoldiers.splice(j, 1); //{113}
+ j--; //{114}
+ playerMoney += 100; //{115}
+ } //{116}
+ } //{117}
+ } //{118}
if (soldier.intersects(enemyBase)) {
if (enemyBase.takeDamage(50)) {
alert("You won");
restartGame();
- } else { //{117}
- soldier.speed = 0; //{118}
- } //{119}
- } //{120}
- } //{121}
+ } else { //{119}
+ soldier.speed = 0; //{120}
+ } //{121}
+ } //{122}
+ } //{123}
- for (var i = 0; i < enemySoldiers.length; i++) { //{122}
+ for (var i = 0; i < enemySoldiers.length; i++) { //{124}
var soldier = enemySoldiers[i];
soldier.move(enemySoldiers, playerSoldiers);
+ if (soldier instanceof Archer) { //{125}
+ soldier.shoot(playerSoldiers);
+ } //{126}
if (soldier.intersects(playerBase)) {
if (playerBase.takeDamage(50)) {
XS.showGameOver(restartGame);
- } else { //{123}
- soldier.speed = 0; //{124}
- } //{125}
- } //{126}
- } //{127}
+ } else { //{127}
+ soldier.speed = 0; //{128}
+ } //{129}
+ } //{130}
+ } //{131}
if (XS.ticks % 60 == 0) {
spawnSoldier(false);
- } //{128}
+ } //{132}
for (var i = 0; i < playerBullets.length; i++) {
var bullet = playerBullets[i];
- bullet.move(); //{129}
- for (var j = 0; j < enemySoldiers.length; j++) { //{130}
- var enemy = enemySoldiers[j]; //{131}
+ bullet.move(); //{133}
+ for (var j = 0; j < enemySoldiers.length; j++) { //{134}
+ var enemy = enemySoldiers[j]; //{135}
if (bullet.intersects(enemy)) {
if (enemy.takeDamage(50)) {
- enemySoldiers.splice(j, 1); //{132}
- j--; //{133}
- playerMoney += 100; //{134}
- } //{135}
- bullet.destroy(); //{136}
+ enemySoldiers.splice(j, 1); //{136}
+ j--; //{137}
+ playerMoney += 100; //{138}
+ } //{139}
+ bullet.destroy(); //{140}
playerBullets.splice(i, 1);
- i--; //{137}
- } //{138}
- } //{139}
- } //{140}
+ i--; //{141}
+ } //{142}
+ } //{143}
+ } //{144}
for (var i = 0; i < enemyBullets.length; i++) {
var bullet = enemyBullets[i];
- bullet.move(); //{141}
+ bullet.move(); //{145}
for (var j = 0; j < playerSoldiers.length; j++) {
var soldier = playerSoldiers[j];
if (bullet.intersects(soldier)) {
if (soldier.takeDamage(50)) {
playerSoldiers.splice(j, 1);
- j--; //{142}
- enemyMoney += 100; //{143}
- } //{144}
- bullet.destroy(); //{145}
+ j--; //{146}
+ enemyMoney += 100; //{147}
+ } //{148}
+ bullet.destroy(); //{149}
enemyBullets.splice(i, 1);
- i--; //{146}
- } //{147}
- } //{148}
- } //{149}
+ i--; //{150}
+ } //{151}
+ } //{152}
+ } //{153}
moneyTxt.setText('Player Money: ' + playerMoney + ' Enemy Money: ' + enemyMoney);
xpTxt.setText('XP: ' + xp);
- } //{150}
+ } //{154}
XS.on('tick', handleTick)
var dragWorld = null;
var initialMousePos = null;
stage.on('down', function(obj) {
dragWorld = world;
initialMousePos = obj.event.getLocalPosition(self);
- }) //{151}
+ }) //{155}
stage.on('move', function(obj) {
if (dragWorld && initialMousePos) {
var event = obj.event;
@@ -363,18 +369,18 @@
if (newX > 0) {
newX = 0;
} else if (newX < stage.width - 2048 * 4) {
newX = stage.width - 2048 * 4;
- } //{152}
+ } //{156}
dragWorld.x = newX;
initialMousePos = pos;
- } //{153}
- }) //{154}
+ } //{157}
+ }) //{158}
stage.on('up', function(obj) {
dragWorld = null;
initialMousePos = null;
- }) //{155}
+ }) //{159}
function restartGame() {
playerBase.health = 10000;
playerBase.children[1].updateHealth(playerBase.health, 10000);
@@ -382,25 +388,25 @@
enemyBase.children[1].updateHealth(enemyBase.health, 10000);
playerMoney = 1000;
enemyMoney = 1000;
xp = 0;
- for (var i = 0; i < playerSoldiers.length; i++) { //{156}
+ for (var i = 0; i < playerSoldiers.length; i++) { //{160}
playerSoldiers[i].destroy();
- } //{157}
- for (var i = 0; i < enemySoldiers.length; i++) { //{158}
+ } //{161}
+ for (var i = 0; i < enemySoldiers.length; i++) { //{162}
enemySoldiers[i].destroy();
- } //{159}
+ } //{163}
playerSoldiers = [];
enemySoldiers = [];
- } //{160}
- }); //{161}
+ } //{164}
+ }); //{165}
/** Initialize the 'main class' and attach it to stage **/
var strategyFRVR = new StrategyFRVR()
stage.addChild(strategyFRVR);
function positionElements(obj) {
strategyFRVR.x = (stage.width - 2048) / 2
- } //{162}
+ } //{166}
positionElements();
XS.on('resize', positionElements);
-} //{163}
\ No newline at end of file
+} //{167}
\ No newline at end of file
Single square button with bow and arrow on it. Metal button Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
single background tree, full view. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Heroic knight walking to the right. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Enemy zombie knight walking to the left. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Single square button with soldier helmet on it. Metal button Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Heroic archer walking to the right. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Full view Hero stronghold with gate at the right. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
single background tree, full view. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.