Skip to content

Commit

Permalink
Game playeable for 5 waves. Dare you to get to Wave 4
Browse files Browse the repository at this point in the history
  • Loading branch information
eea88 committed Jul 17, 2024
1 parent 1fbe1c9 commit e8be9d8
Show file tree
Hide file tree
Showing 6 changed files with 276 additions and 219 deletions.
10 changes: 5 additions & 5 deletions battle.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function extraBattle(battleArray,bottomContainer){
if(battleArray.length>= 1){
if(game.enemiesBattleLeft.length> 0){
let orcNumber = Math.floor(Math.random()*game.enemiesBattleLeft.length);
if(game.enemies.length> 0){
let orcNumber = Math.floor(Math.random()*game.enemies.length);
let soldierNumber= Math.floor(Math.random()*battleArray.length);
let soldierBlocker = battleArray[soldierNumber];
let orcAttacker = game.enemiesBattleLeft[orcNumber];
let orcAttacker = game.enemies[orcNumber];
soldierBlocker.soldierAttack(orcAttacker);
orcAttacker.orcAttack(soldierBlocker);
}
Expand All @@ -20,12 +20,12 @@ function extraBattle(battleArray,bottomContainer){
function classRemoval (){
let battleArray = game.soldiersHastati;
let bottomContainer = hastatiContainer;
if (game.soldiersHastati.length >0
if (game.soldiersHastati.length >=0
&& hastatiContainer.position === "bottom"){
battleArray = game.soldiersHastati;
bottomContainer = hastatiContainerElement
}
else if( game.soldiersPrincipes.length >0
else if( game.soldiersPrincipes.length >=0
&& principesContainer.position === "bottom")
{ battleArray = game.soldiersPrincipes;
bottomContainer = principesContainerElement}
Expand Down
Loading

0 comments on commit e8be9d8

Please sign in to comment.