Merge pull request #23 from wesleycsj/demo-commandokibbles

Port to Love 11.3 version
This commit is contained in:
Calvin Rose 2020-08-12 08:22:15 -05:00 committed by GitHub
commit 2cb8f7c77b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 25 deletions

View File

@ -1,6 +1,6 @@
function love.conf(t)
t.identity = nil
t.version = "0.10.1"
t.version = "11.3"
t.console = false
t.window.title = "Commando Kibbles"
t.window.icon = nil

View File

@ -20,7 +20,7 @@ function MultiSource:cleanup(older_than)
for instance, lastPlayed in pairs(self.instances) do
local age = now - lastPlayed
if age > older_than and instance:isStopped() then
if age > older_than and not instance:isPlaying() then
self.instances[instance] = nil
end
end
@ -28,7 +28,7 @@ end
function MultiSource:getStoppedOrNewInstance()
for instance in pairs(self.instances) do
if instance:isStopped() then return instance end
if not instance:isPlaying() then return instance end
end
return self.source:clone()
end

View File

@ -876,9 +876,9 @@ function Map:draw()
end
function Map:drawLayer(layer)
framework.setColor(255, 255, 255, 255 * layer.opacity)
framework.setColor(1, 1, 1, layer.opacity)
layer:draw()
framework.setColor(255, 255, 255, 255)
framework.setColor(1, 1, 1, 1)
end
function Map:drawTileLayer(layer)
@ -919,10 +919,10 @@ function Map:drawObjectLayer(layer)
assert(layer.type == "objectgroup", "Invalid layer type: " .. layer.type .. ". Layer must be of type: objectgroup")
local line = { 160, 160, 160, 255 * layer.opacity }
local fill = { 160, 160, 160, 255 * layer.opacity * 0.2 }
local shadow = { 0, 0, 0, 255 * layer.opacity }
local reset = { 255, 255, 255, 255 * layer.opacity }
local line = { 0.63, 0.63, 0.63, layer.opacity }
local fill = { 0.63, 0.63, 0.63, layer.opacity * 0.2 }
local shadow = { 0, 0, 0, layer.opacity }
local reset = { 1, 1, 1, layer.opacity }
local function sortVertices(obj)
local vertices = {{},{}}

View File

@ -32,9 +32,9 @@ end
function love.draw()
if paused then
love.graphics.setColor(90, 90, 90, 255)
love.graphics.setColor(0.35, 0.35, 0.35, 1)
love.graphics.draw(pauseCanvas, 0, 0)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setColor(1, 1, 1, 1)
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")
else

View File

@ -12,14 +12,14 @@ assets.img_explosion = love.graphics.newImage("assets/explosion.png")
assets.img_pig = love.graphics.newImage("assets/pig.png")
assets.img_spawner = love.graphics.newImage("assets/spawner.png")
assets.snd_catjump = multisource.new(love.audio.newSource("assets/catjump.wav"))
assets.snd_cannon = multisource.new(love.audio.newSource("assets/cannon.wav"))
assets.snd_thud = multisource.new(love.audio.newSource("assets/thud.wav"))
assets.snd_meow = multisource.new(love.audio.newSource("assets/meow.ogg"))
assets.snd_oink = multisource.new(love.audio.newSource("assets/oink.ogg"))
assets.snd_yay = multisource.new(love.audio.newSource("assets/yay.wav"))
assets.snd_catjump = multisource.new(love.audio.newSource("assets/catjump.wav", "static"))
assets.snd_cannon = multisource.new(love.audio.newSource("assets/cannon.wav", "static"))
assets.snd_thud = multisource.new(love.audio.newSource("assets/thud.wav", "static"))
assets.snd_meow = multisource.new(love.audio.newSource("assets/meow.ogg", "static"))
assets.snd_oink = multisource.new(love.audio.newSource("assets/oink.ogg", "static"))
assets.snd_yay = multisource.new(love.audio.newSource("assets/yay.wav", "static"))
assets.snd_music = love.audio.newSource("assets/music.ogg")
assets.snd_music = love.audio.newSource("assets/music.ogg", "stream")
assets.fnt_hud = love.graphics.newFont("assets/font.ttf", 48)
assets.fnt_smallhud = love.graphics.newFont("assets/font.ttf", 32)

View File

@ -18,7 +18,7 @@ end
function TransitionScreen:drawHud(dt)
local r1, g1, b1, a = love.graphics.getColor()
love.graphics.setColor(0, 0, 0, self.alpha * 255)
love.graphics.setColor(0, 0, 0, self.alpha)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
love.graphics.setColor(r1, g1, b1, a)
end

View File

@ -29,7 +29,7 @@ function Intro:load()
require ("src.systems.HudSystem")("hudBg"),
require ("src.systems.HudSystem")("hudFg"),
TransitionScreen(),
ScreenSplash(0.5, 0.2, "Cammando Kibbles"),
ScreenSplash(0.5, 0.2, "Commando Kibbles"),
ScreenSplash(0, 0, "Created by bakpakin for Ludum Dare 32", 300, assets.fnt_reallysmallhud, "left", 20, 20),
ScreenSplash(0.5, 0.36, "Press Space to Start", 500, assets.fnt_smallhud),
ScreenSplash(0.5, 0.45, "Controls:\nMove - WASD\nRotate Cannon - Arrow Keys\nFire - Down\nToggle Fullscreen - \\\nToggle Music - M\nPause - P\nEscape - Quit", 800, assets.fnt_reallysmallhud)

View File

@ -1,12 +1,12 @@
local DrawBackgroundSystem = tiny.system(class "DrawBackgroundSystem")
function DrawBackgroundSystem:init(r, g, b)
self.r, self.g, self.b = r, g, b
self.r, self.g, self.b = (r / 255), (g / 255), (b / 255)
end
function DrawBackgroundSystem:update(dt)
local r1, g1, b1, a = love.graphics.getColor()
love.graphics.setColor(self.r, self.g, self.b, 255)
love.graphics.setColor(self.r, self.g, self.b, 1)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
love.graphics.setColor(r1, g1, b1, a)
end

View File

@ -11,7 +11,7 @@ end
function SpriteSystem:postProcess(dt)
self.camera:remove()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setColor(1, 1, 1, 1)
end
function SpriteSystem:process(e, dt)
@ -19,7 +19,7 @@ function SpriteSystem:process(e, dt)
local alpha = e.alpha or 1
local pos, sprite, scale, rot, offset = e.pos, e.sprite, e.scale, e.rot, e.offset
local sx, sy, r, ox, oy = scale and scale.x or 1, scale and scale.y or 1, rot or 0, offset and offset.x or 0, offset and offset.y or 0
love.graphics.setColor(255, 255, 255, math.max(0, math.min(1, alpha)) * 255)
love.graphics.setColor(1, 1, 1, math.max(0, math.min(1, alpha)))
if an then
an.flippedH = e.flippedH or false
an.flippedV = e.flippedV or false