From b4ea49bee8686f9ca1822b34e0c8366c90c28689 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Wed, 9 Mar 2022 22:02:00 +0100 Subject: [PATCH] Added arrows to show which player should play --- assets/arrows/blue.png | Bin 0 -> 828 bytes assets/arrows/pink.png | Bin 0 -> 9139 bytes objects/grid.lua | 49 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 assets/arrows/blue.png create mode 100644 assets/arrows/pink.png diff --git a/assets/arrows/blue.png b/assets/arrows/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..b59abba1cec79b943af1a5b5bc668117eebdd50e GIT binary patch literal 828 zcmV-C1H=4@P)EX>4Tx04R}tkv&MmKpe$iQ^gM|4(%Y~kf92K1yK=4twIqhgj%6h2a`*`ph-iL z;^HW{799LotU9+0Yt2!bCVj!sUBE>hzEl0u6Z503ls?%w0>9U#=pOtU)10Zq5f zR3a{Bva4d(D}v}j7^4Wu%rfRADGA^4b&mjF?_xa5|JTxwGo6|zju4B5Hdfl06-|wJia4rjI^_!) zk5$fFoV9Y5HSft^7|Q7@%Uq{9gaj6`1PLM(R8c}1He$5uq*zGNe%!}D==vpcDdZ}F zkz)ZBXpmh$_#gc4*2+&#cuAo+(D~vxAHzV`F3_ks&iAq7G){ovGjOH1{FOQ|^GSNG zrA3c`{%zpmx}_<5z~v4w@MOrQ>`FnJLOu_?pV2pEf$%NRyXN)Q+{ftykfyGZH^9Lm zFjAoGb)R>4xA*q%nPz`KK^=0FB4sbB00006VoOIv07?LQ0G6u?AYcFh010qNS#tmY zE+YT{E+YYWr9XB6000McNliru<^u^6EFSAWEP((302y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{009(9L_t(o!|mD44Z<)C1z;R?5pM0VtFQx8u>-4cgd3xj zQ>7{j#Xm1j0Q*W6zD8;4zR&?w(>O1CzuzA>Li`VTV3BA-VvnbD@tWuL0z*@6EE-K7 zSR^`Gmjo9py|x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cZLu#EhFK$aLhfn144oHEjqe+Y6kEC_NkWMPpDCD@F)Plk>_!F11|p_6m2Ylj0iZY_&;ji4CDR#?)MaM#~wEU0LNvE zK%#$lLO}XrerrJX``v_gL3%i2$n*P;g8I{r{a*$P10gGmhC@K)T;)MfM<*E&N)96n zl0|~i7&t~2f|mZB#$W6NPbZ=u5|2@FCTB{{hFn0$*#Jb3r4&0(`Y*Jf3+6~CY4Y5b zhJd8y&A~DVC=>ycy(le%kd_8Y{gJTL(X9S6YULIfDPo-ydV~f7t~9@NXyoNZ)_u`d6-hq`*G{|65)E%Jq*F_($M>tLy)pTnztt z;lX&2pMw0zuQPEMPwSIkg=kTFTIv+K6oC}!5?#ojehrMRLRomppl>?r zD(2ShE2AQXt@!w^qeopfTfzN{5t#gb&Ns@1vUS|dtnQ3_4%Qd> z?pZVPOrPZGI zzWDfrTg=aAtQodWPk9Txw(fg%#f3((9tkduT;Gj F_CHt4m=pj2 literal 0 HcmV?d00001 diff --git a/objects/grid.lua b/objects/grid.lua index 493ca45..0250206 100644 --- a/objects/grid.lua +++ b/objects/grid.lua @@ -7,6 +7,12 @@ function gridgen:new(game,x,y,cellsize) Grid.sprites = {game:newImage("grid/tile.png"),game:newImage("grid/pink.png"),game:newImage("grid/blue.png")} Grid.pinkturn = game:newImage("text/turn/pink.png") Grid.blueturn = game:newImage("text/turn/blue.png") + Grid.bluearrows = game:Timer(1) + Grid.pinkarrows = game:Timer(1) + Grid.bluearrows.loops = -1 + Grid.pinkarrows.loops = 1 + Grid.bluearrowsprite = game:newImage("arrows/blue.png") + Grid.pinkarrowsprite = game:newImage("arrows/pink.png") Grid:register("Grid") Grid.depth = -1 Grid.turn= 3 @@ -35,11 +41,25 @@ function gridgen:new(game,x,y,cellsize) if winner~="None" then self:endgame(winner) end + + if self.pinkarrows.loops<1 then self.pinkarrows:tick(dt) end + if self.bluearrows.loops<1 then self.bluearrows:tick(dt) end end function Grid:addturn() + local pastturn = self.turn self.turn = self.turn + 1 self.turn = self.turn%4 + -- Check for arrow animation + if math.floor(pastturn/2)%2~=math.floor(self.turn/2)%2 then + if self.turn<2 then + -- Trigger pink arrows + self.pinkarrows.loops = 0 + else + -- Trigger blue arrows + self.bluearrows.loops = 0 + end + end -- Check if a move can be made local color = "blue" if self.turn%2==1 then @@ -49,8 +69,7 @@ function gridgen:new(game,x,y,cellsize) end local count = 0 local i - local obj = self.game:findName(color) - for i=1,#obj do + local obj = self.game:findName(color) for i=1,#obj do count = count + #obj[i]:findAvailableMoves() end if count==0 then @@ -86,6 +105,32 @@ function gridgen:new(game,x,y,cellsize) -- Draw "Blue's turn" lg.draw(self.blueturn,(self.game.WIDTH-self.blueturn:getWidth())/2,self.game.HEIGHT-self.blueturn:getHeight()) end + + -- Draw arrows + local i=0 + local margin = 50 + for i=0,1 do + local offx = margin + if i==1 then offx = game.WIDTH-margin-self.pinkarrowsprite:getWidth() end + + -- Draw pink arrows + if self.pinkarrows.loops==0 then + local offy = -margin + local movement = (game.HEIGHT+margin*2)*self:easing(self.pinkarrows:getratio()) + lg.draw(self.pinkarrowsprite,offx,offy+movement) + end + + if self.bluearrows.loops==0 then + local offy = game.HEIGHT+margin + local movement = -(game.HEIGHT+margin*2)*self:easing(self.bluearrows:getratio()) + lg.draw(self.bluearrowsprite,offx,offy+movement) + end + + end + end + + function Grid:easing(x) + return 1-(1-x)*(1-x) end return Grid