From e41a42fda4e890b37d7b854b5d57f64ff965f5f8 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Fri, 4 Mar 2022 14:34:54 +0100 Subject: [PATCH] Added ending screen --- assets/text/win/blue.png | Bin 0 -> 1742 bytes assets/text/win/pink.png | Bin 0 -> 1726 bytes game.lua | 1 + objects/end.lua | 22 ++++++++++++++++++++++ objects/grid.lua | 2 +- scenes.lua | 6 ++++++ 6 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 assets/text/win/blue.png create mode 100644 assets/text/win/pink.png create mode 100644 objects/end.lua diff --git a/assets/text/win/blue.png b/assets/text/win/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..ac1eb16789fe914d8bc5b235686e9101bbb807d2 GIT binary patch literal 1742 zcmV;<1~K`GP)U90004lX+uL$Nkc;* zaB^>EX>4Tx04R}tkv&MmKpe$i(~2T34rUN>$WWbH5EXIMDionYs1;guFuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=;Wm6A|?JWEwqU7;J6>}?mh0_0Yam~bUQQ-=!RpZ zlL;xCTa|iW5kv?Ph=?i7Hs@qH1>f;?j{slq;yla$+@B+&uQVNI2Sz@c&2D&((}Y3u~h70wToHF(ut>tqnd6|zL0IP z#(9ggUa7J6J^2g6d1Gan>oiA@#3Gg;LxPGL%Ba9WoK}Mr8)@24`1prCzf3NbTxBqF zET9SgQYP(!T%000JJOGiWi`vAKDt*6TrmjD0&32;bRa{vG? zBLDy{BLR4&KXw2B00(qQO+^Rh0|X5k2jZGTlK=n!8FWQhbVF}#ZDnqB07G(RVRU6= zAa`kWXdp*PO;A^X4i^9b1gA+vK~#9!?Oi#N+b|F`S^S8z-NaS<75~AZf1uDmP`H2a zS5&1$%KVgd#40YAB#!Ah0Cq<{L=G@B98R|YX!u4D#3}Il^7c`4-Q#&1=06W~BSElO zjl$NJVyz~ zspU&0fst~qC>jXzo-KAxXiW<3Pfwq=6wj%aB%|8Vy>L()6cwv1l=#lT`)X(-}z!=>@b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`TWub7{#dRC{|# z7Kj=TQbunvTg~{1Qo|a(HOQil(o=gQC5!YLM2&0f{vK+0VHt)6gQZh>(H)o)L!4(K5y$b&>H@1{__?;tunLJzI%pILle0sg6JK{n$+6$lf;1T zX~{DYi>mj6qcxws@jQBWF85|ISrB&pmmbk4_Lc;_7e!hlx4xIJ)%enTb9MeZIlj=`MlqFZQtz!;p09)AOs#eFq-F)5c{d9oC>6GYmTDSl{rp zal)KoXzvx62LpQTdsOW0HIP0(0lkidXPnvs)xV>qhD&WptbOl^f+LuQr#@soLAMV} zemkwz4Nw}c<`gOP+V_@V^DK*`&QFl=zeSRW_Nj?*HH;;Vwb%!e{sy`B{p`+0v{lmo zJ;GZbqW5A=bI{Cmwzif~s<~@BvUTk{x`tq_xh2m}K=|Jp)@QOti=U(I8P{eSqCd?| z|J(a7Li|j*nMNxxqrVcAsG(RUjox0-TKg~Bc{1Efa&iqz#PVNy{)B6WLD&VF_q_|P z>vCFaFw)q%r7M0Up0SeLP-;U(;QuNinRK9gY( z*?_eeNK2dA-(lgKA|S)ies3&&zCmyHYm>&_x(xL5h;cRRBQIdvqd|2DF@*jFUT`rf)KV@_3 U;pVJ6g8%>k07*qoM6N<$f{K(%E&u=k literal 0 HcmV?d00001 diff --git a/game.lua b/game.lua index 94edad8..c15b7e4 100644 --- a/game.lua +++ b/game.lua @@ -9,6 +9,7 @@ function Game:reinit() self.objects.base = require "objects/base" self.objects.grid = require "objects/grid" self.objects.circle = require "objects/circle" + self.objects.ending = require "objects/end" self.rect = require "lib/rect" self.maxobjects = 0 self.camerax = 0 diff --git a/objects/end.lua b/objects/end.lua new file mode 100644 index 0000000..4b351c8 --- /dev/null +++ b/objects/end.lua @@ -0,0 +1,22 @@ +local gen= {} + +function gen:new(game,winner) + + local End = game.objects.base:new(game,0,0,0,0) + End.sprite = game:newImage("text/win/"..winner..".png") + End:register("End") + + function End:step(dt) end + + function End:draw() + lg.draw(self.sprite,(self.game.WIDTH-self.sprite:getWidth())/2,(self.game.HEIGHT-self.sprite:getHeight())/2) + end + + function End:MouseCallback(x,y) + self.game.scenes:main(game) + end + + return End +end + +return gen diff --git a/objects/grid.lua b/objects/grid.lua index 71dfca3..3a6479b 100644 --- a/objects/grid.lua +++ b/objects/grid.lua @@ -62,7 +62,7 @@ function gridgen:new(game,x,y,cellsize) function Grid:endgame(winner) print(winner.." won !") - self.game.scenes:main(self.game) + self.game.scenes:ending(self.game,winner) end function Grid:draw() diff --git a/scenes.lua b/scenes.lua index eaaa169..486523f 100644 --- a/scenes.lua +++ b/scenes.lua @@ -9,4 +9,10 @@ function scenes:main(game) game:summon(grid) end +function scenes:ending(game,winner) + game.gameloop = {} + local ending = game.objects.ending:new(game,winner) + game:summon(ending) +end + return scenes