The Daily Click ::. Forums ::. Klik Coding Help ::. Gauntlet Style Camera
 

Post Reply  Post Oekaki 
 

Posted By Message

Smon



Registered
  09/02/2007
Points
  2
10th February, 2007 at 00:54:31 -

I'm making a game where four players are on screen at once, the camera is working fine but how do I make it so that a player can't leave the others behind?

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
10th February, 2007 at 01:57:20 -

If your camera is at the midpoint of all four character coordinates, you only need to make sure characters can't move outside (camera ordinate) +/- (screen width or height)/2 on whatever axis.

Something like this:

X("Player 1") > (xcamera - Screen Width/2)
---Player 1: Set X to (xcamera + Screen Width/2)

X("Player 1") < (xcamera - Screen Width/2)
---Player 1: Set X to (xcamera - Screen Width/2)

Y("Player 1") > (ycamera - Screen Height/2)
---Player 1: Set X to (ycamera + Screen Height/2)

Y("Player 1") < (ycamera - Screen Height/2)
---Player 1: Set X to (ycamera - Screen Height/2)

 
n/a
   

Post Reply



 



Advertisement

Worth A Click