Guest User

Untitled

a guest
Mar 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.82 KB | None | 0 0
  1. tilemap.h:
  2. **********
  3.  
  4. #include <iostream>
  5. #include <windows.h>
  6. #include <ctime>
  7. #include <cstdlib>
  8. #include player.h
  9.  
  10. using namespace std;
  11.  
  12. class tileMap
  13. {
  14.     public:
  15.         double xCoords, yCoords, xCellSize, yCellSize;
  16.         double xCheck[10];
  17.         double yCheck[10];
  18.  
  19.         tileMap(double x, double y)
  20.         {
  21.             //NOTE: Set the x and y params with respect to the cell size;
  22.             //eg. with a cell size of 10x10, a 200x100 map should be 2000x1000.
  23.             xCoords = x;
  24.             yCoords = y;
  25.             xCellSize = 10;
  26.             yCellSize = 10;
  27.         }
  28.         bool isOccupied(double x, double y)
  29.         {
  30.             for(int i = 0; i < 10; i++)
  31.             {
  32.                 if(x == xCheck[i])
  33.                 {
  34.                     for(int j = 0; j < 10; j++)
  35.                     {
  36.                         if(y == yCheck[j])
  37.                         {
  38.                             return true;
  39.                         }
  40.                         else { continue; }
  41.                     }
  42.                     return false;
  43.                 }
  44.                 else { continue; }
  45.             }
  46.             return false;
  47.         }
  48.  
  49. };
  50. **********
  51.  
  52. player.h
  53. **********
  54.  
  55. #include <iostream>
  56. #include <windows.h>
  57. #include <ctime>
  58. #include <cstdlib>
  59. #include tileMap.h
  60.  
  61. using namespace std;
  62.  
  63. class player
  64. {
  65.     public:
  66.         double xPlay, yPlay, xSize, ySize;
  67.         short health;
  68.         player()
  69.         {
  70.             health = 100;
  71.             xSize = 10;
  72.             ySize = 20;
  73.             xPlay =
  74.         }
  75. };
  76. **********
  77.  
  78. main.cpp
  79. **********
  80.  
  81. #include <iostream>
  82. #include <windows.h>
  83. #include <ctime>
  84. #include <cstdlib>
  85. #include tileMap.h
  86. #include player.h
  87.  
  88. using namespace std;
  89.  
  90. int main()
  91. {
  92.     tileMap rOne(2000,1000);
  93. }
  94. **********
Add Comment
Please, Sign In to add comment