From 454d5dba79fa50730987cf786ce9d838d6f413fd Mon Sep 17 00:00:00 2001 From: Brisa Aylen Brussa Date: Sun, 13 Oct 2024 11:31:35 -0300 Subject: [PATCH] mejoras --- assets/goku.png | Bin 4072 -> 0 bytes assets/goku2.png | Bin 0 -> 3589 bytes example.wlk => jugador.wlk | 11 ++------- mainExample.wpgm | 49 ++++--------------------------------- puntos.wlk | 42 +++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 53 deletions(-) delete mode 100644 assets/goku.png create mode 100644 assets/goku2.png rename example.wlk => jugador.wlk (74%) create mode 100644 puntos.wlk diff --git a/assets/goku.png b/assets/goku.png deleted file mode 100644 index 70c82c449e2e8c92e9d2164d59b9191f7958bb5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4072 zcmVP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf00v@9M??Vs0RI60 zpuMM)0000IbVXQnMOaBjI!|(GWo~p~bZKvH05ODE?C$^o4^2r#K~!i%y;=!)RMpvj zXG;QsBp^|Vg84xZf?)~B79b%Z6bK>#w1@?)t>S`Up=z~)zqIoB|7{-yiVJEBwd@1} z0RjoxOaciAY6TIHf`XzYkd2VcWM*#P@7#MclQ6*r+V^?B+;h%7_nhy3=UeZ@q7nEH z;rQ|6xZ{pHa4lO{jq86D!NI{st0{tlf{a$n_^&YNbmqWfu_*FKLqo$AW6kkjVGx@} z^O*NR+tdCEhP2)Kn8)KWMw;T9b#TUv88~z1jM4KUKR@56gBk6CaqEE#M^JFsjh9~D zuI3aJ6u`Z?9qf}T;C8!Vv)RCV$`_I3xppeK{E%%K-_#a)`&4{;I7{d_l3X0O})DU_w3-2ryHHC<3}5bHLZfmJs8K|o(vrPqcPeH zp;5rdo$zjHXABVACjpMOfJdYF+GETgKUKq`i()Km*REB46F-PS9xvLo4u&_Q9lXwL zQVzOz?*x3iAJ};xJlpSsH8`aySqHWa^cGDh0VWd1231V<2=Vbo8bs@z_EQ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QlA6qW}UiA&F7^PE%wZeF;L zmxk=6T}Qx52hIUuDo82Cbree7fXSD&A{ZIgz}$6#l+1c^N-YRM9c) zgP|)%KJSD*`^POD+f>Ma2N%;N!Di9z-KlD@8qZo3APMa|G35_$;&KaFCxK06g-W%_vPnY@3nOC!nd()Obvqqli zgf)AD8H}#$GBp!!8{y&B+%HJ$^aW?XJw)}yyaz_sj9=>t{rK!=FqCg zIOgR*mDEDk$@b~6zP*mY$;1y3b z)9#f52+-gOX;_EoR**Ibo+}8RMfU0j`MqF5Us$_8c=qXSCYW4NfJ%eVw9chN*N(99 zZ$V!2RnX@uxV|HN?$7FM0YfJuUG`mFfCP4YpmF1EHlMC^Y%8iYq)rCoDFd(9i(wd; zwvREH!EmY+WDSAz`A+ftW-qu}FP4;2GA!e6p3i)p!Tvj&gWp5{e0Bb2NE-d%s5Hk> zXDtAwn#f&QQc6i$#tiwad#Vi2m?41l?AbF?Y?bc4)8)FJL#5L{4VSs?uWfPLc}1o; zG3h$#l{$)-f855s$r)Fo$pBqB8w{bH+ui_B2M!##?6xj@&VPB|l6vov_oJ+oz+L}`r ztmJ8^!Rx6-0hPLeijJd;5f#x6FWV2MZ(2_Bkwa{rcqgeD124J00L5`hOp6QL7fVV? zN&xK72B?&hhuQK}uD})W&$dCOlpO5Q zhqEEKpf-?p5n~zVNh3B_w(0?QmW}8x~^aGKk57(=>pLPnBl?}00000 LNkvXXu0mjf(oo=G literal 0 HcmV?d00001 diff --git a/example.wlk b/jugador.wlk similarity index 74% rename from example.wlk rename to jugador.wlk index 2d13d00..e988d3c 100644 --- a/example.wlk +++ b/jugador.wlk @@ -14,15 +14,8 @@ object helado { position = game.at(posicion.x(), posicion.y()) } } -/* - method mover(){ - keyboard.w().onPressDo {position.up(2)} - keyboard.a().onPressDo {position.left(2)} - keyboard.s().onPressDo {position.down(2)} - keyboard.d().onPressDo {position.right(2)} - } -*/ - method image() = "goku.png" + + method image() = "goku2.png" method recolectar(fruta){ game.removeVisual(fruta) diff --git a/mainExample.wpgm b/mainExample.wpgm index 50470db..5f5fed1 100644 --- a/mainExample.wpgm +++ b/mainExample.wpgm @@ -1,49 +1,10 @@ import wollok.game.* -import example.* +import jugador.* import muros.* -object posicionAleatoria { - method generarPosX() = 1.randomUpTo(39).truncate(0) - method generarPosY() = 1.randomUpTo(20).truncate(0) - - method generarPosicionAleatoria(){ - const x = self.generarPosX() - const y = self.generarPosY() - - if(escenario.mismaPosicion(game.at(x, y))){ - return self.generarPosicionAleatoria() - } - escenario.enlistarObjeto(game.at(x, y)) - return game.at(x, y) - } -} - -class Fruta{ - var property position = posicionAleatoria.generarPosicionAleatoria() - - method image(){ - if(points.frutasObtenidas() < 10){ - return "banana.png" - }if(points.frutasObtenidas() < 20){ - return "uva2.png" - } - return "sandia.png" - } - - method esFruta() = true - method dibujar(){ - game.addVisual(self) - } -} - -object juego{ - const frutas = [new Fruta(), new Fruta(),new Fruta(),new Fruta(),new Fruta(),new Fruta(),new Fruta(),new Fruta(),new Fruta(),new Fruta()] - method dibujarFrutas(){ - frutas.forEach({fruta_n => fruta_n.dibujar()}) - } -} +import puntos.* object fondo_de_pausa{ var property position = game.origin() @@ -65,7 +26,7 @@ program BadIceCreamGame { //dibujar escenario escenario.generarEscenario() //dibujar frutas - juego.dibujarFrutas() + spawn.dibujarFrutas() //dibujar puntos game.addVisual(points) //dibujar helado @@ -80,10 +41,10 @@ program BadIceCreamGame { points.sumarFrutas() } if(points.frutasObtenidas() == 10){ - juego.dibujarFrutas() + spawn.dibujarFrutas() } if(points.frutasObtenidas()==20){ - juego.dibujarFrutas() + spawn.dibujarFrutas() } if(points.frutasObtenidas() == 30){ game.removeVisual(helado) diff --git a/puntos.wlk b/puntos.wlk new file mode 100644 index 0000000..2a079bb --- /dev/null +++ b/puntos.wlk @@ -0,0 +1,42 @@ +import jugador.* +import muros.* +class Fruta{ + var property position = posicionAleatoria.generarPosicionAleatoria() + + method image(){ + if(points.frutasObtenidas() < 10){ + return "banana.png" + }if(points.frutasObtenidas() < 20){ + return "uva2.png" + } + return "sandia.png" + } + + method esFruta() = true + method ubicarYDibujar(posicion){ + self.position(posicion) + game.addVisual(self) + } +} + +object spawn{ + method dibujarFrutas(){ + (0..9).forEach({x => new Fruta().ubicarYDibujar(posicionAleatoria.generarPosicionAleatoria())}) + } +} + +object posicionAleatoria { + method generarPosX() = 1.randomUpTo(game.width() - 1).truncate(0) + method generarPosY() = 1.randomUpTo(game.height() - 1).truncate(0) + + method generarPosicionAleatoria(){ + const x = self.generarPosX() + const y = self.generarPosY() + + if(escenario.mismaPosicion(game.at(x, y))){ + return self.generarPosicionAleatoria() + } + escenario.enlistarObjeto(game.at(x, y)) + return game.at(x, y) + } +} \ No newline at end of file