From d9397c4bcb9faab3887dfe4f80b393ee5eff257d Mon Sep 17 00:00:00 2001 From: adrien Date: Mon, 30 Sep 2024 21:21:25 +0200 Subject: [PATCH] textured ghost --- images/sprites.png | Bin 792 -> 761 bytes jsm/Tetrominoes.js | 35 +++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/images/sprites.png b/images/sprites.png index 424448ab12069377a3501d32378d5b9598b245a4..edd7234ea8cd68171d94d093977f80ba901874c2 100644 GIT binary patch literal 761 zcmV4Tx04UFukxM8M5k`Lx#3uBf{Nqwjw-d@MpPF68%?Q2*Murfc*x8-dEo`&fwg>2 z@vd;lT+&m*XTm*>Tu}Hy=|+)X6=!@7sLYTv9Ul=632T`$HpKVk^69{@hc&Ft}*XOetMv2V;ygNem5xRhG$;CnBpYic4JfqZRz^zCR`|LtM+4 z;uvKG3*Gml{@{1FZo03xm=ugc?X%~-cR}4Y6t+C?>&Wv8$58zQmv+g&atMPTqHmS7 z@BuV$!1+~4Gj`x&6WShgx}*D2wah>|4R5FNO-X3IfyTLFZ$JB-+{3hVHE|7l`_P?{ z?D-1st}pNH&oh31M85%sN^-6tk{R^?000SaNLh0L04^c`04^c{s^Z;}0003TNklD$)1-=`puBBciuS$@?^jhtQ8Ekz#d)47O7c9X82f+U_Y`fGWl>Gj zP#$_eZSq|hi^JN6#W21@eXtltie@p46kV33$=;0PXtFSO6L(>ZTm!t6&y6#Poexp? z;bXx;2~3bikU;4ca6S7qwx}%2OcsU&+HSEhmxK6nveeEbbUvP==jytqwaY=Yjcgrn z4@!>qoFrD-zKaH|>q-|5M1ATU^A}^{Ve(5t0`2nSQU!b?`O1^`(;VE8mxmOc=HNz} rgAURhWRCWnBv#troP!r06H2`RWjog-SvIig00000NkvXXu0mjf2uWYL literal 792 zcmV+z1LypSP)EX>4Tx04R}tkv&MmKpe$iQ^gNjMC?#RBtvzwi;6hb zDionYs1;guFuC*#nlvOSE{=k0!NHHks)LKOt`4q(Aou~|?BJy6A|?JWDYS_7;J6>} z?mh0_0YbgZG^;BHXu55t5^*t;T@`y?(T6Yw5yYs>EMrcRlIS?T?&0I>U6f~aKKJJc zsyT}RK9M-a4AUmwAfDN@4bJ<-Ay$-C;&b8&lP*a7$aTfzH_io@1)do))2Vsl5V2Tj zW2KE*(bR~ii6g3}Q@)V#SmnIMSu0mr^Pc>Lft z#tGnm2Cnp$zfuQgKS{5(w8#-Kunk;Xw=`uBxZDB4PljyDuH>gFe zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{007`gL_t(Y$K_SQ4TCTYJWzOK zD^@@ZKo?*d7U(O#$SY(k9!6?Ebw%9-Ooh}3_e)N3d_KpioO2Ic7!ClYX}aaeaUAb2 z{=Jt{Lff{&L-Xo90HE*tEFWV80L=58<-PZ&^C5&Uj+rqG!)|`gS}74O;!{dlv4Ya2 zC5TvoE{cd1=%RF8_pv4-)4jDdK@nbBOVTAb&%j=MA_5V?dk<#LI mino.offset = piece.offset) + this.children.forEach(mino => {mino.offset = piece.ghostOffset}) this.facing = piece.facing this.visible = true while (this.canMove(TRANSLATION.DOWN)) this.position.y-- @@ -319,7 +320,6 @@ Ghost.prototype.freeColor = new THREE.Color(COLORS.GHOST) Ghost.prototype.minoesPosition = [ [P(0, 0, 0), P(0, 0, 0), P(0, 0, 0), P(0, 0, 0)], ] -Ghost.prototype.offset = 0 class I extends Tetromino { } @@ -336,7 +336,8 @@ I.prototype.srs = [ { [ROTATION.CW]: [P(0, 0), P(1, 0), P(-2, 0), P(1, -2), P(-2, 1)], [ROTATION.CCW]: [P(0, 0), P(-2, 0), P(1, 0), P(-2, -1), P(1, 2)] }, ] I.prototype.freeColor = new THREE.Color(COLORS.I) -I.prototype.offset = 1 +I.prototype.offset = P(0, 1) +I.prototype.ghostOffset = P(0, 0) class J extends Tetromino { } J.prototype.minoesPosition = [ @@ -346,7 +347,8 @@ J.prototype.minoesPosition = [ [P(0, 1), P(-1, -1), P(0, 0), P(0, -1)], ] J.prototype.freeColor = new THREE.Color(COLORS.J) -J.prototype.offset = 2 +J.prototype.offset = P(1, 1) +J.prototype.ghostOffset = P(1, 0) class L extends Tetromino { } @@ -357,7 +359,8 @@ L.prototype.minoesPosition = [ [P(0, 1), P(0, 0), P(0, -1), P(-1, 1)], ] L.prototype.freeColor = new THREE.Color(COLORS.L) -L.prototype.offset = 3 +L.prototype.offset = P(2, 1) +L.prototype.ghostOffset = P(2, 0) class O extends Tetromino { } O.prototype.minoesPosition = [ @@ -367,7 +370,8 @@ O.prototype.srs = [ { [ROTATION.CW]: [], [ROTATION.CCW]: [] } ] O.prototype.freeColor = new THREE.Color(COLORS.O) -O.prototype.offset = 4 +O.prototype.offset = P(3, 1) +O.prototype.ghostOffset = P(3, 0) class S extends Tetromino { } S.prototype.minoesPosition = [ @@ -377,7 +381,8 @@ S.prototype.minoesPosition = [ [P(-1, 1), P(0, 0), P(-1, 0), P(0, -1)], ] S.prototype.freeColor = new THREE.Color(COLORS.S) -S.prototype.offset = 5 +S.prototype.offset = P(4, 1) +S.prototype.ghostOffset = P(4, 0) class T extends Tetromino { get tSpin() { @@ -405,7 +410,8 @@ T.prototype.tSlots = [ [P(-1, -1), P(-1, 1), P(1, 1), P(1, -1)], ] T.prototype.freeColor = new THREE.Color(COLORS.T) -T.prototype.offset = 6 +T.prototype.offset = P(5, 1) +T.prototype.ghostOffset = P(5, 0) class Z extends Tetromino { } Z.prototype.minoesPosition = [ @@ -415,7 +421,8 @@ Z.prototype.minoesPosition = [ [P(0, 1), P(-1, 0), P(0, 0), P(-1, -1)] ] Z.prototype.freeColor = new THREE.Color(COLORS.Z) -Z.prototype.offset = 7 +Z.prototype.offset = P(6, 1) +Z.prototype.ghostOffset = P(6, 0) class Playfield extends THREE.Group {