everything i originally planned on works now, this is officially 1.0, gonna merge it with main and the next plan is to create a lives system instead of a score system

This commit is contained in:
2018-08-31 03:22:13 +02:00
parent 4d268e5d3e
commit be314e3465
3 changed files with 67 additions and 15 deletions

View File

@@ -16,7 +16,8 @@ snake = {
frames = 0,
hgrid = 20,
vgrid = 11,
screen = "bottom",
screen = "top",
score = 0,
bgCol = {
r = 0,
g = 0,
@@ -59,6 +60,7 @@ function snakeplayer:hardreset()
self.blocks = {}
love.graphics.setScreen(snake.screen)
self.w = love.graphics.getWidth()/snake.hgrid
snake.score = 0
end
function snakeplayer:move(xvel, yvel)
@@ -89,6 +91,7 @@ function snakeplayer:update(dt)
self.tar.x = math.floor(math.random() * snake.hgrid)
self.tar.y = math.floor(math.random() * snake.vgrid)
snake.beep:play()
snake.score= snake.score + 1
end
for i = table.getn(self.blocks), 1, -1 do
if i == 1 then