diff options
-rw-r--r-- | camera.lua | 5 | ||||
-rw-r--r-- | conf.lua | 4 | ||||
-rw-r--r-- | ground.lua | 4 | ||||
-rw-r--r-- | main.lua | 13 | ||||
-rw-r--r-- | player.lua | 4 |
5 files changed, 18 insertions, 12 deletions
@@ -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 @@ -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 @@ -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) @@ -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 @@ -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) |