The Daily Click ::. Forums ::. Klik Coding Help ::. Camera system.
 

Post Reply  Post Oekaki 
 

Posted By Message

Benny Lindberg



Registered
  08/11/2010
Points
  54
8th November, 2011 at 19:29:26 -

Hey everybody! I'm trying to figure out how to get the perfect camera system for my game.

My problem is that I want the camera to always be centered on the current playing level, and if the player leaves it, it should slowly follow.
To illustrate: If the player is between 100 and 50 on on the y axis, only follow the player in x-position.
However, if the player moves below those values, follow him. The camera should also not be completely centered on the player, since there should be more "sky" than "ground" in the picture, and the player will be walking on the ground.

So to make myself clear, have a camera that avoids the motion-sickness thing of constantly adjusting the y-value to keep the player in center, but still keep about the same ratio of ground- to air. I didn't have this problem before, because the playing field wasnt big enough in y-axis for the player to be centered when I had the camera follow him precisely in the y-axis. However, now I'm trying to implement several levels of height, and it screwed up the camera system a bit.


Example!
Notice how the ground always takes up a very small part of the playing field, and that the camera only adjusts when you go over a certain level in y? It has to be a dynamic relation to something, but I can't for my life figure out what.
Pardon if I didn't make myself clear, ask away if you need more information!


 
n/a

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
8th November, 2011 at 20:23:37 -

Hi!
I have never tried to make a camera system like this however have you tried having 2 invisible actives, one above and one below the player and when player collides with them screen moves up or down respectivly. You would also need to have another invisible active to centre the screen around that would follow the player but set to whatever height you would like?
You do not need to centre the screen around the actual character active, this would be very basic but would work if implemented correctly.

Let me know if you try this and it works and if anyone sles reads this and thinks im talking rubbish please put me straight as i dont want to give bad advice

 
n/a

Benny Lindberg



Registered
  08/11/2010
Points
  54
9th November, 2011 at 01:12:42 -

As of now, I have a "camera" object that the screen is always centered on. If I'm to continue this method, I'd need different rules for how the camera object would position itself in relation to either the player or some other active object that works better. Thanks for the input by the way!

 
n/a

nim



Registered
  17/05/2002
Points
  7233
9th November, 2011 at 09:12:51 -

I found this video very interesting. Good luck with your camera programming. Depending on what you want it to be able to do, it can turn out to be a lot more complex than you perhaps first expected.



 
//

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48487

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
9th November, 2011 at 12:29:43 -

Check out this excellent example:

http://www.create-games.com/download.asp?id=8428

 
n/a

Benny Lindberg



Registered
  08/11/2010
Points
  54
9th November, 2011 at 13:53:45 -

What I need is exactly the mario thing where the camera doesnt move until he moves 16 pixels left or right, but for in my case it should be only when he moves a certain number of pixels up from his position, that it starts to follow him.
I'm wondering though, when is it to be reset? When do I start counting how many pixels he has moved? Every time he is considered to be on the ground?

 
n/a

Benny Lindberg



Registered
  08/11/2010
Points
  54
9th November, 2011 at 21:03:05 -

So I got my problem formulated anew.

Y of Camera must never be greater than Y("Player")-85 (puts the right amount of ground into the view).

so far so good. But then I don't want the camera to adjust every time I make a small jump, but every time that happens, Y of Camera will be greater than Y("Player")-85, and so it will subtract from Camera Y so the Camera goes up.



 
n/a

Benny Lindberg



Registered
  08/11/2010
Points
  54
10th November, 2011 at 16:12:13 -

Alrigh, for anyone interested I sort of solved it by dividing the whole map into different "camera" zones, divided by playing fields and transitional fields.
So if the player is on the playing field 0, do not move in y axis. If the player enters transitional field 0.5, align y-axis, until the player reaches playing field 1 or goes back into playing field 0.



 
n/a
   

Post Reply



 



Advertisement

Worth A Click