summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar alecdwm 2018-05-24 17:41:41 +1000
committerGravatar alecdwm 2018-05-24 17:41:41 +1000
commit950b5372110744486be98a92434aaa6a7c1fa8a0 (patch)
tree212a7ddd062372fe51a9f9ccbcde1b66654d1b95
parente7b1aaa4de3e0be2b35469d6b2cc55956dae1676 (diff)
port to love 11.1HEADmaster
-rw-r--r--conf.lua1
-rw-r--r--lib.lua66
-rw-r--r--main.lua11
-rw-r--r--player.lua2
-rw-r--r--ship.lua18
5 files changed, 48 insertions, 50 deletions
diff --git a/conf.lua b/conf.lua
index 966d6e8..47bb536 100644
--- a/conf.lua
+++ b/conf.lua
@@ -1,4 +1,5 @@
function love.conf(t)
+ t.version = "11.1" -- The LÖVE version this game was made for (string)
t.window.title = "Novastruct"
-- t.window.resizable = true
end
diff --git a/lib.lua b/lib.lua
index 3e44a58..c85bcba 100644
--- a/lib.lua
+++ b/lib.lua
@@ -1,41 +1,41 @@
function rgb_to_hex(r, g, b)
- return string.format("%02X%02X%02X", r, g, b)
+ return string.format("%02X%02X%02X", r*255, g*255, b*255)
end
function rgba_to_hex(r, g, b, a)
- return string.format("%02X%02X%02X%02X", r, g, b, a)
+ return string.format("%02X%02X%02X%02X", r*255, g*255, b*255, a*255)
end
function print_table(t)
- local print_table_cache={}
- local function sub_print_table(t, indent)
- if (print_table_cache[tostring(t)]) then
- print(indent.."*"..tostring(t))
- else
- print_table_cache[tostring(t)]=true
- if (type(t)=="table") then
- for pos,val in pairs(t) do
- if (type(val)=="table") then
- print(indent.."["..pos.."] => "..tostring(t).." {")
- sub_print_table(val,indent..string.rep(" ",string.len(pos)+8))
- print(indent..string.rep(" ",string.len(pos)+6).."}")
- elseif (type(val)=="string") then
- print(indent.."["..pos..'] => "'..val..'"')
- else
- print(indent.."["..pos.."] => "..tostring(val))
- end
- end
- else
- print(indent..tostring(t))
- end
- end
- end
- if (type(t)=="table") then
- print(tostring(t).." {")
- sub_print_table(t," ")
- print("}")
- else
- sub_print_table(t," ")
- end
- print()
+ local print_table_cache={}
+ local function sub_print_table(t, indent)
+ if (print_table_cache[tostring(t)]) then
+ print(indent.."*"..tostring(t))
+ else
+ print_table_cache[tostring(t)]=true
+ if (type(t)=="table") then
+ for pos,val in pairs(t) do
+ if (type(val)=="table") then
+ print(indent.."["..pos.."] => "..tostring(t).." {")
+ sub_print_table(val,indent..string.rep(" ",string.len(pos)+8))
+ print(indent..string.rep(" ",string.len(pos)+6).."}")
+ elseif (type(val)=="string") then
+ print(indent.."["..pos..'] => "'..val..'"')
+ else
+ print(indent.."["..pos.."] => "..tostring(val))
+ end
+ end
+ else
+ print(indent..tostring(t))
+ end
+ end
+ end
+ if (type(t)=="table") then
+ print(tostring(t).." {")
+ sub_print_table(t," ")
+ print("}")
+ else
+ sub_print_table(t," ")
+ end
+ print()
end
diff --git a/main.lua b/main.lua
index 41b6121..167343b 100644
--- a/main.lua
+++ b/main.lua
@@ -6,7 +6,6 @@ require "ship"
require "stars"
function love.load()
- -- don't fuck with the pixel art, man
love.graphics.setDefaultFilter("nearest", "nearest", 0)
love.graphics.setNewFont("DejaVuSansMono.ttf", 11)
@@ -33,23 +32,23 @@ function love.draw()
stars:draw()
- love.graphics.setColor(241, 217, 26, 255)
+ love.graphics.setColor(241/255, 217/255, 26/255, 255/255)
love.graphics.circle("fill", 0, 0, 50, 32)
love.graphics.circle("line", 0, 0, 80, 8)
- love.graphics.setColor(17, 27, 26, 255)
+ love.graphics.setColor(17/255, 27/255, 26/255, 255/255)
love.graphics.circle("fill", 280, -80, 40, 4)
love.graphics.circle("line", 280, -80, 60, 4)
- love.graphics.setColor(0, 194, 204, 255)
+ love.graphics.setColor(0, 194/255, 204/255, 255/255)
love.graphics.circle("fill", -300, 200, 80, 32)
love.graphics.arc("line", -300, 200, 120, 0, 3 * math.pi / 2, 32)
- love.graphics.setColor(240, 80, 20, 255)
+ love.graphics.setColor(240/255, 80/255, 20/255, 255/255)
love.graphics.rectangle("fill", 100, 100, 80, 50)
love.graphics.rectangle("line", 90, 90, 100, 70)
- love.graphics.setColor(255, 255, 255, 255)
+ love.graphics.setColor(255/255, 255/255, 255/255, 255/255)
ship:draw()
player:draw()
diff --git a/player.lua b/player.lua
index 76898fd..9ecab38 100644
--- a/player.lua
+++ b/player.lua
@@ -16,7 +16,7 @@ player.timeRight = 0
player.controlMode = "player"
function player:load()
- self.doorSound = love.audio.newSource("door.ogg")
+ self.doorSound = love.audio.newSource("door.ogg", "static")
self.image = love.graphics.newImage("player.png")
self.parent = {}
end
diff --git a/ship.lua b/ship.lua
index 2b84a59..241fc2e 100644
--- a/ship.lua
+++ b/ship.lua
@@ -18,23 +18,21 @@ ship.rotDragEnabled = false
function ship:load()
-- load images
- self.image = love.graphics.newImage("ship.png")
+ self.imageData = love.image.newImageData("ship.png")
+ self.image = love.graphics.newImage(self.imageData)
-- load sounds
- self.computerbeepSound = love.audio.newSource("computerbeep.ogg")
- self.fireSound = love.audio.newSource("fire.ogg")
- self.thrustSound = love.audio.newSource("thrust.ogg")
+ self.computerbeepSound = love.audio.newSource("computerbeep.ogg", "static")
+ self.fireSound = love.audio.newSource("fire.ogg", "static")
+ self.thrustSound = love.audio.newSource("thrust.ogg", "static")
self.thrustSound:setLooping(true)
-- construct map
self.map = {}
- local imageData = self.image:getData()
- local h = imageData:getHeight()
- local w = imageData:getWidth()
- for y=1, h do
- for x=1, w do
+ for y=1, self.imageData:getHeight() do
+ for x=1, self.imageData:getWidth() do
if not self.map[y] then self.map[y]={} end
- r, g, b, a = imageData:getPixel(x-1, y-1)
+ r, g, b, a = self.imageData:getPixel(x-1, y-1)
self.map[y][x] = tiles:getTileTypeFromColor(rgb_to_hex(r, g, b))
end
end