From 179eaf4f82f327c4f26b12f949f60ca272cf785e Mon Sep 17 00:00:00 2001 From: Mal Date: Tue, 3 Sep 2024 23:08:08 +0200 Subject: [PATCH] Giesela is now sleeping until finish --- graphics/giesela-left-sleeping.png | Bin 0 -> 3059 bytes graphics/giesela-right-sleeping.png | Bin 0 -> 3026 bytes js/Game.js | 24 ++++++++++++++++++++---- js/Gisela.js | 10 +++++++++- js/module.js | 2 ++ 5 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 graphics/giesela-left-sleeping.png create mode 100644 graphics/giesela-right-sleeping.png diff --git a/graphics/giesela-left-sleeping.png b/graphics/giesela-left-sleeping.png new file mode 100644 index 0000000000000000000000000000000000000000..733b1dae5899dcdb2ab7a762ae45018098b9d5c8 GIT binary patch literal 3059 zcmVv$P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H13xG*P zK~#90?VVeUBvl#5e_vJi?65l_D|b;u6E0!dWg$Wc54bU!7=p$J1(xoa?%`&_iwPo8 zAAC{c1wu?D!9-oiEdu>XQsQS z>YN%_&VO^VRi~@!cc%KQbG~!VcdA8I@p|`5kS)MTD|~cV(MMK0FK|~RuXlqg>s_2~r04>$knRg|%rNJP_W|rkkduKMSNLd7(VvxAjuSAxz!Bgr zAXfDC)sFWyfIW4{Jb@Vhs=5y4*n}~F*A)Hxpo4u4;7Ed;3Dha621uU#O@JinkfJXS zI`62e0R;ItaC}epQ;N=(ScVGbix>gk1P+yiJ}F7hDf;ZNCmmG=09*;2+mm-6P?`Y% zrvldkPb>QU61k~1CbdDTSkX6DJNRfbfL*}mWc!1dFQODBPyX@181M>kuq<|uPE1m& z!@#NoK}VGVDEgOlTaa@p(Eu=C{*A!%ir!fwH`Ni$m))!RekUDO29QdSpJE0@t^(dJ z8NWf04`ucbDf*ggXyWk?^!j^c)c_LDcW+Pj!;0Q)lhcQPEaq?80HEl<%i#9tWR})E zb3ke10Be=)8X&-Uz^Tpx{$rWZPv65hfjgAa`?m|g(<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;|$F2L5I_lOgWOMwaa-_kNuZ4 zJl`!pGb^~9YI^Iv#`A_QGSh}|zqVkV$712Vl^|6}P$7+RU$a=n8e$Sl1dc8jHh2NYYSZ9Kh z#2btH26(<(eoqI8o}Vw5B<^-*3{%!>;ctNFyW#h|H0-7y)hLO9m)1cv4RN}f4eo;S zd`J8qMGZjRH}TZ-D2!;rERJZo0<= zA`=r6fC)lMe=h@C_*BUA-SB%lfX+ZOekw3`q>h7-IEAd>H^B4V@cZ7BJPATt<#lcX zAkTNl@7V*SZ&(?hQUaPueH=d&_6_iSH~g**1rdn=Mn~tDBja7CFkL@6If;lws+#{^ zs5#{MZuyye0kvAKb)!KrGlj{?Nz(O69niG-CV0MEey?8*>nhi3wYL4|q^?&R$0E;n z$IqQbk{Gpf=gwo{Em@vl3_sI*azaX}!>T;r9X~4uNcx{%_aQAoycSu2Jl`$<|EzLa U&6~<5rT_o{07*qoM6N<$f~$6vT>t<8 literal 0 HcmV?d00001 diff --git a/js/Game.js b/js/Game.js index d6bc28d..578f9bf 100644 --- a/js/Game.js +++ b/js/Game.js @@ -51,10 +51,20 @@ export class Game return; } - if (this.gisela.currentAnimation !== 'LOOK_LEFT' && this.mrCroc.position.x < this.gisela.position.x) { - this.gisela.currentAnimation = 'LOOK_LEFT'; - } else if (this.gisela.currentAnimation !== 'LOOK_RIGHT' && this.mrCroc.position.x >= this.gisela.position.x) { - this.gisela.currentAnimation = 'LOOK_RIGHT'; + /* + if (this.gisela.currentAnimation !== 'SLEEP_LEFT' && this.mrCroc.position.x < this.gisela.position.x) { + this.gisela.currentAnimation = 'SLEEP_LEFT'; + } else if (this.gisela.currentAnimation !== 'SLEEP_RIGHT' && this.mrCroc.position.x >= this.gisela.position.x) { + this.gisela.currentAnimation = 'SLEEP_RIGHT'; + } + */ + + if (!this.gameFinished) { + if (this.mrCroc.position.x < this.gisela.position.x) { + this.gisela.playAnimation('SLEEP_LEFT', timestamp); + } else { + this.gisela.playAnimation('SLEEP_RIGHT', timestamp); + } } this.context.clearRect(0, 0, window.innerWidth, window.innerHeight); @@ -164,6 +174,12 @@ export class Game finish() { + if (this.mrCroc.position.x < this.gisela.position.x) { + this.gisela.currentAnimation = 'LOOK_LEFT'; + } else { + this.gisela.currentAnimation = 'LOOK_RIGHT'; + } + this.gameFinished = true; this.KeyLeft.pressed = false; this.KeyRight.pressed = false; diff --git a/js/Gisela.js b/js/Gisela.js index b91b7f4..3dbb08b 100644 --- a/js/Gisela.js +++ b/js/Gisela.js @@ -15,5 +15,13 @@ export default class Gisela extends Movable 'LOOK_RIGHT', new RetroAnimation(Setting.GRAPHICS_LOCATION + 'gisela-right.png', 1, SCALE, 0.01) ); + this.addAnimation( + 'SLEEP_LEFT', + new RetroAnimation(Setting.GRAPHICS_LOCATION + 'giesela-left-sleeping.png', 4, SCALE, 4) + ); + this.addAnimation( + 'SLEEP_RIGHT', + new RetroAnimation(Setting.GRAPHICS_LOCATION + 'giesela-right-sleeping.png', 4, SCALE, 4) + ); } -} \ No newline at end of file +} diff --git a/js/module.js b/js/module.js index fd867a5..7326f08 100644 --- a/js/module.js +++ b/js/module.js @@ -58,6 +58,8 @@ function loadLevel(level) loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-right.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); + loader.addImage(Setting.GRAPHICS_LOCATION + 'giesela-left-sleeping.png'); + loader.addImage(Setting.GRAPHICS_LOCATION + 'giesela-right-sleeping.png'); for (const graphicSet of GraphicSet) { loader.addImage(Setting.TILESET_LOCATION + graphicSet.tileset);