diff --git a/assets/text/win/blue.png b/assets/text/win/blue.png new file mode 100644 index 0000000..ac1eb16 Binary files /dev/null and b/assets/text/win/blue.png differ diff --git a/assets/text/win/pink.png b/assets/text/win/pink.png new file mode 100644 index 0000000..c52f0b7 Binary files /dev/null and b/assets/text/win/pink.png differ 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