From 3b9ba95c79483c24a14a1ea1d785d83ff902aa66 Mon Sep 17 00:00:00 2001 From: Bye <bye@byecorps.com> Date: Thu, 24 Aug 2023 12:08:26 +0100 Subject: [PATCH] [COSMETIC] Add more boat options. This commit adds more types of boat bodies to the game. game.js get code that allows the boats to pick a random body and flag. --- assets/boats.ase | Bin 1503 -> 1133 bytes src/img/boats.webp | Bin 170 -> 122 bytes src/js/game.js | 8 +++++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/boats.ase b/assets/boats.ase index 75652bafe3308cddaeb6f2eb373600e032d9b30b..3a7bd9290e870c419b1752fdd476858cf33decbf 100644 GIT binary patch delta 28 hcmcc5{g#70mxY1h!BXap>=&6QM=}dce!*M{q5+KN30(jH delta 189 zcmaFMai5$0J}U#mgQaX6*)K8+6wE34Vb5c{;A5f$LsqoN%E>R7OBK)s>lqjretl$O zNMT@LU}9ikn8a+!Xg1l7MP3c0^8cd$^Zz$zuxZFg^0Y8c$rM|PTm6o=Gk(-hZa7#k o!286g;l>LI22)po`6XD)*Pd+0BFoFr{NF=jF8?ux<|XVu0XlO&aR2}S diff --git a/src/img/boats.webp b/src/img/boats.webp index 1fe6040877aaa6e1bf278dd1b2756eec365806f8..2a2257d70d8f09614f00df7a58ed57fe98906538 100644 GIT binary patch literal 122 zcmWIYbaN|WU|<M$bqWXzu<%J`U|`VaJHRZU?l2+OxPD>c8#!^M6Wb(@{4sPZnC;EM zGD+nddrZ<l<{#@bbq**@TH@v{a3Iox$AvNTZ+BBapVBXX1JB^x<0Vb|gx79b7goFa d%Fdq^fp?!S+U0j)c~^O}gO9+8(B}J03;<?BF_{1W literal 170 zcmWIYbaPw8z`zjh>J$(bVBs^3fq_9^_5ibh|AGk<Ri26LYxpzKKH_*FkEhUPj@5;1 zA4@MSpQ3VtMW<|)a>JTK9gC0rVP|Og`ds(Wf(ReOkESab&9-he|G7z3*_GjWxFDmT zgYbbXJQJoK{?hNGS@kkOVbTAr%Vr6e)FwM`>sYaF$IAY_yC1IE?_@vo=C0Q}FFoAz e`n-F^%ccWGi5ZdGJXkKC+HER5S)KEr2?GGDU`|Q^ diff --git a/src/js/game.js b/src/js/game.js index 75c9995..e289fe2 100644 --- a/src/js/game.js +++ b/src/js/game.js @@ -190,8 +190,8 @@ menuRoom.keyDown = (key) => { class Boat extends Entity { constructor(x, y, sprite, speed =1, id=randomInt(100, 10000), target={x:0,y:0}) { super(id, x, y); - this.boatbody = 0; - this.boatsail = 0; + this.boatbody = randomInt(0,2); + this.boatsail = randomInt(0,2); this.sprite = sprite; this.speed = speed; if (speed === 0) speed = 0.5; @@ -248,6 +248,8 @@ gameRoom.wavePendingStart = 0; gameRoom.boatCount = 0; gameRoom.boatSpeed = 0; +gameRoom.boatAvoid = {} + console.log(typeof(gameRoom.remove)) gameRoom.startWave = _ => { @@ -282,7 +284,7 @@ gameRoom.step = _ => { if (item.constructor.name === "Boat") numberOfBoats++; item.step(); } - if (numberOfBoats === 0 && !gameRoom.wavePendingStart) {gameRoom.wave++; gameRoom.wavePendingStart=1; setTimeout(gameRoom.startWave, 3000)}; + if (numberOfBoats === 0 && !gameRoom.wavePendingStart) {gameRoom.wave++; gameRoom.wavePendingStart=1; setTimeout(gameRoom.startWave, 3000)} if (gameRoom.wave >= 401) endRoom.wonGame(); } gameRoom.drawGUI = () => { -- GitLab