From 62e1bf4994c3e41ef3436a14761e84d8f18fdd7f Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sat, 11 May 2024 03:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=90=BC=E6=99=B6=E5=9E=83=E5=9C=BE=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=AE=97=E6=B3=95=E6=94=B9=E4=B8=BA=E4=BC=98=E5=85=88?= =?UTF-8?q?=E6=AF=8F=E5=88=97=E5=B9=B3=E5=9D=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/game/gelaPlayer.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/assets/game/gelaPlayer.lua b/assets/game/gelaPlayer.lua index bbaf815a..3385c061 100644 --- a/assets/game/gelaPlayer.lua +++ b/assets/game/gelaPlayer.lua @@ -869,14 +869,26 @@ end function GP:dropGarbage(count) local F=self.field local w=self.settings.fieldW - for _=1,count do - local x=self:random(w) - local y=self.settings.spawnH+1 - while F:getCell(x,y) do y=y+1 end + local curGenY=self.settings.spawnH+1 + while count>=w do + for x=1,w do F:setCell({ color=555, diggable=true, - },x,y) + },x,curGenY) + end + curGenY=curGenY+1 + count=count-w + end + if count>0 then + local pos={} + for x=1,w do pos[x]=x end + for n=1,count do + F:setCell({ + color=555, + diggable=true, + },table.remove(pos,GP:random(w+1-n)),curGenY) + end end end function GP:changeFieldWidth(w,origPos)