From ad491adb50723f64b1543178b2008689d649e1e0 Mon Sep 17 00:00:00 2001 From: zakarya Date: Tue, 7 Mar 2023 08:52:34 -0800 Subject: [PATCH] Change "image" to "type" in node class --- script/game.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/game.js b/script/game.js index 40541a6..e3be4bb 100644 --- a/script/game.js +++ b/script/game.js @@ -153,7 +153,7 @@ function message(type, data) { //incoming message else if (type === "world") { nodes = new Set(); data.forEach(function(itr, idx) { - let this_node = new node(new vector(itr.position.x, itr.position.y), itr.rotation, itr.radius, itr.size, itr.image); + let this_node = new node(new vector(itr.position.x, itr.position.y), itr.rotation, itr.radius, itr.size, itr.type); }); } else if (type === "server_data") { @@ -265,8 +265,7 @@ function render_nodes() { ctx.save(); let position = global_to_canvas(itr.position); let rotation = itr.rotation; - let image = game_data.world.biome.forest[itr.image].img; - //let image = game_data.world.biome.forest.tree.img; + let image = game_data.world.biome.forest[itr.type].img; ctx.translate(position.x, position.y); ctx.rotate(rotation);