When the player is near the borders of the world, I want the camera "stopping scrolling", so that no "black borders" are seen. And I want it to work with any screen resolution. I also want to be able to ask the camera "give me the rectangle coordinates of what you are currently seeing".
When the player is near the borders of the world, I want the camera "stopping scrolling", so that no "black borders" are seen. And I want it to work with any screen resolution. I also want to be able to ask the camera "give me the rectangle coordinates of what you are currently seeing".
oh, okay. its still handy for someone who wants a quick simple camera though
Edit: I fixed this sometime yesterday, you have to set the boundary before you set the viewport, woops. I'm having some troubles getting the camera to bound within my world correctly though, if you would want to help me with that id appreciate it, flashkot already put me on the right track but there are some odd issues I haven't been able to figure out yet.
Last edited by looter on Fri Aug 10, 2012 5:48 am, edited 2 times in total.
I'm pretty confused of how to make the camera scroll using the mouse (level editor).
I tried several ways an possibilities.
Could you show an example of scrolling with the mouse?
So, if I move the mouse in the last right 25px, the camera moves right.
In my tries, I always get troubles with selecting units. It's most likely because the mouse has its x/y in the current cameraview.
I've never used this particular lib, but basically you just put in to your update function to get the mouse position and check if its x and y are greater than or less than certain bounds. like say your window is 800 px wide, you would have an if statement that says something like
But my main problem still remains, I can't select anything.
Assumed there's an object's x-coordinate at 200.
When the mouse was clicked, I check for a collision between the mouse's X and the object's X including its width.
It works very well, but if I moved the camera to the right, the mouse still gets its coordinates from the current cameraview.
Petunien wrote:Thank you, but I had already a similar system.
But my main problem still remains, I can't select anything.
Assumed there's an object's x-coordinate at 200.
When the mouse was clicked, I check for a collision between the mouse's X and the object's X including its width.
It works very well, but if I moved the camera to the right, the mouse still gets its coordinates from the current cameraview.