Can't make sti work with any kind of camera

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Lirija
Prole
Posts: 24
Joined: Tue Mar 14, 2017 11:42 am
Contact:

Can't make sti work with any kind of camera

Post by Lirija » Wed Sep 05, 2018 3:26 pm

Hi guys! I'm really at a loss here, it seems i can't get simple tiled implementation to work with any camera, i tried hump.camera, gamera and simply translating using love.graphics.translate;

P.s.
I use push.lua to manage resolution, i suspect it might be the culprit

P.p.s love version is 11.1

Code: Select all

-- in main
function love.load()
  love.graphics.setDefaultFilter("nearest", "nearest")
  push:setupScreen(gWidth, gHeight, window_width, window_height,
  {
    vsync = true,
    --canvas = false,
    fullscreen = false,
    resizable = true
  })
    Gamestate.switch(gStates.play)
end

function love.draw()
  push:start()
    Gamestate.draw()
  push:finish()
end

Code: Select all

-- in play gamestate

local Camera = require "libs/camera"

function play:init()
	-- stuff
  self.camera = Camera(0,0)
end

function play:draw()
  self.camera:attach()
    self.map:draw()
    self.player:draw()
  self.camera:detach()
end

Code: Select all

-- in play gamestate

local gamera = require "libs/gamera"

function play:init()
	self.camera = gamera.new(0, 0, gWidth*2, gHeight*2)
end

function play:draw()
  self.camera:draw( function(l,t,w,h)
    self.map:draw()
    self.player:draw()
  end)
end
with both the versions above the map get drawn but not the player, also the map doesn't translate

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 9 guests