summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-06-14 23:26:45 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-06-14 23:26:45 -0400
commit17a6fb6340828b169e4a40c8ebf6b624385e8fc6 (patch)
tree8f0f3035ec8b828b4382edbbeb3d8395fb3ba133
parentdots and new sprites (diff)
downloadtuxman-17a6fb6340828b169e4a40c8ebf6b624385e8fc6.tar.gz
tuxman-17a6fb6340828b169e4a40c8ebf6b624385e8fc6.tar.bz2
tuxman-17a6fb6340828b169e4a40c8ebf6b624385e8fc6.zip
bix fix
-rw-r--r--client/js/gfx/graphics.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/js/gfx/graphics.js b/client/js/gfx/graphics.js
index 31565a8..158738c 100644
--- a/client/js/gfx/graphics.js
+++ b/client/js/gfx/graphics.js
@@ -52,7 +52,13 @@ const create_map_dot = (data, x, y) => {
return dot
}
-const update_item_sprites = (data) => {
+const update_item_sprites = (data, sprites) => {
+
+ for (const sprite of sprites) {
+ if (sprite !== undefined) {
+ sprite.destroy()
+ }
+ }
let item_sprites = {}
@@ -95,7 +101,7 @@ export const startGraphicsUpdater = () => {
}
if (Object.keys(item_sprites).length !== Object.keys(data.map.items).length) {
- item_sprites = update_item_sprites(data)
+ item_sprites = update_item_sprites(data, item_sprites)
console.log("updating item sprites")
}