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.

Newcomers DBPro Corner / New to DarkBasic Pro

Author
Message
Mystic Trunks
17
Years of Service
User Offline
Joined: 6th May 2007
Location:
Posted: 7th May 2007 02:48
Hey I have a few questions, first off how do I make maps for a 2-d game? second off how do I create shadows for certain objects.

Thanks.

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 7th May 2007 11:22
to make maps for a 2d game you have a couple of options.

option1 is to hardcode it into either data statements or read from a text file, values that correspond to the tiles image, and other values for whether it's walkable or not. You need to code reading in the values into a multi-dimensional array (most likely), and routines for blitting the tiles to the screen.

for example lets say that we have a few tile images 1=water 2=grass. Lets also say that the second layer of the array holds values such as 0=not walkable 1=walkable.

so the data to represent a 4x4 grass Island surounded by 1 water tile on all sides would look like this (if the water is unwalkable)

layer1:
data 1,1,1,1,1,1
data 1,2,2,2,2,1
data 1,2,2,2,2,1
data 1,2,2,2,2,1
data 1,2,2,2,2,1
data 1,1,1,1,1,1

layer0:
data 0,0,0,0,0,0
data 0,1,1,1,1,0
data 0,1,1,1,1,0
data 0,1,1,1,1,0
data 0,1,1,1,1,0
data 0,0,0,0,0,0

Most of the 2d map games I had were 5 dimensiona arrays

layer 0 would be used to hold values of hidden secret walkable areas
layer 1 was the layer below the player. Any thing on this layer the player would walk over.
layer 2 was on the same level of the player. Any thing on this layer the player would collide with
layer 3 was objects above the player, things the player could walk under like bridges, over hangs, leaves of a tree....
layer 4 was used for atmospheric effects, like rain, clouds, birds, etc...

option2 is like option 1 but rather than hard code #'s you code your own map editor. Sort of like coding a paint program. This can take a long time to dev, and to get working well.

option3 use a map maker like Mappy. It will definately save you time. You will have to sacrafice full control, and learn to use the program.

Login to post a reply

Server time is: 2024-11-25 17:59:30
Your offset time is: 2024-11-25 17:59:30