| 150 | } |
| 151 | |
| 152 | void TileMap::initialize(float x, float y, int w, int h, float tilewidth, |
| 153 | float tileheight, float depth, TileAtlas *ptexatlas, |
| 154 | bool has_c_map, int itype, int ctype) { |
| 155 | position = Vector2(x, y); |
| 156 | w_tileSize = Vector2(tilewidth, tileheight); |
| 157 | w_depth = depth; |
| 158 | has_c_Map = has_c_map; |
| 159 | atlas = ptexatlas; |
| 160 | |
| 161 | imageLayer.clear(); |
| 162 | collisionLayer.clear(); |
| 163 | animatedTiles.clear(); |
| 164 | |
| 165 | t_mapSize = Point(w, h); |
| 166 | if (has_c_Map) |
| 167 | t_cmapSize = Point(w, h); |
| 168 | for (int col = 0; col < w; col++) { |
| 169 | imageLayer.push_back(vector<ITile>()); |
| 170 | if (has_c_Map) |
| 171 | collisionLayer.push_back(vector<CTile>()); |
| 172 | for (int row = 0; row < h; row++) { |
| 173 | imageLayer.back().push_back(ITile(itype, 0, NULL)); |
| 174 | if (has_c_Map) |
| 175 | collisionLayer.back().push_back( |
| 176 | CTile(ctype, (ctype != 0), entry_type[ctype], NULL)); |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | void TileMap::update() { |
| 182 | position += velocity; |