summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--camera.lua5
-rw-r--r--conf.lua4
-rw-r--r--ground.lua4
-rw-r--r--main.lua13
-rw-r--r--player.lua4
5 files changed, 18 insertions, 12 deletions
diff --git a/camera.lua b/camera.lua
index 793b0d1..2893409 100644
--- a/camera.lua
+++ b/camera.lua
@@ -5,6 +5,7 @@
Camera = {
x = 0,
y = 0,
+ scale = 4,
follow = nil
}
@@ -39,11 +40,11 @@ end
-- Move follow
function Camera:moveFollow ()
- local x,y,i = 145, 90, 1
+ local x,y,i = 145, 120, 1
for k,point in pairs(Nauts) do
i = i + 1
x = math.max(math.min(point.body:getX(),290),0) + x
- y = math.max(math.min(point.body:getY(),180),0) + y
+ y = math.max(math.min(point.body:getY(),180),20) + y
end
x = x / i - 145
y = y / i - 90
diff --git a/conf.lua b/conf.lua
index 51841e1..01e9aa5 100644
--- a/conf.lua
+++ b/conf.lua
@@ -1,7 +1,7 @@
function love.conf(t)
t.title = "notnauts"
t.version = "0.10.1"
- t.window.width = 290
- t.window.height = 200
+ t.window.width = 1260
+ t.window.height = 800
t.console = true
end \ No newline at end of file
diff --git a/ground.lua b/ground.lua
index 23b4dcf..d5fd46e 100644
--- a/ground.lua
+++ b/ground.lua
@@ -27,14 +27,14 @@ function Ground:new (world, x, y, shape, sprite)
end
-- Draw of `Ground`
-function Ground:draw (offset_x, offset_y, debug)
+function Ground:draw (offset_x, offset_y, scale, debug)
-- defaults
local offset_x = offset_x or 0
local offset_y = offset_y or 0
local debug = debug or false
-- sprite draw
love.graphics.setColor(255,255,255,255)
- love.graphics.draw(self.sprite, self.body:getX()-math.ceil(self.sprite:getWidth()/2)+offset_x, self.body:getY()+offset_y)
+ love.graphics.draw(self.sprite, (self.body:getX()-math.ceil(self.sprite:getWidth()/2)+offset_x)*scale, (self.body:getY()+offset_y)*scale, 0, scale, scale)
-- debug draw
if debug then
love.graphics.setColor(220, 220, 220, 100)
diff --git a/main.lua b/main.lua
index 3a895bf..71eba7c 100644
--- a/main.lua
+++ b/main.lua
@@ -57,6 +57,10 @@ function love.keypressed (key)
if key == "x" then
debug = not debug
end
+ --
+ if key == "z" then
+ camera.scale = (camera.scale % 2) + 1
+ end
-- Players
for k,naut in pairs(Nauts) do
naut:keypressed(key)
@@ -74,19 +78,20 @@ function love.draw ()
-- Draw SOME background
-- I'm already bored with solid color!
love.graphics.setColor(193, 100, 99, 255)
- love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), 60)
+ love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()*0.25)
love.graphics.setColor(179, 82, 80, 255)
- love.graphics.rectangle("fill", 0, 160, love.graphics.getWidth(), 40)
+ love.graphics.rectangle("fill", 0, love.graphics.getHeight()*0.8, love.graphics.getWidth(), love.graphics.getHeight()*0.2)
local offset_x, offset_y = camera:getOffsets()
+ local scale = camera.scale
-- Draw ground
for k,platform in pairs(Platforms) do
- platform:draw(offset_x, offset_y, debug)
+ platform:draw(offset_x, offset_y, scale, debug)
end
-- Draw player
for k,naut in pairs(Nauts) do
- naut:draw(offset_x, offset_y, debug)
+ naut:draw(offset_x, offset_y, scale, debug)
end
end
diff --git a/player.lua b/player.lua
index 958ea8a..8e216f2 100644
--- a/player.lua
+++ b/player.lua
@@ -185,14 +185,14 @@ function Player:keyreleased (key)
end
-- Draw of `Player`
-function Player:draw (offset_x, offset_y, debug)
+function Player:draw (offset_x, offset_y, scale, debug)
-- defaults
local offset_x = offset_x or 0
local offset_y = offset_y or 0
local debug = debug or false
-- sprite draw
love.graphics.setColor(255,255,255,255)
- love.graphics.draw(self.sprite, self.current[self.frame], self.body:getX()+offset_x, self.body:getY()+offset_y, self.rotate, self.facing, 1, 12, 15)
+ love.graphics.draw(self.sprite, self.current[self.frame], (self.body:getX()+offset_x)*scale, (self.body:getY()+offset_y)*scale, self.rotate, self.facing*scale, 1*scale, 12, 15)
-- debug draw
if debug then
love.graphics.setColor(50, 255, 50, 100)