Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff, TyRaNiD
-
nDEV
- Posts: 48
- Joined: Fri Apr 13, 2007 1:26 am
Post
by nDEV »
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?
-
ufoz
- Posts: 86
- Joined: Thu Nov 10, 2005 2:36 am
- Location: Tokyo
-
Contact:
Post
by ufoz »
Help with... what? Setting up the projection matrix?
-
nDEV
- Posts: 48
- Joined: Fri Apr 13, 2007 1:26 am
Post
by nDEV »
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
-
nDEV
- Posts: 48
- Joined: Fri Apr 13, 2007 1:26 am
Post
by nDEV »
Im not asking for full source , just some theory , or maybe pseudo code!
th@nks.
-
rapso
- Posts: 140
- Joined: Mon Mar 28, 2005 6:35 am
Post
by rapso »
dont move the players object, just keep it in center of the camera/view during rendering, but move everything else.
-
nDEV
- Posts: 48
- Joined: Fri Apr 13, 2007 1:26 am
Post
by nDEV »
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 ?..
-
rapso
- Posts: 140
- Joined: Mon Mar 28, 2005 6:35 am
Post
by rapso »
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.
-
nDEV
- Posts: 48
- Joined: Fri Apr 13, 2007 1:26 am
Post
by nDEV »
ok thanks!