Hello lovely people!
I've been messing around with making my first project in love, using physics, and I've got a physics character moving round by applying forces to it (not sure if this is the best way to do it, but, sod it, it was fun learning).
Now, what i want to do is get the character running round in a level (I've been messing around with the stuff from the tile based tutorials for that). Thing is, I'm new to this kind of thing and I'm stumped as to how to get the camera to lock on to the player character as it moves around the level (i want him center screen).
Do i somehow lock the camera view to the player's position as he moves around (which i have no idea how to do)? Or do i move the world around the player (seems a faff to me)? I'm struggling to figure out where to start on this... Can anyone suggests techniques, tutorials or generally give me a bit of a backrub and slice of tasty cake?
I'm planning to have decent sized levels and i'd like to have all the characters physics driven (enemies, player, spells he casts - is this an insane idea?)
Please excuse the absolute mess of commented out code in there and the general carcrash of code that it is - I've been struggling with the collision checking code, so for this, i cut it and everything to do with it, out
Cheers
top down camera
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
top down camera
- Attachments
-
- topdown.love
- (72.16 KiB) Downloaded 173 times
Re: top down camera
Hello, welcome, first of all your project is badly packaged. Take attention on that before upload.
Probably for now you could use a camera lib or learn to made one like here (probably most used camera in LOVE)
http://nova-fusion.com/2011/04/19/camer ... he-basics/ (single file, has zoom/scale)
Or you could use those (by oldness order to don't hurt anyone)
vrld, https://github.com/vrld/hump (with zoom/camera but camera have some dependencies)
kikito, https://github.com/kikito/battle-cry/bl ... camera.lua (no zoom/scale, single file)
roland yonaba https://github.com/Yonaba/Love2d-Camera (no zoom/scale, single file)
markandgo https://github.com/markandgo/hump (an updated expanded version of vrld's camera)
Sorry the libs I missed...
Probably for now you could use a camera lib or learn to made one like here (probably most used camera in LOVE)
http://nova-fusion.com/2011/04/19/camer ... he-basics/ (single file, has zoom/scale)
Or you could use those (by oldness order to don't hurt anyone)
vrld, https://github.com/vrld/hump (with zoom/camera but camera have some dependencies)
kikito, https://github.com/kikito/battle-cry/bl ... camera.lua (no zoom/scale, single file)
roland yonaba https://github.com/Yonaba/Love2d-Camera (no zoom/scale, single file)
markandgo https://github.com/markandgo/hump (an updated expanded version of vrld's camera)
Sorry the libs I missed...
Re: top down camera
I'm new to using Love, but I think drawing to a canvas and then moving the x/y axis of the canvas as per the player position. If the relative position of the player (playerx-canvasx) is less than half the screen, dont push more left (so that the camera wont go off-map)
Then again, that might be inefficient, can't say since as I previously mentioned - I'm new to LOVE.
Then again, that might be inefficient, can't say since as I previously mentioned - I'm new to LOVE.
Lua is not an acronym.
Re: top down camera
Not every pc supports Canvases - my netbook, for example, doesn't (on Windows; on Linux they work fine)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: top down camera
True, even the (temporary, rubbish) pc I use now doesn't support it.Nixola wrote:Not every pc supports Canvases - my netbook, for example, doesn't (on Windows; on Linux they work fine)
Lua is not an acronym.
Re: top down camera
Sorry for double post (:/)
I just looked at forked hump ( https://github.com/markandgo/hump ) and its the best for what you want, makes it much easier to support split screen for multiplayer etc. I recommend you to use this.
You might find the readme.md file examples hard to follow, but just check out the examples.
I just looked at forked hump ( https://github.com/markandgo/hump ) and its the best for what you want, makes it much easier to support split screen for multiplayer etc. I recommend you to use this.
You might find the readme.md file examples hard to follow, but just check out the examples.
Lua is not an acronym.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: top down camera
You know there's an edit button, right?qaisjp wrote:Sorry for double post (:/)
Re: top down camera
I am aware, but by double posting I notify people who already read my post that I updated it.bartbes wrote:You know there's an edit button, right?qaisjp wrote:Sorry for double post (:/)
Lua is not an acronym.
Re: top down camera
I read it
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot] and 5 guests