<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[EntityMap iterator]]></title><description><![CDATA[<p>Is there a better way to do this? I want to call update on all player objects in this.</p>
<pre><code>players: EntityMap&lt;Player&gt; = {};

..
..

for (let client of this.clients)
{
    this.state.players[client.sessionId].update(dt);
}
</code></pre>
]]></description><link>http://discuss.colyseus.io/topic/101/entitymap-iterator</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 09:13:22 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/101.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Jun 2018 11:23:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to EntityMap iterator on Invalid Date]]></title><description><![CDATA[<p>Is there a better way to do this? I want to call update on all player objects in this.</p>
<pre><code>players: EntityMap&lt;Player&gt; = {};

..
..

for (let client of this.clients)
{
    this.state.players[client.sessionId].update(dt);
}
</code></pre>
]]></description><link>http://discuss.colyseus.io/post/328</link><guid isPermaLink="true">http://discuss.colyseus.io/post/328</guid><dc:creator><![CDATA[plyoung]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to EntityMap iterator on Tue, 19 Jun 2018 09:56:03 GMT]]></title><description><![CDATA[<pre><code>    players: EntityMap&lt;Player&gt; = {};

    ........
    //add players something like this 
    const player = new Player(client.sessionId);
    this.players[client.sessionId] = player; 

    ........

    for (let sessionId in this.players) {
           this.players[sessionId].update();
    }</code></pre>
]]></description><link>http://discuss.colyseus.io/post/333</link><guid isPermaLink="true">http://discuss.colyseus.io/post/333</guid><dc:creator><![CDATA[AnubisCode]]></dc:creator><pubDate>Tue, 19 Jun 2018 09:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to EntityMap iterator on Tue, 19 Jun 2018 08:05:08 GMT]]></title><description><![CDATA[<p>I know how to add players to the entity map. I am trying to find a better way to loop pver them without adding more variables. I was hoping the EntityMap had an iterator I did not know about.</p>
<p>Atm I must iterate over the list of clients to get an Id I can use to get a reference to a player object so I can call the update() function on that player object. This feels like a lot of work that could be made simpler.</p>
<p>Btw, I do not understanding your code. To me it looks like it would error out. The loop does not make use of &quot;sessionId&quot; at all and is calling update() on the players object which is of EntiyMap type.</p>
]]></description><link>http://discuss.colyseus.io/post/335</link><guid isPermaLink="true">http://discuss.colyseus.io/post/335</guid><dc:creator><![CDATA[plyoung]]></dc:creator><pubDate>Tue, 19 Jun 2018 08:05:08 GMT</pubDate></item><item><title><![CDATA[Reply to EntityMap iterator on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/90">@plyoung</a> updated the code, yeah missed one thing.</p>
]]></description><link>http://discuss.colyseus.io/post/337</link><guid isPermaLink="true">http://discuss.colyseus.io/post/337</guid><dc:creator><![CDATA[AnubisCode]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to EntityMap iterator on Tue, 19 Jun 2018 13:01:07 GMT]]></title><description><![CDATA[<p>oh, I see.. Use &quot;in&quot; rather than &quot;of&quot;.<br />
It looks much better now. Thanks.</p>
]]></description><link>http://discuss.colyseus.io/post/338</link><guid isPermaLink="true">http://discuss.colyseus.io/post/338</guid><dc:creator><![CDATA[plyoung]]></dc:creator><pubDate>Tue, 19 Jun 2018 13:01:07 GMT</pubDate></item></channel></rss>