require("camera.lua")
player_location = {386, 626}
step_size = 10
function love.load()
setCamera(camera.stretchToResolution(800, 600))
end
function love.update(dt)
if love.keyboard.isDown( "up" ) then
player_location[2] = player_location[2] - (step_size * dt)
end
if love.keyboard.isDown( "down" ) then
player_location[2] = player_location[2] + (step_size * dt)
end
if love.keyboard.isDown( "left" ) then
player_location[1] = player_location[1] - (step_size * dt)
end
if love.keyboard.isDown( "right" ) then
player_location[1] = player_location[1] + (step_size * dt)
end
getCamera():setOrigin(player_location[1], player_location[2])
end
I have graphics loaded on the screen, starting at (0,0), and pressing keys doesn't do anything. Anybody know what I am doing wrong?
No problem. Your post on the other message seems like a better way to do it, actually. I like the idea of just displaying visible tiles of the map. Seems like it could handle much bigger maps pretty efficiently. thanks for your help.
require("camera.lua")
player_location = {386, 626}
step_size = 10
function love.load()
setCamera(camera.stretchToResolution(800, 600))
end
function love.update(dt)
if love.keyboard.isDown( "up" ) then
player_location[2] = player_location[2] - (step_size * dt)
end
if love.keyboard.isDown( "down" ) then
player_location[2] = player_location[2] + (step_size * dt)
end
if love.keyboard.isDown( "left" ) then
player_location[1] = player_location[1] - (step_size * dt)
end
if love.keyboard.isDown( "right" ) then
player_location[1] = player_location[1] + (step_size * dt)
end
getCamera():setOrigin(player_location[1], player_location[2])
end
I have graphics loaded on the screen, starting at (0,0), and pressing keys doesn't do anything. Anybody know what I am doing wrong?
This is the official camera topic(or so it seems), so i will post this here.
As we all see, Love is "a bit" raster dependant, or it was, before camera came out. Dimensions in camera aren't in pixels, so camera is free from raster chains, but when you zoom the screen, it gets blocky, because it is still using raster images. Is it possible to make Love support vector images(eg. *.svg) via camera? I know it would need a lot of changes(eg. animations, because it is hard to pinpoint the width of a frame on a vector), but it all could be solved with a bit of brainstorming. That way games would work perfectly on all resolutions(if CPU can cope with vectors, which on modern computers shouldn't be a problem).
My software never has bugs. It just develops random features.