camera?
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: camera?
What do you have so far?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Re: camera?
What do you mean what i have?2 images,one moves.Nothing special.
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: camera?
Currently, you use the input to move the player sprite.
Use the imput to move every image BUT the player sprite instead.
Use the imput to move every image BUT the player sprite instead.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Re: camera?
"Use the input to move every image BUT the player sprite instead"
What does that mean?
What does that mean?
Re: camera?
Code: Select all
love.filesystem.require("camera.lua")
function load()
player = love.graphics.newImage("player.png")
background = love.graphics.newImage("background.png")
playerX = 50
playerY = 50
getCamera():setScreenOrigin(0.5, 0.5) -- Set this to the middle of the screen.
end
function update(dt)
if love.keyboard.isDown(love.key_left) then
playerX = playerX - 1
end
if love.keyboard.isDown(love.key_right) then
playerX = playerX + 1
end
if love.keyboard.isDown(love.key_up) then
playerY = playerY - 1
end
if love.keyboard.isDown(love.key_down) then
playerY = playerY + 1
end
getCamera():setOrigin(playerX, playerY) -- Focus on the player, nothing else. This will follow the player around.
end
function draw()
love.graphics.draw(background, 0, 0)
love.graphics.draw(player, playerX, playerY)
end
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!
Re: camera?
Hey,thanks.Looks easy as pie.Only were can i find the "camera.lua" header file?
Re: camera?
Hmm, yes, right. Here you are: http://love2d.org/forum/viewtopic.php?f=5&t=419 -- By our own osuf oboys.
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!
Re: camera?
I'm glad. Play around with it and read Camera's documentation (on the Wiki, mostly, I think) and get a good sense of what's possible. I think you'll find it's more fun to play around and figure things out for yourself. I know I certainly enjoy it immensely.someguy99 wrote:OK,it worked
But I still ask for help when I get well and truly stumped.
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests