Added ending screen
This commit is contained in:
parent
d32ef8ef0a
commit
e41a42fda4
BIN
assets/text/win/blue.png
Normal file
BIN
assets/text/win/blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/text/win/pink.png
Normal file
BIN
assets/text/win/pink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
1
game.lua
1
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
|
||||
|
22
objects/end.lua
Normal file
22
objects/end.lua
Normal file
@ -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
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user