HUMP camera lib script question

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
weilies
Prole
Posts: 28
Joined: Sat Oct 09, 2010 6:16 am

HUMP camera lib script question

Post by weilies »

hi vrld,

Some question bout your camera script. Thanks for your guide all the time, especially the scripts provided
i have created a simple script, where arrow keys control my ball movement, WSAD keys control camera movement

And on right top corner, i show my debug messages, where they will always stick on screen even camera is moved
I realized there are 2 issue here, when i try to ZOOM my camera,
- it's not possible to scale everything EXCEPT my debug font
- and also while scaling the object, my debug font (which is image) will look ugly (attachment 20)
- also, can we zoom on particular X,Y point instead of always zoom the center?

Anyway to resolve two issues above?

Thanks again for the camera script!
Attachments
20.gif
20.gif (24.38 KiB) Viewed 2307 times
main.lua
(3.27 KiB) Downloaded 133 times
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: HUMP camera lib script question

Post by bmelts »

I can't speak to the mechanics of HUMP, but the ugly image font is a bug which was recently fixed in the repository - that won't be a problem once 0.7.0 comes out. (Well, it'll still look blurry when scaled, but there won't be those hideous yellow lines.)
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP camera lib script question

Post by vrld »

Without looking at your code yet, but based on
weilies wrote:when i try to ZOOM my camera,
- it's not possible to scale everything EXCEPT my debug font
I guess you don't use camera:predraw() and camera:postdraw() correctly, but position the debug message so that it will appear where you want it to. That is not necessary. Put everything that should be seen by the camera into a camera:predraw()/camera:postdraw() pair and print the debug info afterwards:

Code: Select all

function love.draw()
    cam:predraw()
    ... draw game-objects here ...
    cam:postdraw()
    ... draw hud/debug info/everything that should not be affected by the camera here ...
end
also, can we zoom on particular X,Y point instead of always zoom the center?
I am not sure what you mean by that, but it guess not (like with a real camera).
A zoom to a specific point is a combination of zooming and moving the camera, so you will need to adjust the camera position accordingly.

Edit: also, for setting the camera position you should not do

Code: Select all

gCamera = Camera(vector(vectorX, vectorY), vecZoom)
which creates a new camera object, but rather

Code: Select all

gCamera.pos = vector(vectorX, vectorY)
Zooming is also done by updating the zoom-field of the camera object (the documentation is lacking in that respect):

Code: Select all

gCamera.zoom = gCamera.zoom + (cameraZoomSpeed * dt)
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 17 guests