| View previous topic :: View next topic |
| Author |
Message |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Thu May 17, 2007 6:13 pm Post subject: 2d camera? |
|
|
Hello , im making a 2d shooter game but with also some 3d effects!
Im stuck with the 2d camera , can someone help me?
The game is tile based , it uses a file to load every character , and then , it fills an array called char MAP[25][25].
Any help? |
|
| Back to top |
|
 |
ufoz
Joined: 10 Nov 2005 Posts: 86 Location: Tokyo
|
Posted: Thu May 17, 2007 7:18 pm Post subject: |
|
|
| Help with... what? Setting up the projection matrix? |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Thu May 17, 2007 7:32 pm Post subject: |
|
|
| ufoz wrote: | | Help with... what? Setting up the projection matrix? |
Well , i want the camera to follow player's object !
How can i do it?
thanks |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Fri May 18, 2007 7:36 pm Post subject: |
|
|
Im not asking for full source , just some theory , or maybe pseudo code!
th@nks. |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Fri May 18, 2007 9:43 pm Post subject: |
|
|
| dont move the players object, just keep it in center of the camera/view during rendering, but move everything else. |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Fri May 18, 2007 10:35 pm Post subject: |
|
|
| rapso wrote: | | dont move the players object, just keep it in center of the camera/view during rendering, but move everything else. |
Wah , i think i know how to do it!
To keep the player in the center of the screen , i will need something like this:
x = WindowWIDTH /2 - PLAYERWIDTH/2;
y = WindowHeight /2 - PLAYERHEIGHT /2;
Then i just have to scroll the world(array) left/up/down/right ?.. |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Fri May 18, 2007 10:44 pm Post subject: |
|
|
| nDEV wrote: |
Then i just have to scroll the world(array) left/up/down/right ?.. | exactly!
kinda by the reversed position of the players-object. |
|
| Back to top |
|
 |
nDEV
Joined: 13 Apr 2007 Posts: 48
|
Posted: Sat May 19, 2007 3:22 am Post subject: |
|
|
| ok thanks! |
|
| Back to top |
|
 |
|