From f8509dac8595ab292a5ecfed0cc91ae49baa73d7 Mon Sep 17 00:00:00 2001 From: Juanter134 Date: Wed, 16 Oct 2024 19:00:28 -0300 Subject: [PATCH] Primeros pasos de boss fight Co-authored-by: Bruno --- assets/stock_fondo.jpg | Bin 0 -> 5550 bytes entorno.wlk | 109 +++++++++++++++++++++++++++-------------- main.wpgm | 11 +++-- morcilla.wlk | 63 ++++++++++++++++++++---- 4 files changed, 134 insertions(+), 49 deletions(-) create mode 100644 assets/stock_fondo.jpg diff --git a/assets/stock_fondo.jpg b/assets/stock_fondo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a77393ebc6426c81f39808fb9c1b888ad9810825 GIT binary patch literal 5550 zcmY*c2T&7Cw@pHo-a_w9dT-JMrB^ATcd4O+AX1bf5D-wQfzYG|q!%#=f)WwwHAFyq zuL1%A6dr!x|Nb}c+}X2p=j`0s+1=SadyTzb1W@T|>1qLhKmY)E6M*Ykz;nPYLLwR( z8ZhlmqrV9%FbxBkfdNcU^*3b%gTV}p>;jyO%zP|hdM-&WK0#qIF);>CX$5Iz%| zVITkhg+>3yKlpDa_HX`I{zv=Y5!c-SYGObekQNWf4FFLC z@u-2VE+Q;o%by5)t31cc}oNo0Ncn5FeiaAMa)e5Cp)Z#;4&TAe2-$ zq2+cCj3JUTef_49j_00BQ0%9%`{_+fKc!_#4#D)iHwBo0|Kh*J|5m`qBe;<`sQ*d; z5Z+(@7eEj-9u3z`VQ&2E82}mHjY^G24Y&(9yCq3QO%0^}4{@cIb1fQ{t-a_E?yepy zlPSjv@WB8eT}1#9jWHLfDk*8EMKGPcRhH8(cAJZ~>|9!y>|NZAte>z1dd@Z-u%*dW5NhesThR zjpLsW*Y{WziHrC=5$GdG@|m^=jCwiuTYp}$w_1?4vzb;7-%(6WMM0pFgCwFSqUfFR z=>p8i+@L6nq}{IQLBM%%q5QYIY_wngJRxU}SK@qdWzD+9OmkT2~IW zG#>7L>LUa_A5$At>Zy{O3>)TPifvSF+K4g?!=2o9Q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vc(mTUKKB<1a)-tD+lGiMd#zBK!V7tM~R`<7o* zH!$0P8@)UpaNd zGkZP38pJn#fbl-PHdr-iWm)a;C@WNW{4PZ&e)5E`!!byk+W+-6;K>WUf|U7(6434d z{D8xsdCb_=dzxyKdr|f}#;T+Cs_s{`ahqjV9P09ZRT5SYxG3 zT$0hZuEORa%6R-w|wPXrtzN8s2yW9NNT*p4aB zIb11X_u1Gns-7aefn58dE1T;#ql0^4R>G`_o=zY_U6c zH_a{X>6~gGGOLyN`YqiNtbq+eoJwJ7Cwx5c%v#$}--}Cbu(I!EOEP1)`3r@Hp`O#U zxZ;jgsPi^uIO3(O^BGMMI-^vcfiYTj#+_hyqE zhui@d5~>=;2u}rPv|W_O1qU|N@k(L#rN5E^3AK3%mJ{ngGIj)m7T_0>elqKDbsmwyuH&rvqDc9-{>N@do{XuM$TU>K> zJ<3XA3!?cuj^Fmls|k-nbqQHf(~@hzWXZg!L2|Wti5re%|owi+1a>JeILo;{w zl1F@lJu?c5A(`domS*4L|7hQrtQk<4mv!4QOence3w3@!|J#2h`&dNQp=uNTXHs9k zVJzx%B)qW;ffu|JEG9P`AOkrbz6Q96-uWXEa=Cuhs^mM{ZfndFfg94pG?Ocy7j4PS z8oMnsf2XnwiMm^LVIY3h2y>H1!gLzl26x533UC4JSM_Kq;&KDD1}K0u#%GPnRZHH#^e|(CK1^$AL#{m`eltRiL5Q=?RQM zQS#nQdN7!?tt0FNkuSDss_sHiqq2W^-Y8vPkZ#G*Ci>)5{E;W-OERtl5~e_oqo5lIqp_o4sA-?zJotj|MPY47OQ6u?S(-*oag6^-=m)?O){7|;^3SN z3j6^6rB60=UgKoJ z5@jz8q;00T)KCq~I0N4#9eV`4fxYVj;bmPd%_RKbID;W3l&@iY^IA&Y%mYI?|25MMF5M(d$+2%k9Z0 hlsNa#hcpci;?x2TdT 0) + game.schedule(duracionCinematica, { self.etapaDefensa() }) + else + self.finalizarBatalla() + } + + method etapaDefensa() { + morcilla.activarMovimiento() + + const duracionTurnoJefe = 15000 + jefe.ataque() + game.schedule(duracionTurnoJefe, { self.habilitarAtaque() }) + } + + method finalizarBatalla() { + + } +} + +const bossFightDePrueba = new BossFight(jefe = jefeDePrueba) + + + +// =============================================== JEFES =============================================== +class JefeInteractuable{ + const property position + const property image + var property vida = 3 + + method disminuirVida(){ + vida = (vida - 1).max(0) + } + method ataque(){ + + } } -// const jefeDePrueba = new JefeInteractuable(position = new Position(x=16, y=2), image() = "celda_roja.png") \ No newline at end of file +const jefeDePrueba = new JefeInteractuable(position = new Position(x=16, y=2), image = "celda_roja.png") \ No newline at end of file diff --git a/main.wpgm b/main.wpgm index 20070e2..bf868d4 100644 --- a/main.wpgm +++ b/main.wpgm @@ -5,20 +5,25 @@ import entorno.* program MorcillaGame { game.title("La Bizarra Aventura de MORCILLA") + game.boardGround("stock_fondo.jpg") game.height(32) game.width(32) game.cellSize(100) - game.addVisual(jefeInteractuable) + game.addVisual(jefeDePrueba) game.addVisual(morcilla) // Mover a morcilla keyboard.d().onPressDo({ morcilla.caminarDerecha(1) }) keyboard.a().onPressDo({ morcilla.caminarIzquierda(1) }) - keyboard.space().onPressDo({ morcilla.saltar(2000) }) + keyboard.space().onPressDo({ morcilla.saltar(1000) }) - game.whenCollideDo(morcilla, {nose => game.say(morcilla, "Estas colisionando")}) + keyboard.l().onPressDo({ game.boardGround("arena_de_jefe.png") }) + + keyboard.j().onPressDo({ bossFightDePrueba.iniciarPelea() }) + + game.whenCollideDo(morcilla, {jefe => game.say(jefeDePrueba, "Estas colisionando")}) game.start() } diff --git a/morcilla.wlk b/morcilla.wlk index 6b12aeb..f570c87 100644 --- a/morcilla.wlk +++ b/morcilla.wlk @@ -2,22 +2,38 @@ import wollok.game.* object morcilla { var property position = new MutablePosition(x=0, y=2) + var property vidas = 5 + var property puedeAtacar = false + var saltando = false + var suspendido = false + var caerActivo = false + var movimientoActivo = true method image() = "morcilla256.png" + method saltando() = saltando method caminarDerecha(pasos) { - position.goRight(pasos) + if(movimientoActivo) + position.goRight(pasos) + + // FALTA EVALUAR SI QUEDA SUSPENDIDO + self.caer() } method caminarIzquierda(pasos) { - position.goLeft(pasos) + if(movimientoActivo) + position.goLeft(pasos) + + // FALTA EVALUAR SI QUEDA SUSPENDIDO + self.caer() } method saltar(duracion) { - if (!saltando) { + if (!suspendido && movimientoActivo) { saltando = true - const tiempo = duracion / 10 + suspendido = true + const tiempo = duracion / 5 game.schedule(tiempo * 0, { position.goUp(1) }) game.schedule(tiempo * 1, { position.goUp(1) }) @@ -25,13 +41,40 @@ object morcilla { game.schedule(tiempo * 3, { position.goUp(1) }) game.schedule(tiempo * 4, { position.goUp(1) }) - game.schedule(tiempo * 5, { position.goDown(1) }) - game.schedule(tiempo * 6, { position.goDown(1) }) - game.schedule(tiempo * 7, { position.goDown(1) }) - game.schedule(tiempo * 8, { position.goDown(1) }) - game.schedule(tiempo * 9, { position.goDown(1) }) + game.schedule(tiempo * 5, { saltando = false }) + game.schedule(tiempo * 5, { self.caer() }) + } + } + + method gravedad() { + if (position.y() > 2 && !saltando) { + // Está cayendo o saltando + position.goDown(1) + suspendido = true + } + else if (!saltando) { + // Ya cayó + game.removeTickEvent("gravedad") + suspendido = false + caerActivo = false + } + } - game.schedule(tiempo * 9.5, { saltando = false }) + method caer() { + if(!caerActivo && suspendido){ + game.onTick(100, "gravedad", {self.gravedad()}) + caerActivo = true } } + + method atacar() { + + } + + method posicionDeAtaque() { + movimientoActivo = false + position = new MutablePosition (x=16, y=2) + } + + method activarMovimiento() {movimientoActivo = true} } \ No newline at end of file