<?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[Enemy chase player? (RESOLVED)]]></title><description><![CDATA[<p dir="auto"><strong>UPDATE:</strong> Organized &amp; Updated post, in case community members pose the same question, they will see resolution quoted below:</p>
<hr />
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/robinsonx" aria-label="Profile: RobinsonX">@<bdi>RobinsonX</bdi></a> said in <a href="/post/9892">Code for emery chasing you</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/savagebuilderkid" aria-label="Profile: SavageBuilderKid">@<bdi>SavageBuilderKid</bdi></a> You can have a timer in the enemy that would constantly trigger the following:</p>
<ul>
<li>Get the position of enemy and player</li>
<li>If enemy's x position &lt; player's x position:</li>
<li>Move right. (You can use set velocity, apply force, move by, etc. depends on what you are doing.)</li>
<li>Otherwise, move left.</li>
</ul>
<p dir="auto">This is a very simple method to emulate an enemy chasing the player. Let me know if you need more!</p>
</blockquote>
<hr />
<p dir="auto"><strong>ORIGINAL POST:</strong></p>
<p dir="auto">I am trying to conduct a study of enemy AI behavior. In my case:</p>
<ul>
<li>Player is running away from enemy</li>
<li>Enemy is chasing the player <strong>&lt;— this is where I’m stuck</strong></li>
</ul>
<hr />
<p dir="auto">I created a simple scene that mimicks the donkey kong gif below:<br />
<img src="https://assets.forum.hyperpad.com/assets/b3d29fb5-9604-40e2-a3a0-d5c7fd136851.gif" alt="A9525CFE-CFC8-4272-B51B-6B9D4C1B80A7.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">except, in my game scene, donkey kong chases mario throughout the different floor levels. No other elements.</p>
<p dir="auto">I read this excellent Enemy A.I. tutorial from hyperPad:<br />
<a href="https://hyperpad.zendesk.com/hc/en-us/articles/360029968391-How-to-Create-Artificial-Intelligence-for-an-Enemy-Slime" target="_blank" rel="noopener noreferrer nofollow ugc">https://hyperpad.zendesk.com/hc/en-us/articles/360029968391-How-to-Create-Artificial-Intelligence-for-an-Enemy-Slime</a></p>
<p dir="auto">It teaches how to have the enemy, attack a player within “x” proximity.</p>
<p dir="auto">It also explains</p>
<ul>
<li>tag system</li>
<li>get position behavior</li>
</ul>
<p dir="auto">These logic systems, provides the enemy with player coordinate awareness. Wonderful! but how do I get the enemy to chase the player?</p>
<p dir="auto">That question, is where I’m stumped, any nudge in the right direction will help me tons. Thank you</p>
]]></description><link>https://forum.hyperpad.com/topic/1625/enemy-chase-player-resolved</link><generator>RSS for Node</generator><lastBuildDate>Sat, 17 Oct 2026 12:14:23 GMT</lastBuildDate><atom:link href="https://forum.hyperpad.com/topic/1625.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Feb 2022 20:14:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Enemy chase player? (RESOLVED) on Mon, 07 Feb 2022 18:25:40 GMT]]></title><description><![CDATA[<p dir="auto">The x and y velocity / force will push the object to move.<br />
X = <strong>Horizontal</strong><br />
Y = <strong>Vertical</strong></p>
<p dir="auto">You can use <strong>If</strong> behaviors to compare the position between the enemy and player.</p>
<p dir="auto"><em>Example:</em><br />
If <code>player X</code> is greater than <code>enemy X</code> -&gt;  <strong>enemy moves right</strong></p>
]]></description><link>https://forum.hyperpad.com/post/10267</link><guid isPermaLink="true">https://forum.hyperpad.com/post/10267</guid><dc:creator><![CDATA[RobinsonX]]></dc:creator><pubDate>Mon, 07 Feb 2022 18:25:40 GMT</pubDate></item><item><title><![CDATA[Reply to Enemy chase player? (RESOLVED) on Mon, 07 Feb 2022 18:19:07 GMT]]></title><description><![CDATA[<p dir="auto">To move a physical object, you can use <strong>Set Velocity</strong> or <strong>Apply Force</strong>. <code>Set velocity</code> is great to getting the object to the <em>exact</em> x and y velocity you want - however, since you can manipulate velocity, you have the risk of having your object clip through walls if it's going fast enough. <code>Apply force</code> is great for making your object move naturally as if another player is controlling it. This also makes the object less likely to clip through walls because the object's velocity isn't being replaced but rather added / subtracted.</p>
]]></description><link>https://forum.hyperpad.com/post/10266</link><guid isPermaLink="true">https://forum.hyperpad.com/post/10266</guid><dc:creator><![CDATA[RobinsonX]]></dc:creator><pubDate>Mon, 07 Feb 2022 18:19:07 GMT</pubDate></item><item><title><![CDATA[Reply to Enemy chase player? (RESOLVED) on Mon, 07 Feb 2022 02:41:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dumbtactics" aria-label="Profile: dumbTactics">@<bdi>dumbTactics</bdi></a> as a quick guess, I suppose you can use the <strong>move to point</strong> behavior. You may have to keep track of all player positions in an array and move the enemy to each point after a certain amount of time using a timer behavior.</p>
<p dir="auto">For basic player follower functionality you can use a Timer, Get Position, and Move to Point behavior to move an enemy to a player position every ‘x’ amount of seconds.</p>
]]></description><link>https://forum.hyperpad.com/post/10265</link><guid isPermaLink="true">https://forum.hyperpad.com/post/10265</guid><dc:creator><![CDATA[TutorialDoctor]]></dc:creator><pubDate>Mon, 07 Feb 2022 02:41:50 GMT</pubDate></item></channel></rss>