| 179 | } |
| 180 | |
| 181 | void TileMap::update() { |
| 182 | position += velocity; |
| 183 | for (unsigned int i = 0; i < animatedTiles.size(); i++) { |
| 184 | Point p = animatedTiles[i].position; |
| 185 | imageLayer[p.x][p.y].bounce = imageLayer[p.x][p.y].bounce < 0.5f |
| 186 | ? 0 |
| 187 | : imageLayer[p.x][p.y].bounce - 1.0f; |
| 188 | animatedTiles[i].animation.update(); |
| 189 | imageLayer[p.x][p.y].tileIndex = |
| 190 | animatedTiles[i].animation.GetCurrentIndex(); |
| 191 | if (imageLayer[p.x][p.y].bounce == 0 && imageLayer[p.x][p.y].value == 0) { |
| 192 | imageLayer[p.x][p.y].atileIndex = 0; |
| 193 | imageLayer[p.x][p.y].tileIndex = 236; |
| 194 | remove(animatedTiles, i); |
| 195 | i--; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | void TileMap::draw(Camera *camera) { |
| 201 | if (!atlas || !atlas->sourceRectangles || t_mapSize.x <= 0 || t_mapSize.y <= 0) |
no test coverage detected