MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / update

Method update

engine/src/tile.cpp:181–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181void 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
200void TileMap::draw(Camera *camera) {
201 if (!atlas || !atlas->sourceRectangles || t_mapSize.x <= 0 || t_mapSize.y <= 0)

Callers 1

G_updateFunction · 0.45

Calls 2

removeFunction · 0.85
GetCurrentIndexMethod · 0.80

Tested by

no test coverage detected