Loading Tiles
When I load tiles onto the screen, should I load each individual tile by it''self and then put it in the right place or should I have the whole area in a bitmap and load it striaght onto the screen?
-Paul9
To answer your question you must first determine whether or not there is any functionality to your map. Is it posssible for tiles to change or are any animated? If so then you should probably blit one at a time with the right RECT structure. The speed will still be very fast. If you use a huge bitmap with the map this can sometimes create problems. But many games still use that technique so decide on the maps functionality.
The way I do mine is put my tiles into a template then each tile class has 2 RECT''s one for the source of the graphic and another for the desitnation of the graphic. The source graphic rect knows where the graphic is in the template acording the the tiles state I just use a switch statement.
switch(tilestate)
{
case WALKEDON:
{
switch(tiletype)
{
case GRASS:
{
sgraphic.right=grassframe%TILES_IN_TEMP_WIDTH*TILEWIDTH+TILEWIDTH;
sgraphic.left=grassframe/TILES_IN_TEMP_WIDTH*TILEWIDTH;
etc....
hope that helps
switch(tilestate)
{
case WALKEDON:
{
switch(tiletype)
{
case GRASS:
{
sgraphic.right=grassframe%TILES_IN_TEMP_WIDTH*TILEWIDTH+TILEWIDTH;
sgraphic.left=grassframe/TILES_IN_TEMP_WIDTH*TILEWIDTH;
etc....
hope that helps
Thanks for the help, guys. Now I''m going to use a system of drawing the screen row by row and setting flags in arrays, so I can do something like:
''Can I walk on tile # 15?
if tiles(15).walkable=true then
''Blah blah
endif
Yes, I am doing this in VB because it''s my first attempt at game programming. My next project will probably be done in C++.
-Paul9
''Can I walk on tile # 15?
if tiles(15).walkable=true then
''Blah blah
endif
Yes, I am doing this in VB because it''s my first attempt at game programming. My next project will probably be done in C++.
-Paul9
February 21, 2001 07:38 AM
quote:
Original post by OoMMMoO
The way I do mine is put my tiles into a template then each tile class has 2 RECT''s one for the source of the graphic and another for the desitnation of the graphic. The source graphic rect knows where the graphic is in the template acording the the tiles state I just use a switch statement.
switch(tilestate)
{
case WALKEDON:
{
switch(tiletype)
{
case GRASS:
{
sgraphic.right=grassframe%TILES_IN_TEMP_WIDTH*TILEWIDTH+TILEWIDTH;
sgraphic.left=grassframe/TILES_IN_TEMP_WIDTH*TILEWIDTH;
etc....
hope that helps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement