Help on a function (Draw Map)

This is a discussion on Help on a function (Draw Map) within the C++ Programming forums, part of the General Programming Boards category; Hello, I used to program in QBasic, but I am now working on a C++ program. It is a RPG, ...

  1. #1
    SublicK
    Guest

    Exclamation Help on a function (Draw Map)

    Hello,

    I used to program in QBasic, but I am now working on a C++ program. It is a RPG, which I started in QBasic but I found it too limiting. One of the things I made in QBasic was the Draw Map function.... But I am having some troubles making it in C++....

    Here it is:

    Code:
    void DrawMap()
    {
     MapOffsetX = CameraX % TileSize;
     MapOffsetY = CameraY % TileSize;
    
     for (MapDrawY=0,MapDrawY == ScreenOffsetY,MapDrawY++)
         {
           for (MapDrawX=0,MapDrawX == ScreenOffsetX,MapDrawX++)
               {
                 MapDrawRead[1] = Map[Layer1][MapDrawX + CameraX / TileSize - ScreenOffsetX][MapDrawY + CameraY / TileSize - ScreenOffsetY];
                 MapDrawRead[2] = Map[Layer2][MapDrawX + CameraX / TileSize - ScreenOffsetX][MapDrawY + CameraY / TileSize - ScreenOffsetY];
                 MapDrawRead[3] = Map[Layer3][MapDrawX + CameraX / TileSize - ScreenOffsetX][MapDrawY + CameraY / TileSize - ScreenOffsetY];
                 MapDrawRead[4] = Map[Layer4][MapDrawX + CameraX / TileSize - ScreenOffsetX][MapDrawY + CameraY / TileSize - ScreenOffsetY];
    
                 for (int DrawLayer=0,DrawLayer == 2,DrawLayer++)
                     {
    
                      if (MapDrawRead[DrawLayer] == 0)
                         rectfill(screen,MapDrawX * TileSize - MapOffsetX,MapDrawY * TileSize - MapOffsetY,MapOffsetX * TileSize - MapOffsetX + TileSize,MapDrawY * TileSize - MapOffsetY + TileSize,1000);
    
                      if (MapDrawRead[DrawLayer] == 1)
                         rectfill(screen,MapDrawX * TileSize - MapOffsetX,MapDrawY * TileSize - MapOffsetY,MapOffsetX * TileSize - MapOffsetX + TileSize,MapDrawY * TileSize - MapOffsetY + TileSize,2000);
    
                      if (MapDrawRead[DrawLayer] == 2)
                         rectfill(screen,MapDrawX * TileSize - MapOffsetX,MapDrawY * TileSize - MapOffsetY,MapOffsetX * TileSize - MapOffsetX + TileSize,MapDrawY * TileSize - MapOffsetY + TileSize,3000);
    
                      if (MapDrawRead[DrawLayer] == 3)
                         rectfill(screen,MapDrawX * TileSize - MapOffsetX,MapDrawY * TileSize - MapOffsetY,MapOffsetX * TileSize - MapOffsetX + TileSize,MapDrawY * TileSize - MapOffsetY + TileSize,4000);
    
    
                     }
               }
         }
    }
    Don't worry - Im going to change all of those if map = 3 to a switch......

    It says that there are parce errors??? I can't see any... can anyone help..

    Thanks

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    for loops should be written like -

    for (MapDrawY=0;MapDrawY == ScreenOffsetY;MapDrawY++)
    zen

  3. #3
    SublicK
    Guest
    Wow....Im so stupid :P


    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21