From acb0eb1a71c96fccebb9df9ccb3bfebc89fa980d Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Wed, 30 Dec 2020 15:19:53 -0500 Subject: [PATCH] Sakura mode beta --- load/graphics.lua | 12 ++ res/img/gem1.png | Bin 0 -> 462 bytes res/img/gem2.png | Bin 0 -> 388 bytes res/img/gem3.png | Bin 0 -> 445 bytes res/img/gem4.png | Bin 0 -> 426 bytes res/img/gem5.png | Bin 0 -> 376 bytes res/img/gem6.png | Bin 0 -> 377 bytes res/img/gem7.png | Bin 0 -> 399 bytes res/img/gem9.png | Bin 0 -> 354 bytes tetris/components/grid.lua | 20 +++ tetris/modes/sakura.lua | 350 +++++++++++++++++++++++++++++++++++++ 11 files changed, 382 insertions(+) create mode 100644 res/img/gem1.png create mode 100644 res/img/gem2.png create mode 100644 res/img/gem3.png create mode 100644 res/img/gem4.png create mode 100644 res/img/gem5.png create mode 100644 res/img/gem6.png create mode 100644 res/img/gem7.png create mode 100644 res/img/gem9.png create mode 100644 tetris/modes/sakura.lua diff --git a/load/graphics.lua b/load/graphics.lua index c12cac7..b527e0d 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -49,6 +49,18 @@ blocks = { F = love.graphics.newImage("res/img/bone.png"), A = love.graphics.newImage("res/img/bone.png"), X = love.graphics.newImage("res/img/bone.png"), + }, + ["gem"] = { + R = love.graphics.newImage("res/img/gem1.png"), + O = love.graphics.newImage("res/img/gem3.png"), + Y = love.graphics.newImage("res/img/gem7.png"), + G = love.graphics.newImage("res/img/gem6.png"), + C = love.graphics.newImage("res/img/gem2.png"), + B = love.graphics.newImage("res/img/gem4.png"), + M = love.graphics.newImage("res/img/gem5.png"), + F = love.graphics.newImage("res/img/gem9.png"), + A = love.graphics.newImage("res/img/gem9.png"), + X = love.graphics.newImage("res/img/gem9.png"), } } diff --git a/res/img/gem1.png b/res/img/gem1.png new file mode 100644 index 0000000000000000000000000000000000000000..04ea2a96860f7f165f3e98a1dcdc6e1b0636af5e GIT binary patch literal 462 zcmV;<0WtoGP)Px#1ZP1_K>z@;j|==^1poj5mQYMoMJyKrNFV`JDgtyn0)j&Vsa_73SOkwu17|S; z%ZEMvq*dRWTFQDP|H5zl(y#Wzp}cV#`|QvA^yv2Ax#_Zmo;Cr9DFFWd{_vTH)L}== zP9m{V0r~m&u7A^`PbM(IU1`g2l}6af8)Yj*=Oq`006@R0IdK3+93i1<&=8>000SaNLh0L01m?d01m?e$8V@)0002NNkllT6_5Jpi@$x@TN29yShiJDmN|8fnkntx}nZ;(6e`9a`&cn>%n5JC>2fBXp! zPf-*nwXxtgQwyRYq;!3HcHh!k(rdxy43?K0VadYJT0$v)%`fa%WRM} z^R_JO+G?p`V3D=vy*c_Q*ACnUWZP!w9jtMqw}H0y3+S8~W`=4$5dZ)H07*qoM6N<$ Ef}%gYWB>pF literal 0 HcmV?d00001 diff --git a/res/img/gem2.png b/res/img/gem2.png new file mode 100644 index 0000000000000000000000000000000000000000..9c0f35770e470cca8061e9a2770ca01485a84e7d GIT binary patch literal 388 zcmV-~0ek+5P)Px#1ZP1_K>z@;j|==^1poj5U{Fj{MFt=y0w+EON?#3IXb)+51~^3`hoMBG!)(*> zalX+FbdX20*Oub-!{_)dnYG;U`||PrlEdWr`SD0If+xK~yMH zJ%-#u0h<7aKUP zYxLr7Atp*Ci1Gx@)NlSL_#~yPx#1ZP1_K>z@;j|==^1poj5fly3TMJyKrIxGigF#>`^0+(0>k4ytpDgv8z6r+F? zf?*MKI|AH|KK`s@{=HoNq*cp@J>Q#J{L-)X-?{0sgr$rw`|QvA^ys{C8mV3m|H5zi z`SpkJ+;RfcX#)1cq3@6^<%0^lT>|r%M6prVGd006~FL_t(2Q$5bvl7k==MNtBR5mctgV2mMv zt@QtYV9@I7^R`#rhYQZ#AZjpzw=3!hZtwTDLzMh=$NFL9|3W$;m6H0=HkS}A!;6^$KK{?lx8f1Pjn4%T&qdF1xx)HY|LP@OlvJd z8vKx!xB-+cXW=LGUixG+0ubkYJ&rIAzGoIgQ0Nw`{Dzd+;%EVd&|Kwp9Q6-MDpWad n);(^uPbdYVyzd#oQcC#(ric?hOY|Hx00000NkvXXu0mjfGUB_o literal 0 HcmV?d00001 diff --git a/res/img/gem4.png b/res/img/gem4.png new file mode 100644 index 0000000000000000000000000000000000000000..88b0187081141bf8d597b3068a612cf2aca2075a GIT binary patch literal 426 zcmV;b0agBqP)Px#1ZP1_K>z@;j|==^1poj5eo#zQMFAKs0w+EJGHL@oga}il20xn}XtFJtwO*m~ zX|(-3e#k_k!;-_~z1jDs%K2J@{@n5V^6~z|=lFWP{r>*`jh*i)THXyj-U%p@OJe8w z`S%Vb;%m4@RvWiD z=M=2~v_;2F#%np6SBd`-XLhu&ow9p~^04U)V U7-tQSW&i*H07*qoM6N<$f}hf<$p8QV literal 0 HcmV?d00001 diff --git a/res/img/gem5.png b/res/img/gem5.png new file mode 100644 index 0000000000000000000000000000000000000000..701e49da649bab7c312c93d75415aaff1ba5284d GIT binary patch literal 376 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%LiU0G|+7Z3aCT29HpN=xm1KPR5DV3@x)I7q6Dz($3d^!1CmWu%BNO{$6#w z|6|g>Z##coD!ujl=HE{r|J`nTIFn(?x2%6au$A%9&!68fG2c7RaQUj@!{rQ{Kid4Q zs90kOw1Tt1BeIx*f$uN~Gak=hkpdK4<>}%Wq7kgyA1T(Nz{7Ib&p?N(`BcUKV!wnp z`>(8aU{7laiPF}*c0ll$Rr=mQeL=ayVizjEsvipW(M;P?WqBw-r`nT!*RGC|wQuIv zHl1^6Iv8(Vd23m>Z0<1G`t7%rOHA0gRhKqg{%w=&a2W3D{^I-J}_Sm=R9## S?2kIo)eN4lelF{r5}E){T%5}Q literal 0 HcmV?d00001 diff --git a/res/img/gem6.png b/res/img/gem6.png new file mode 100644 index 0000000000000000000000000000000000000000..7f16200596f66e7b304b68c1cc8523993e9eda0d GIT binary patch literal 377 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%Lhh0G|+7K}BX+D;CutCjAsv^AgU`N$NHY9C@3qCp-+Bak4}!ilyeT$ANeA zZ+xx5bVK@VGV$NQL;WJoof} zeR0rS)8}vBY;|S|pJLYGwmMRUYweN0okdS-6%0IL UoB7my5zx&Hp00i_>zopr0O;13{r~^~ literal 0 HcmV?d00001 diff --git a/res/img/gem7.png b/res/img/gem7.png new file mode 100644 index 0000000000000000000000000000000000000000..225a22a6c92cff7f76516da1cce6a7ae267bc9bd GIT binary patch literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%LiI0G|+74J9@!9rj>X?z{-T>KqYgE3VQwfr(8@OMCR<0(o{Wc71#->c!=< zvj?iWiiJ*W2>Et@=kGV?SIsp1{pH2apWm;XobvDAzvUewe=e=xF-!c#v->AEDjr-a zF}qY`af8T)ezB%R!8x8^}S z&0EAfwNUDHkKSfwhg}iNQao=|VZsw5YC~8>`^ZNS%G|y0G|+7B_$<&eSHrPkEp1q^t4nVmYOLRbiS~2n=kTL_1b#7dFdjDYTsMfESkUllIlT*+N>X9LR^Jv6D{1< zuYKxc-T2XB|Mu%XtM92W&%PG3cI_qqzD+_2%BH8b?pM!0TROokY29-luX7UD+^;M# yKe*|k{ift89H+VTJUz3!0uKDzzb!58A7kxt&b`GBS{y* 0 then + if self.stage_frames <= frameTime(0,10) then self.time_extend = 600 + elseif self.stage_frames <= frameTime(0,30) then self.time_extend = 300 + else self.time_extend = 0 end + end + + if not self.grid:hasGemBlocks() then + -- transition to next map + if self.cleared_frames > 0 then + self.cleared_frames = self.cleared_frames - 1 + if self.time_extend >= 0 then + self.time_limit = self.time_limit + 3 + self.time_extend = self.time_extend - 3 + end + return false + end + + self.hold_queue = nil + self.stage_frames = -1 + self.current_map = self.current_map + 1 + self.grid:clear() + if self.current_map >= 21 then + self.clear = true + self.completed = true + return false + else + self.ready_frames = 100 + self.grid:applyMap(maps[self.current_map]) + end + + -- this is necessary to fix timer + self.frames = self.frames - 1 + self.time_limit = self.time_limit + 1 + end + + self.frames = self.frames + 1 + self.stage_frames = self.stage_frames + 1 + self.time_limit = self.time_limit - 1 + if self.time_limit <= 0 then self.game_over = true end + else + self.cleared_frames = 300 + if not self.prev_inputs.hold and inputs.hold then + self.hold_queue = table.remove(self.next_queue, 1) + table.insert(self.next_queue, self:getNextPiece(ruleset)) + end + end + return true +end + +function SakuraGame:drawGrid() + self.grid:draw() + self:drawGhostPiece() +end + +function SakuraGame:drawScoringInfo() + love.graphics.setColor(1, 1, 1, 1) + + love.graphics.setFont(font_3x5_2) + love.graphics.print( + self.das.direction .. " " .. + self.das.frames .. " " .. + strTrueValues(self.prev_inputs) + ) + love.graphics.printf("NEXT", 64, 40, 40, "left") + love.graphics.printf("STAGE", 240, 120, 80, "left") + love.graphics.printf("TIME LIMIT", 240, 180, 80, "left") + love.graphics.printf("STAGE TIME", 240, 240, 80, "left") + + love.graphics.setFont(font_3x5_3) + love.graphics.setColor( + (self.time_limit % 4 < 2 and + self.time_limit <= frameTime(0,10) and + self.grid:hasGemBlocks() and + self.time_limit ~= 0) and + { 1, 0.3, 0.3, 1 } or + { 1, 1, 1, 1 } + ) + love.graphics.printf(formatTime(self.time_limit), 240, 200, 120, "left") + love.graphics.setColor(1, 1, 1, 1) + love.graphics.printf(formatTime(self.stage_frames), 240, 260, 120, "left") + + love.graphics.setFont(font_8x11) + love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center") + love.graphics.printf(self.current_map, 290, 110, 80, "left") +end + +function SakuraGame:drawCustom() + love.graphics.setColor(1, 1, 1, 1) + + if self.ready_frames ~= 0 and not self.clear then + love.graphics.setFont(font_3x5_4) + love.graphics.printf("STAGE " .. self.current_map, 64, 170, 160, "center") + end + + if self.cleared_frames > 0 and not self.grid:hasGemBlocks() then + love.graphics.setFont(font_3x5_2) + love.graphics.printf("TIME LIMIT", 64, 180, 160, "center") + love.graphics.printf("TIME EXTEND", 64, 240, 160, "center") + love.graphics.printf("STAGE TIME", 64, 300, 160, "center") + + love.graphics.setFont(font_3x5_3) + love.graphics.printf("STAGE " .. self.current_map, 64, 100, 160, "center") + love.graphics.setColor( + self.cleared_frames % 4 < 2 and + { 1, 1, 0.3, 1 } or + { 1, 1, 1, 1 } + ) + love.graphics.printf(formatTime(self.time_limit), 64, 200, 160, "center") + love.graphics.setColor(1, 1, 1, 1) + love.graphics.printf(formatTime(self.time_extend), 64, 260, 160, "center") + love.graphics.printf(formatTime(self.stage_frames), 64, 320, 160, "center") + + love.graphics.setFont(font_3x5_4) + love.graphics.printf("CLEAR!", 64, 130, 160, "center") + end + + if self.clear then + love.graphics.setFont(font_3x5_3) + love.graphics.printf("EXCELLENT!", 64, 180, 160, "center") + + love.graphics.setFont(font_3x5_2) + love.graphics.printf("...but let's go\nbetter next time", 64, 220, 160, "center") + end +end + +function SakuraGame:getBackground() + return (self.current_map - 1) % 20 +end + +function SakuraGame:getHighscoreData() + return { + map = self.current_map, + frames = self.frames, + } +end + +return SakuraGame \ No newline at end of file