[gameprogrammer] Re: How to have hills in a tiled game

you could have a "type" specifier for each tile too, instead of
increasing the granularity.

type  meaning
 0      empty
 1      solid
 2      45 deg slant uphill right /|
 3      45 deg slant uphill left |\
( 4      45 deg roof slant right \| )
( 5      45 deg roof slant left |/ )

.. where 4 and 5 are quite optional.

Then, to handle collision detection with the background in the game,
build a function

bool IsSolid(int wx, int wy) {
}

.. which answers the question "Is the pixel located at
world-pixel-coordinate system coordinate (wx,wy) solid?"

That question is easy to answer for solid / empty tile types, but just
slightly trickier for the other types. Just keep in mind that the ONLY
way to do collision detection in the game should be via this function,
other the wholy system breaks down.

/Olof

On 2/7/06, Kevin Jenkins <gameprogrammer@xxxxxxxxxx> wrote:
> Increase your granularity.  You'll have large blocks of unused data but
> that always happens anyway.  You should build your map from larger
> building blocks that are instanced to save memory.
>
> Alan Wolfe wrote:
>
> > Hey guys,
> >
> > I'm making a 2d sidescroller and the maps are just tiled in the normal
> > fashion like...
> >
> > 1 1 1 1 1 1 1
> > 1 0 0 0 0 0 0
> > 1 0 0 0 0 0 0
> > 1 0 0 0 1 0 0
> > 1 1 1 1 1 1 1
> >
> > where each number has attributes (like if it's solid or not) as well as art.
> >
> > This makes for really rectangular map though.
> >
> > Does anyone know how to make hills and slopes in a 2d sidescroller? like
> > the techniques generaly used for that, something like how mario 3
> > worked, or just being able to have 45 degree slants would be better than
> > nothing.
> >
> > thanks a bunch!
>
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
>


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: