forgot to commit some stuff yesterday, hope the changelog is still in there, but i added a compatibility file someone made to make stuff easyer to emulate on pc

This commit is contained in:
2018-08-31 00:41:55 +02:00
parent 5b314fe022
commit 80447848b5
4 changed files with 381 additions and 30 deletions

View File

@@ -1,29 +1,30 @@
fly = {
sx = 0,
sy = 0,
x = 50,
y = 50,
sprite = love.graphics.newImage("data/fly.png"),
af = love.graphics.newQuad(0, 0, 512, 512, 1024, 512),
bf = love.graphics.newQuad(512, 0, 512, 512, 1024, 512),
rot = 0,
scl = 20,
anf = 0,
anc = false,
ans = 10,
alive = true,
ttl = 4,
tl = 0,
timer = false
sx = 0, --startx or current x
sy = 0, --starty or current y
x = 50, --destination x
y = 50, --destination -y
sprite = love.graphics.newImage("data/fly.png"), --image
af = love.graphics.newQuad(0, 0, 512, 512, 1024, 512), --a frame
bf = love.graphics.newQuad(512, 0, 512, 512, 1024, 512), --b frame
rot = 0, --rotation
scl = 20, --scale
anf = 0, --animation frames
anc = false, --animation counter (false is af true is bf or some shit)
ans = 1, --animation speed (if animation frames is equal to this the anim changes)
alive = true, --is the fly alive
ttl = 4, --time to live before the fly dies
tl = 0, --time lived
timer = false --flies only start living when they stop moving, this is to keep tracking that
}
swat = {
screen = "bottom",
score = 0,
diff = 1,
diff = 1, --difficulty
frames = 0,
width = 1,
height = 1,
bgCol = {
width = 1,--set later width of screen
height = 1,--set later height of screen
bgCol = { --background colors of screen
r = 255,
g = 255,
b = 255
@@ -31,7 +32,7 @@ swat = {
}
function swat:load()
love.graphics.setScreen("bottom")
love.graphics.setScreen(swat.screen)
swat.width = love.graphics.getWidth()
swat.height = love.graphics.getHeight()
swat.score = 0
@@ -50,6 +51,10 @@ function swat:update( dt)
if fly.timer then
fly.tl = fly.tl + dt
end
if fly.tl >= fly.ttl then
swat.score = swat.score -1
fly:newFly()
end
if fly.alive then
--draw the existing fly if he's not on path, move him on his path.
if fly.sx ~= fly.x or fly.sy ~= fly.y then
@@ -77,7 +82,7 @@ function swat:update( dt)
end
function fly:draw()
love.graphics.setScreen("bottom")
love.graphics.setScreen(swat.screen)
love.graphics.setColor(swat.bgCol.r, swat.bgCol.g, swat.bgCol.b)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if fly.anf > fly.ans then
@@ -89,10 +94,9 @@ function fly:draw()
end
end
if fly.anc then
love.graphics.draw(fly.sprite, fly.af, fly.sx, fly.sy, fly.rot, 0.2, 0.2)
love.graphics.draw(fly.sprite, fly.af, 1, 1, 0, 0, 0,0,0)
else
love.graphics.draw(fly.sprite, fly.bf, fly.sx, fly.sy, fly.rot, 1, 1)
love.graphics.draw(fly.sprite, fly.bf, 1, 1, 0, 0, 0,0,0)
end
end