From 7b7fe476ca8e6217dbc8d029aec2f9603d4bfd7f Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 1 Jul 2021 21:08:19 +0000 Subject: [PATCH] Ir convirtiendo a parque publico mientras pasa el juego --- src/assets.ts | 12 ++++++++-- src/assets/Cielo.png | Bin 0 -> 3718 bytes src/assets/Parque publico con rio.png | Bin 0 -> 2146 bytes src/assets/Parque publico.png | Bin 0 -> 1729 bytes src/assets/Rio.png | Bin 0 -> 528 bytes src/jugando.ts | 32 ++++++++++++++++++++++---- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 src/assets/Cielo.png create mode 100644 src/assets/Parque publico con rio.png create mode 100644 src/assets/Parque publico.png create mode 100644 src/assets/Rio.png diff --git a/src/assets.ts b/src/assets.ts index 0a4f886..fbddd16 100644 --- a/src/assets.ts +++ b/src/assets.ts @@ -1,7 +1,11 @@ import botonJugarImg from "./assets/boton_jugar.png"; import larretaImg from "./assets/Larreta.png"; import millonarioMaloPng from "./assets/Millonario Malo.png"; -import fondoImg from "./assets/CieloRioCalle.png"; +import cieloRioCalleImg from "./assets/CieloRioCalle.png"; +import cieloImg from "./assets/Cielo.png"; +import rioImg from "./assets/Rio.png"; +import parquePublicoRioImg from "./assets/Parque publico con rio.png"; +import parquePublicoImg from "./assets/Parque publico.png"; import edificiosImg from "./assets/Edificios.png"; import jugadorxImg from "./assets/ProtagonistaCorriendo_1.png"; import baldosaImg from "./assets/Baldosa.png"; @@ -22,7 +26,11 @@ export const assetUrls = { botonJugar: botonJugarImg, larreta: larretaImg, millonarioMalo: millonarioMaloPng, - fondo: fondoImg, + cieloRioCalle: cieloRioCalleImg, + cielo: cieloImg, + rio: rioImg, + parquePublicoRio: parquePublicoRioImg, + parquePublico: parquePublicoImg, edificios: edificiosImg, jugadorx: jugadorxImg, baldosa: baldosaImg, diff --git a/src/assets/Cielo.png b/src/assets/Cielo.png new file mode 100644 index 0000000000000000000000000000000000000000..0078f04bb37e7bb05639bce217fe0857cec8aef8 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z_7xc#bl*kDsl$yVI9}`;!TNBS`MX0J&GgwL zdTGrJT`xOy>R)8}{Fp%SKgYIgx79(lB{DwU((WFO{D&GJFd3 zer0NXI}v$i@=VQo;W3fl_;1peg=i6cJ#w+Jp&&3aBSwWkf;9*VG24zgH)h*d1pDVo zC73T)*%QwGwgMBf$`kOOeb6f)s@nukPbYLVTNYl}R8nnqcW22-6i=gCeLdZc0%vGs z2tbQSIUQ~bhD@lAJAeyWD~EgD$IgYX>^S4g&_>XtK!#o@Y(J(EQ#{il8i>K8!(#M~3nH74F=*b$lU2v^@o3h^VY%Bz*cCgAS0#+ZVF?pUD^rI=jO~Hj~&1ns?XpAYS(Is2Jf1%X6(Qp9a zrmA_-Tfl~T#!=N4EgF*Xm4QBue%a8cSYjgJAU+3TF$TaW{U||_V|f}=e!EN6E4gl8Xv^5puef=K*@AFOo literal 0 HcmV?d00001 diff --git a/src/assets/Parque publico.png b/src/assets/Parque publico.png new file mode 100644 index 0000000000000000000000000000000000000000..ea00b916e65ca9cb8030b264df9323c49254128b GIT binary patch literal 1729 zcmbtV`8V5%7XRA!p`mE$Lj)}i71JT8s#@DhDi0Y=#1=tGtx*|bX|1WzmsnG#C~7RR zS5zp~bP}p`^k|V*!8fI9>o@OweK+0QMbNW1l5JBIU3WAz zWD~6u_ds6_@kPqHijSMQf~t-hg}cRA--KO-I-#?t`8;lj7sNp2YP5NWn-Y zOZ^a)b`=jceqmvK)Me;kz$){~v6~Yz&Yq;#8&s4ZQ8_g^;rutTfz-~p&0lMgGdkv$ znd1geGad+1W500i_7AJ-b;{&rU&RK<>?2cIGuChGIf7eut^UjXUfzTnBai)o;U3X9Lx#(^23zfbx6;qfYDC zxUY*kUqwU9Q#@vL0JkF5YL1a^?QQXAJ1Z6A*eDZ(Sob}+A;(ArnSB%| z%vp}I8hA%Q=J6pQv%>Q5u%NRD>tcHYk{LNC`GxLSWpEOI?$)1R>3go!tJ(_ux(NNL zv5zfns9q?OL*hd(mgv^-Y$iiIRrfEPhz74y-)J;X<&xm8W0&NNRh5kmh>) zb!)vA1!S!)N!SgI2_W_I36MH(blRfbESbI>Prxr5qjQi?((E&S96ZFDc2i{PZzPxD zCk|ndJ;AQFKs9V})~3V{AEeqT%AXWzL*#4hucs^whxfu5^BYkAFS4_macLqb2t|{+ zyau98|91@jE$s0A6Z-JuB6ot)WPjYr!K2Zw5K4xBT4C{@;2)Zuo~r@}%X8?yG=WSf zlh$_$r{`d`Zuzh-=`ZN|loF0^fV=KOi>R2s-3TO}G0-I%;`zW`5`iYw6Ov$U(b$Nn@eL zejz=gty{y+!~*UE2jG`>e^wpuNa7bRKPRo9^to0(QzZiV*l()LPE+^ypqwn9D#>&N zx~*`YyzU&J2qG3gBa^;gcvM9_kAOmhb^6!Xp$blI<8sg;+=YxwT;hvf}9@3rxC zwlZrQ$Jy3nb#1{+OZiGcBOkr#rI1lc!KC6>=ezxD(_FMmU*RLG#i&bL~GTCF=V)OX90|ken97 eRqFptcg`Ei-QU?M`5gWL literal 0 HcmV?d00001 diff --git a/src/assets/Rio.png b/src/assets/Rio.png new file mode 100644 index 0000000000000000000000000000000000000000..f80676c43e370f40e808c2875d0bda3a69f7feca GIT binary patch literal 528 zcmeAS@N?(olHy`uVBq!ia0vp^n}9flgAGV3z0HbZU|_uN>EaktG3V_y!#v?Yfrf{b zbCfL^geGQq99PwFxT9R8a!GNihs#+}ftV&c(IBO#4Bu?!uIiOt`(`D$VRq&H@T1ex z?_2y!&1V4`Nf=z%5tQBgS-$-1tG}y_z8ZZ9N&WbDTN(eZ8K+;m_C8+R@igo4*00Yt z)o;-KS5y_4y#34P;u{OE{_LHgth8=_O}B-eR9w=|uBzh5UEC%9{EzN0ZT;Et_W$nZ zU*zV!{Nr}wwcz|cbvMu7|F`S?|G1h8>mC2r?L7FWNVI!%zyJLCpMMHoet+S^Pt|)h zzdrZwdG7T0sGN?`wgWe$ElcXIJ$Lun@BH}r^osALkFPzt;9AA5_rd?!^}04S%lb6y zEq^4ZOg?YF{a#EtGr#`6f1>wqexJ2*e&_LX{b&EZ|NMNHbN2j$3QuzNZ*4tuqiF5f z^NHn#;Q2EX@aNYi6sgtK>|ja f95Y3zC)|4fgreh=&GDi}pg8e#^>bP0l+XkK`Kjlq literal 0 HcmV?d00001 diff --git a/src/jugando.ts b/src/jugando.ts index 8a06d4e..34f5705 100644 --- a/src/jugando.ts +++ b/src/jugando.ts @@ -182,10 +182,14 @@ function drawBackground( y: number, height: number, img: HTMLImageElement, - sourceBox?: Box + sourceBox?: Box, + opacity?: number ) { const aspect = img.width / img.height; const width = height * aspect; + if (opacity !== undefined) { + juego.ctx.globalAlpha = opacity; + } for (let i = 0; i < 10; i++) { if (sourceBox) { juego.ctx.drawImage( @@ -194,7 +198,7 @@ function drawBackground( sourceBox.y, sourceBox.width, sourceBox.height, - i * (width - 1) + juego.state.view.x, + i * (width - (opacity === undefined ? 1 : 0)) + juego.state.view.x, y, width, height @@ -202,17 +206,20 @@ function drawBackground( } else { juego.ctx.drawImage( img, - i * (width - 1) + juego.state.view.x, + i * (width - (opacity === undefined ? 1 : 0)) + juego.state.view.x, y, width, height ); } } + if (opacity !== undefined) { + juego.ctx.globalAlpha = 1; + } } export function draw(juego: Juego, timestamp: number) { - drawBackground(juego, 0, juego.canvas.height, juego.assets.fondo); + drawBackground(juego, 0, juego.canvas.height, juego.assets.cieloRioCalle); drawBackground(juego, 0, getFloorY(juego), juego.assets.edificios, { x: 0, y: 0, @@ -220,6 +227,23 @@ export function draw(juego: Juego, timestamp: number) { height: 48, }); + drawBackground( + juego, + 0, + juego.canvas.height, + juego.assets.cielo, + undefined, + juego.state.trees.length / TREES_TO_WIN + ); + drawBackground( + juego, + 0, + juego.canvas.height, + juego.assets.parquePublicoRio, + undefined, + juego.state.trees.length / TREES_TO_WIN + ); + drawTrees(juego); drawEnemies(juego);