Fix up some demo code.

This commit is contained in:
bakpakin 2015-05-20 10:01:38 +08:00
parent be56780b88
commit b1ba9bebeb
5 changed files with 12 additions and 12 deletions

View File

@ -33,7 +33,7 @@ end
function love.draw()
if paused then
love.graphics.setColor(90, 90, 90, 255)
love.graphics.draw(pauseCanvas, 0, 0)
love.graphics.draw(pauseCanvas, 0, 0)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setFont(assets.fnt_hud)
love.graphics.printf("Paused - P to Resume", love.graphics.getWidth() * 0.5 - 125, love.graphics.getHeight() * 0.4, 250, "center")
@ -93,7 +93,7 @@ beholder.observe("keypress", "\\", function()
local fs = love.window.getFullscreen()
if fs then
love.window.setMode(900, 600, {resizable = true})
else
else
local w, h = love.window.getDesktopDimensions()
love.window.setMode(w, h, {fullscreen = true, })
end

View File

@ -25,9 +25,9 @@ function Pig:init(x, y, target)
}
self.ai = {
}
self.hitbox = {w = 30, h = 21}
self.health = 50
self.maxHealth = 50
@ -40,7 +40,7 @@ function Pig:init(x, y, target)
end
function Pig:gotHit()
if self.isAlive then
if self.isAlive then
self.isAlive = nil
self.lifetime = 0.25
self.fadeTime = 0.25

View File

@ -9,7 +9,7 @@ local Player = class("Player")
function Player:draw(dt)
if self.hasGun then
local p = self.animation.position
local p = self.animation.position
local dy = (p ~= 2 and p ~= 3) and 0 or -1
local dx = self.platforming.direction == 'l' and 2 or -2
love.graphics.draw(assets.img_gun, self.pos.x + 16 + dx, self.pos.y + 10 + dy, self.gunAngle - math.pi / 4)
@ -30,7 +30,7 @@ function Player:onHit()
world:add(self)
local n = gamestate.current().score
local message = "You Died."
if n == 0 then message = "You Failed Pretty Hard."
if n == 0 then message = "You Failed Pretty Hard."
elseif n < 10 then message = "You Killed Some Pigs and They Killed you Back."
elseif n < 30 then message = "That's a lot of Bacon."
elseif n < 100 then message = "You a crazy Pig Killer."

View File

@ -7,8 +7,8 @@ end
AISystem.filter = tiny.requireAll("ai", "pos", "platforming")
function AISystem:process(e, dt)
if not self.target then
return
if not self.target then
return
end
local targetx = self.target.pos.x
local pos = e.pos

View File

@ -18,7 +18,7 @@ local function collisionFilter(e1, e2)
if e2.isPlayer then return 'cross' end
elseif e1.isBullet then
if e2.isPlayer or e2.isBullet then return nil end
end
end
if e1.isSolid then
if type(e2) == "string" then -- tile collision
if e2:byte(1) == oneWayPrefix then -- one way tile
@ -86,8 +86,8 @@ function BumpPhysicsSystem:process(e, dt)
end
end
if e.onCollision and collided then
e:onCollision(col)
if e.onCollision and collided then
e:onCollision(col)
end
end
end