when the game round changes, state.gameObjectsToRespawn is being checked for all the items that should be respawned in current and all the previous rounds (if they haven't yet been respawned e.g. due to players' inactivity), items to be respawned are added to state.gameObjectsToRespawnInRound array, entry that has been processed is being deleted from state.gameObjectsToRespawn
state.gameObjectsToRespawnInRound is then returned from gameStats function (which is called in most of the commands that are being called during the game), after being returned - state.gameObjectsToRespawnInRound array is being emptied
what has been returned to the game client from p. 3 is then handled by the MainScene in handleRespawned function - for each of the respawned objects new tile is put on gameObjectsLayer, new sprite is being created based on this tile in createSpriteFromTile function and after creating the sprite, tile is being removed (note that this sprite is handled differently than sprites initially created for the tilemap, otherwise we would need to recreate the whole tilemap - check src/game/scenes/main-scene/maps.js for further info)
Respawn functionality added - items will be respawned on the map after specific number of rounds has passed.
state.gameObjectsToRespawn
object (round indicating in which round it will be respawned)state.gameObjectsToRespawn
is being checked for all the items that should be respawned in current and all the previous rounds (if they haven't yet been respawned e.g. due to players' inactivity), items to be respawned are added tostate.gameObjectsToRespawnInRound
array, entry that has been processed is being deleted fromstate.gameObjectsToRespawn
state.gameObjectsToRespawnInRound
is then returned fromgameStats
function (which is called in most of the commands that are being called during the game), after being returned -state.gameObjectsToRespawnInRound
array is being emptiedhandleRespawned
function - for each of the respawned objects new tile is put ongameObjectsLayer
, new sprite is being created based on this tile increateSpriteFromTile
function and after creating the sprite, tile is being removed (note that this sprite is handled differently than sprites initially created for the tilemap, otherwise we would need to recreate the whole tilemap - checksrc/game/scenes/main-scene/maps.js
for further info)