Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / 2d Top down Game

Author
Message
BM6
15
Years of Service
User Offline
Joined: 29th Nov 2008
Location:
Posted: 29th Nov 2008 19:18
Hello, i am trying to make a 2d.
It is top down, so it means you only see the xz square.
It is going to be a multiplayer( if that is possible) shooter.
I have pretty much knowledge with OpenGL ( very low level lol!) and i know C++. I wanted to try something new so i wanted to use DX, and dark sdk seemed nice for that.

But here are my problems. I do not need detailed code snippets for it, just some basic functions..
-How can i create a map that is bigger then my screen, with other words: people are walking somewhere on the map but i cannot see them on my screen.
-How can I walk upwards, and let the camera also move upwards, so that my own character is always in the mid of the screen.
Can i make a tile based map? A map that consists of many pictures.

~BM6
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Nov 2008 19:47 Edited at: 29th Nov 2008 19:48
Without being detailed, the primary approach is to define your entire environment by the dimensions of the whole landscape, assuming that it's finite in expanse.

Your primary concern is to keep the player in the middle of the screen. That means that the upper left corner of the background has to be calculated based on the player's position within the environment. The upper left corner should be the player's co-ordinates minus half the screen height and width. However, if the player is less that half the screen width in the x position and half the screen height in the position you'll need to reposition the player rather than the screen. The same applies for the other extreme. If the player moves too far to the right or down then the player is going to have to be moved instead of the background.

From there it's a matter of writing routines that start the upper left corner of the background in the right position. You could use a large image or write tile routines to do the same.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
BM6
15
Years of Service
User Offline
Joined: 29th Nov 2008
Location:
Posted: 29th Nov 2008 20:07
Quote: "
From there it's a matter of writing routines that start the upper left corner of the background in the right position. You could use a large image or write tile routines to do the same."

True, and how would i set the upper left corner of background ?
Do i have to use some kind of camera
Lets say i use a big picture for the background, how would i set the upper left corner of the screen somwhere else then upper left of picture?

And also, i have a solution for the problem that when u get at the end of the map. U make the map a little bigger, but u cannot actually get at the end, u place a wall.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Nov 2008 20:24
Quote: "True, and how would i set the upper left corner of background ?
"


One big picture, one big sprite. Set the coordinates of the sprite to negative values. The only part that can be displayed will be the portion that lies within the viewport of the window.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
BM6
15
Years of Service
User Offline
Joined: 29th Nov 2008
Location:
Posted: 29th Nov 2008 22:15
Can you give an example?
I am new to all the functions...

Login to post a reply

Server time is: 2024-11-25 08:02:39
Your offset time is: 2024-11-25 08:02:39