<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>Enemy &#8211; AnonyViet &#8211; English Version</title>
	<atom:link href="https://en.anonyviet.com/tag/enemy/feed/" rel="self" type="application/rss+xml" />
	<link>https://en.anonyviet.com</link>
	<description>The most popular website for sharing information technology, computer networks, and security knowledge. Stay up to date with the hottest news and tips</description>
	<lastBuildDate>Thu, 02 Feb 2023 02:11:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://en.anonyviet.com/wp-content/uploads/2023/01/cropped-ico-logo-75x75-1.png</url>
	<title>Enemy &#8211; AnonyViet &#8211; English Version</title>
	<link>https://en.anonyviet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>[Lập trình game] Lesson 11: Godot&#8217;s Raycast2D Enemy &#8211; Part 2</title>
		<link>https://en.anonyviet.com/lap-trinh-game-lesson-11-godots-raycast2d-enemy-part-2/</link>
					<comments>https://en.anonyviet.com/lap-trinh-game-lesson-11-godots-raycast2d-enemy-part-2/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Thu, 02 Feb 2023 02:11:10 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Godots]]></category>
		<category><![CDATA[lập]]></category>
		<category><![CDATA[Lesson]]></category>
		<category><![CDATA[Part]]></category>
		<category><![CDATA[Raycast2D]]></category>
		<category><![CDATA[trình]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=8190</guid>

					<description><![CDATA[In this article, I will guide you to create raycast2D so that the enemy can move on the terrain as shown below without falling down. And let&#8217;s get started Join the channel Telegram of the AnonyViet 👉 Link 👈 RAYCAST2D EASY Here Raycast 2D is 1 node: Query object intersecting ray means Raycast 2D is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div>
<p>In this article, I will guide you to create raycast2D so that the enemy can move on the terrain as shown below without falling down.  And let&#8217;s get started</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage001.png" rel="noopener" class="local-link"><img alt="[Lập trình game] Lesson 11: Godot&#8217;s Raycast2D Enemy &#8211; Part 2" title="[Lập trình game] Lesson 11: Godot&#8217;s Raycast2D Enemy &#8211; Part 2" post-id="8190" fifu-featured="1" fetchpriority="high" decoding="async" class="aligncenter wp-image-19345 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage001.png" alt="[Lập trình game] Lesson 11: Godot&#8217;s Raycast2D Enemy &#8211; Part 2" title="[Lập trình game] Lesson 11: Godot&#8217;s Raycast2D Enemy &#8211; Part 2"s Raycast2D Enemy" width="538" height="362" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage001.png 538w, https://anonyviet.com/wp-content/uploads/2020/04/cimage001-300x202.png 300w" sizes="(max-width: 538px) 100vw, 538px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 14"/></a></p>
<h2>RAYCAST2D EASY</h2>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage002.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19346 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage002.png" alt="programming Enemy Raycast2D" width="213" height="463" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage002.png 213w, https://anonyviet.com/wp-content/uploads/2020/04/cimage002-138x300.png 138w" sizes="auto, (max-width: 213px) 100vw, 213px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 15"/></a></p>
<p>Here Raycast 2D is 1 node: Query object intersecting ray means Raycast 2D is 1 ray and this ray is used to query object when intersecting ray</p>
<p><strong>ENEMY</strong></p>
<p>Next is the enemy you enter the enemy&#8217;s sence</p>
<p>Find yourself <strong>raycast2D</strong></p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage003.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19347 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage003.png" alt="Raycast2D" width="242" height="130" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 16"/></a></p>
<p>And be like this</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage004.jpg" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19348 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage004.jpg" alt="Raycast2D code" width="780" height="502" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage004.jpg 780w, https://anonyviet.com/wp-content/uploads/2020/04/cimage004-300x193.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/cimage004-768x494.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/cimage004-750x483.jpg 750w" sizes="auto, (max-width: 780px) 100vw, 780px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 17"/></a></p>
<p>Here you do not use the mouse but use the right arrow key to move it to the edge <strong>collsionshape</strong></p>
<p>And almost as open as me</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage005.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-19349" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage005.png" alt="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 6" width="589" height="432" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage005.png 589w, https://anonyviet.com/wp-content/uploads/2020/04/cimage005-300x220.png 300w" sizes="auto, (max-width: 589px) 100vw, 589px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 18"/></a></p>
<p>On the side of the nature, pay attention to yourself <strong>Enable</strong> and <strong>Cast to</strong></p>
<p>live <strong>Enabled</strong> you click for yourself and <strong>raycast</strong> will turn blue</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage006.jpg" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-19350" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage006.jpg" alt="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 7" width="780" height="358" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage006.jpg 780w, https://anonyviet.com/wp-content/uploads/2020/04/cimage006-300x138.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/cimage006-768x352.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/cimage006-750x344.jpg 750w" sizes="auto, (max-width: 780px) 100vw, 780px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 19"/></a></p>
<p>LIVE <strong>cast to</strong> part <strong>y</strong> you cast it close under the enemy</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage007.jpg" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-19351" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage007.jpg" alt="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 8" width="780" height="502" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage007.jpg 780w, https://anonyviet.com/wp-content/uploads/2020/04/cimage007-300x193.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/cimage007-768x494.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/cimage007-750x483.jpg 750w" sizes="auto, (max-width: 780px) 100vw, 780px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 20"/></a></p>
<p>Like the picture, this enemy is too small so I&#8217;ll adjust the scale <strong>raycast</strong> wall <strong>0.5, 0.5</strong></p>
<p>And after adjusting the scale, you also have to adjust the other part</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage008.jpg" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-19352" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage008.jpg" alt="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 9" width="780" height="369" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage008.jpg 780w, https://anonyviet.com/wp-content/uploads/2020/04/cimage008-300x142.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/cimage008-768x363.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/cimage008-750x355.jpg 750w" sizes="auto, (max-width: 780px) 100vw, 780px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 21"/></a></p>
<p>Next we will code it</p>
<p>And Coding for me</p>
<p>Below <code>if is_on_wall</code></p>
<p>You add yourself as</p>
<p><code>if $Raycast2D.is_collding == false:</code></p>
<p><code>vitri = vitri * -1</code></p>
<p>Here <strong>$Raycat2D</strong> is called <strong>raycast2d</strong> ||<strong> is_collecting</strong> is the command: <strong>Returns whether any object is intersecting the vector ray</strong> which here we attach = false means it will not intersect at all.</p>
<p>And <code>vitri = vitri * -1</code> here means the enemy will move in reverse when on the terrain that I mentioned at the beginning of the article</p>
<p>And you notice when it has moved back but this raycast2D it doesn&#8217;t move back anymore so we need to adjust it.</p>
<p>You add <code>$RayCast2D.position.x *= -1</code> into the <strong>if is_on_wall</strong> and <strong>raycast collecting</strong> Please</p>
<p>This is the help command <strong>Raycast 2D</strong> can change direction and you can apply to other nodes like <strong>collsionshape</strong> etc</p>
<p>It is done</p>
<p>And remember to delete <strong>*delta</strong> let&#8217;s go</p>
<p>If the code does not run, the code is as below</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fcimage009-1.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19353 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/cimage009-1.png" alt="Full code godot Raycast2D" width="395" height="291" srcset="https://anonyviet.com/wp-content/uploads/2020/04/cimage009-1.png 395w, https://anonyviet.com/wp-content/uploads/2020/04/cimage009-1-300x221.png 300w" sizes="auto, (max-width: 395px) 100vw, 395px" title="[Lập trình game]  Lesson 11: Godot's Raycast2D Enemy - Part 2 22"/></a></p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;19343&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
<p><!-- AI CONTENT END 2 --></p></div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/lap-trinh-game-lesson-11-godots-raycast2d-enemy-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2020/04/cimage001.png" medium="image"></media:content>
            	</item>
		<item>
		<title>[Lập Trình Game] Lesson 12: Create HP for Enemy in Godot Engine</title>
		<link>https://en.anonyviet.com/lap-trinh-game-lesson-12-create-hp-for-enemy-in-godot-engine/</link>
					<comments>https://en.anonyviet.com/lap-trinh-game-lesson-12-create-hp-for-enemy-in-godot-engine/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Wed, 01 Feb 2023 23:52:51 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Engine]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Godot]]></category>
		<category><![CDATA[lập]]></category>
		<category><![CDATA[Lesson]]></category>
		<category><![CDATA[trình]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=8144</guid>

					<description><![CDATA[Continuing with the enemy, in this article we will create hp for the enemy and this article is quite short, in the next post I will guide you to create slash animation (because anonyviet&#8217;s available assets do not have slash animation, so I will get animation. and if you use another asset that has an [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div>
<p><strong>Continuing with the enemy, in this article we will create hp for the enemy and this article is quite short, in the next post I will guide you to create slash animation (because anonyviet&#8217;s available assets do not have slash animation, so I will get animation. and if you use another asset that has an animation attack, use it) and kill the enemy.</strong></p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>USE EXPORT</h2>
<p>Go to the script enemy and then you declare your HP variable</p>
<p>I will declare as:</p>
<p><code>export var hp = 2</code></p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fxximage001.png" rel="noopener" class="local-link"><img decoding="async" class="aligncenter wp-image-19469 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/xximage001.png" alt="use export declare variable HP" width="589" height="105" srcset="https://anonyviet.com/wp-content/uploads/2020/04/xximage001.png 589w, https://anonyviet.com/wp-content/uploads/2020/04/xximage001-300x53.png 300w" sizes="(max-width: 589px) 100vw, 589px" title="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 10"/></a></p>
<p>And Export here is the declaration command that takes the value out of the table <strong>Properties</strong> to edit</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fxximage002.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19470 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/xximage002.png" alt="Properties panel to edit" width="254" height="368" srcset="https://anonyviet.com/wp-content/uploads/2020/04/xximage002.png 254w, https://anonyviet.com/wp-content/uploads/2020/04/xximage002-207x300.png 207w" sizes="auto, (max-width: 254px) 100vw, 254px" title="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 11"/></a></p>
<p>You can also do with the same variables if you want and Export it has nothing to do with your code, it just has the function of putting the variable value out for easier editing without having to edit the code.</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fxximage003.jpg" rel="noopener" class="local-link"><img alt="[Lập Trình Game] Lesson 12: Create HP for Enemy in Godot Engine" title="[Lập Trình Game] Lesson 12: Create HP for Enemy in Godot Engine" post-id="8144" fifu-featured="1" decoding="async" loading="lazy" class="aligncenter wp-image-19471 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/xximage003.jpg" alt="[Lập Trình Game] Lesson 12: Create HP for Enemy in Godot Engine" title="[Lập Trình Game] Lesson 12: Create HP for Enemy in Godot Engine" width="781" height="244" srcset="https://anonyviet.com/wp-content/uploads/2020/04/xximage003.jpg 781w, https://anonyviet.com/wp-content/uploads/2020/04/xximage003-300x94.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/xximage003-768x240.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/xximage003-750x234.jpg 750w" sizes="auto, (max-width: 781px) 100vw, 781px" title="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 12"/></a></p>
<p>And you can apply it to many other things</p>
<p>Here I will show you a trick to choose something like color etc</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fxximage004.jpg" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter wp-image-19472 size-full" src="https://anonyviet.com/wp-content/uploads/2020/04/xximage004.jpg" alt="Color change code" width="780" height="250" srcset="https://anonyviet.com/wp-content/uploads/2020/04/xximage004.jpg 780w, https://anonyviet.com/wp-content/uploads/2020/04/xximage004-300x96.jpg 300w, https://anonyviet.com/wp-content/uploads/2020/04/xximage004-768x246.jpg 768w, https://anonyviet.com/wp-content/uploads/2020/04/xximage004-750x240.jpg 750w" sizes="auto, (max-width: 780px) 100vw, 780px" title="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 13"/></a></p>
<p><strong>Export(String,”text”) var tenbien</strong> is to be</p>
<p>Here if you want to change the color, you code as follows:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">if ColorMode == "Mau Do":&#13;
    $Sprite.modulate = Color(0, 0, 1, 1)&#13;
elif ColorMode == "Mau Xanh":&#13;
    $Sprite.modulate = Color(0.75, 0.75, 0.75, 1)&#13;
elif ColorMode == "Mau Cua Anonyviet":&#13;
    print(“Dep Trai Khong Bao Gio Sai)&#13;
</pre>
<p>What color is the if statement to compare?</p>
<p>$Call sprite or AnimationSprite or whatever and modulate to change color</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fwp-content%2Fuploads%2F2020%2F04%2Fxximage005.png" rel="noopener" class="local-link"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-19468" src="https://anonyviet.com/wp-content/uploads/2020/04/xximage005.png" alt="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 4" width="231" height="288" title="[Lập Trình Game]  Lesson 12: Create HP for Enemy in Godot Engine 14"/></a></p>
<p>You can func create a function that contains the command to change the color and then call the function to change the color in physic or process</p>
<p>Examples are as follows:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic"># ham process goi du lieu ben trong tren tung khung hinh	&#13;
Func _process(delta):&#13;
#goi set color&#13;
Setcolor()&#13;
# ham set color&#13;
Func setcolor():&#13;
    if ColorMode == "Mau Do":&#13;
        $Sprite.modulate = Color(0, 0, 1, 1)&#13;
    elif ColorMode == "Mau Xanh":&#13;
        $Sprite.modulate = Color(0.75, 0.75, 0.75, 1)&#13;
    elif ColorMode == "Mau Cua Anonyviet":&#13;
        print(“Dep Trai Khong Bao Gio Sai)&#13;
</pre>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;19467&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
<p><!-- AI CONTENT END 2 --></p></div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/lap-trinh-game-lesson-12-create-hp-for-enemy-in-godot-engine/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2020/04/xximage003.jpg" medium="image"></media:content>
            	</item>
		<item>
		<title>Download Hack Map Wild Rift to help see enemy champions on the map</title>
		<link>https://en.anonyviet.com/download-hack-map-wild-rift-to-help-see-enemy-champions-on-the-map/</link>
					<comments>https://en.anonyviet.com/download-hack-map-wild-rift-to-help-see-enemy-champions-on-the-map/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Sun, 29 Jan 2023 03:48:03 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[champions]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Map]]></category>
		<category><![CDATA[Rift]]></category>
		<category><![CDATA[Wild]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=5970</guid>

					<description><![CDATA[Recently, the publisher RIOT Games has launched a 5vs5 mobile game called League of Legends: Wild Rift aka League of Legends Wild Rift. Then the Hackers also released the Hack Map Wild Rift after a few days. Join the channel Telegram of the AnonyViet 👉 Link 👈 Like League of Legends on desktop, players will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div>
<p><strong>Recently, the publisher RIOT Games has launched a 5vs5 mobile game called <i>League of Legends: Wild Rift aka League of Legends Wild Rift.  Then the Hackers also released the Hack Map Wild Rift after a few days.</i></strong></p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Like <i>League of Legends on desktop</i>, players will immerse themselves in the fantasy world created by the broadcaster.  The same play mechanism as many other moba games like Lien Quan Mobile or Mobile Legend.  The player&#8217;s goal is to destroy the opponent&#8217;s main house and win absolute victory.  Currently, LOL Wildrift has launched an open beta for all players on some servers in Asia such as Japan, Philippines, Singapore, Thailand, Malaysia&#8230; But it&#8217;s a bit unfortunate that it will not be released until December. Male.</p>
<p>Since this is an Open Beta, RIOT will focus on fixing and fixing miscellaneous bugs.  So today I will share with you how <strong>Hack Map </strong>League of Wild Rift Full Antiban supports both Android and iOS.</p>
<h2><strong><span style="font-size: 18pt;">How to Hack Wild Rift Map</span></strong></h2>
<p>The Wild Rift Map Hack lets you see where enemy champions are on the map, even though you&#8217;re not near them.  This helps you avoid being hit by an up shot or getting into a fight at the same time, you can actively attack or defend when you know where the opponent is.</p>
<p><span style="font-size: 12pt;"><strong>Note: This is a fast-paced map hack that doesn&#8217;t need Root, so you can rest assured to follow it.</strong></span></p>
<p>Before you start, you need to download some supporting software.  I leave the link below.</p>
<p style="text-align: center;"><span style="font-size: 12pt;"><strong>Download Link:</strong></span></p>
<p style="text-align: center;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ftocchien360.com" rel="noopener" class="local-link"><strong><span style="color: #ff0000;">Download speed battle</span></strong></a></p>
<p style="text-align: center;">(Full update v50 one version)</p>
<p style="text-align: center;"><span style="text-decoration: underline;"><strong><a target="_blank" href="https://en.anonyviet.com/next-link/?url=http%3A%2F%2Fwww.fshare.vn%2Ffile%2F4ASWUCSR55Y7" rel="noopener noreferrer external nofollow" class="ext-link" onclick="this.target='_blank';">Download Hack Map Wild Rift Beta</a></strong></span></p>
<hr/>
<p style="text-align: center;"><span style="font-size: 10pt;"><strong><a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fwww.mediafire.com%2Ffile%2Fpx1t9wqhgnj9ja7%2FMuteGG_Vip_com.tencent.mobileqq.apk%2Ffile" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">Backup Game Guardian Mute GG Vip</a></strong></span></p>
<p style="text-align: center;"><span style="font-size: 10pt;"><strong><a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fwww.mediafire.com%2Ffile%2Fyowwjbt3f6ydu5p%2FParallel_Space_com.parallel.space.pro.apk%2Ffile" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">Parallel Space Backup</a></strong></span></p>
<p style="text-align: center;"><span style="font-size: 10pt;"><strong><a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fwww.mediafire.com%2Ffile%2Fg4lwn8cm08tbk3t%2FScript_Radar_Map_League_Of_Legends.lua%2Ffile" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">Backup Script Hack Map LOL Wildrift</a></strong></span></p>
<hr/>
<p>After downloading the 3 files above, you install <strong>Game Guardian</strong> and <strong>Parallel Space</strong> Just like normal apps.</p>
<p><img decoding="async" class="aligncenter wp-image-23127 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h2.png" alt="install Game Guardian and Parallel Space" width="386" height="734" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h2.png 386w, https://anonyviet.com/wp-content/uploads/2020/11/h2-158x300.png 158w" sizes="(max-width: 386px) 100vw, 386px" title="Download Hack Map Wild Rift to help see enemy champions on the map 13"/></p>
<p>Open Virtual Space (Parallel Space Pro) and select <strong>More apps</strong>.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23128 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h3.png" alt="Parallel Space Pro interface" width="351" height="723" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h3.png 351w, https://anonyviet.com/wp-content/uploads/2020/11/h3-146x300.png 146w" sizes="auto, (max-width: 351px) 100vw, 351px" title="Download Hack Map Wild Rift helps see enemy champions on the map 14"/></p>
<p>Tick ​​the icon <strong>MuteGG Vip</strong> and icon<strong> Wild Rift Alliance</strong> to add apps.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23129 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h4.png" alt="choose MuteGG Vip and Wild Rift Alliance" width="350" height="718" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h4.png 350w, https://anonyviet.com/wp-content/uploads/2020/11/h4-146x300.png 146w" sizes="auto, (max-width: 350px) 100vw, 350px" title="Download Hack Map Wild Rift helps to see enemy champions on the map 15"/></p>
<p>Then open <strong>Mute Game Guardian</strong> up and press the word <strong>Start</strong> to start the Hack.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23130 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h5.png" alt="open Mute Game Guardian" width="351" height="717" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h5.png 351w, https://anonyviet.com/wp-content/uploads/2020/11/h5-147x300.png 147w" sizes="auto, (max-width: 351px) 100vw, 351px" title="Download Hack Map Wild Rift helps to see enemy champions on the map 16"/></p>
<p>Then enter the game League of Wild Rift.  Login to your account (<a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fcach-tao-tai-khoan-toc-chien-thanh-cong%2F" rel="noopener noreferrer" class="local-link">Register for a Wild Rift account</a>).  Wait in the lobby and tap the Guardian icon on the main screen and tap the horizontal triangle button.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23131 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h6.png" alt="how to hack fast battle map" width="1074" height="519" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h6.png 1074w, https://anonyviet.com/wp-content/uploads/2020/11/h6-300x145.png 300w, https://anonyviet.com/wp-content/uploads/2020/11/h6-1024x495.png 1024w, https://anonyviet.com/wp-content/uploads/2020/11/h6-768x371.png 768w, https://anonyviet.com/wp-content/uploads/2020/11/h6-750x362.png 750w" sizes="auto, (max-width: 1074px) 100vw, 1074px" title="Download Hack Map Wild Rift to see enemy champions on map 17"/></p>
<p>Click on the ellipsis button and select file <strong>Hack Map League of Wild Rift.lua </strong>that above you have downloaded and clicked execute.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23132 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h7.png" alt="download hack map fast battle" width="991" height="523" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h7.png 991w, https://anonyviet.com/wp-content/uploads/2020/11/h7-300x158.png 300w, https://anonyviet.com/wp-content/uploads/2020/11/h7-768x405.png 768w, https://anonyviet.com/wp-content/uploads/2020/11/h7-750x396.png 750w" sizes="auto, (max-width: 991px) 100vw, 991px" title="Download Hack Map Wild Rift helps see enemy champions on the map 18"/></p>
<p>Now you create a room and find a match, choose a champion and wait when the game starts, then again click on the icon <strong>Guardian</strong> at the screen.  Check the first box as shown in the picture and click execute.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23133 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h8.png" alt="download hack map of alliance fast battle" width="1054" height="565" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h8.png 1054w, https://anonyviet.com/wp-content/uploads/2020/11/h8-300x161.png 300w, https://anonyviet.com/wp-content/uploads/2020/11/h8-1024x549.png 1024w, https://anonyviet.com/wp-content/uploads/2020/11/h8-768x412.png 768w, https://anonyviet.com/wp-content/uploads/2020/11/h8-750x402.png 750w" sizes="auto, (max-width: 1054px) 100vw, 1054px" title="Download Hack Map Wild Rift to help see enemy champions on map 19"/></p>
<p>And here is the screen <strong>Minimap</strong> of you after successfully performing the above steps to hack the speed map.  Red enemy champions will appear on the map, not hide as usual.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-23134 size-full" src="https://anonyviet.com/wp-content/uploads/2020/11/h9.png" alt="hack minimap fast battle" width="363" height="378" srcset="https://anonyviet.com/wp-content/uploads/2020/11/h9.png 363w, https://anonyviet.com/wp-content/uploads/2020/11/h9-288x300.png 288w" sizes="auto, (max-width: 363px) 100vw, 363px" title="Download Hack Map Wild Rift helps see enemy champions on the map 20"/></p>
<p style="text-align: left;">This is a large-scale open beta, so hacking this Wild Rift map will help Riot fix and patch the bugs to complete the official version, so you don&#8217;t need to worry too much.  To experience the game effectively, you should not use hacks.</p>
<p>Game homepage: <a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Flienminhhuyenthoaitocchien.com" rel="noopener" class="local-link">https://lienminhhuyenthoaitocchien.com</a></p>
<p style="text-align: right;"><strong>Good luck</strong><br /><strong>TMQ.</strong></p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;23126&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
<p><!-- AI CONTENT END 2 --></p></div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/download-hack-map-wild-rift-to-help-see-enemy-champions-on-the-map/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2020/11/hqdefault.jpg" medium="image"></media:content>
            	</item>
		<item>
		<title>Creating a 2D Platformer Game with Godot]Part 7: Enemy Design</title>
		<link>https://en.anonyviet.com/creating-a-2d-platformer-game-with-godotpart-7-enemy-design/</link>
					<comments>https://en.anonyviet.com/creating-a-2d-platformer-game-with-godotpart-7-enemy-design/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Fri, 27 Jan 2023 02:50:52 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[creating]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[GodotPart]]></category>
		<category><![CDATA[Platformer]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=4541</guid>

					<description><![CDATA[Enemies or monsters are an indispensable thing in Platformer or Rpg games. So, in this part I will show you how to design an enemy and how the design will last 2 or 3 parts. Join the channel Telegram of the AnonyViet 👉 Link 👈 Art As for the Art part, you can download it [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p><strong>Enemies or monsters are an indispensable thing in Platformer or Rpg games.  So, in this part I will show you how to design an enemy and how the design will last 2 or 3 parts.</strong></p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2 id="ftoc-art" class="ftwp-heading">Art</h2>
<p>As for the Art part, you can download it via the au link: <a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fopengameart.org%2Fcontent%2Fdesert-enemy-pixel-art-game-characters" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">Desert Enemy Pixel Art Game Characters</a><img decoding="async" class="aligncenter wp-image-36446 size-full" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-12-38.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design" width="274" height="204" title="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 20"/></p>
<p>After downloading, in Assets create a new folder called KeThu and copy all the art into it.</p>
<h2 id="ftoc-tao-ke-thu" class="ftwp-heading">Create enemies</h2>
<h3 id="ftoc-tao-scene-moi" class="ftwp-heading">Create a new scene</h3>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36447 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-16-17.png" alt="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 17" width="291" height="120" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 21"/></p>
<p>Like Player, you will create a kinematicbody and here I rename it Cao (that fox) and add 2 more child buttons, AnimatedSprt and CollisionShape2D.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36448 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-17-29.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 18" width="256" height="69" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 22"/></p>
<p>You create new Frames in AnimatedSprite.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36450 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-19-42.png" alt="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 19" width="424" height="230" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-19-42.png 424w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-19-42-300x163.png 300w" sizes="auto, (max-width: 424px) 100vw, 424px" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 23"/></p>
<p>Here I add 5 animations corresponding to art.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36451 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-21-51.png" alt="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 20" width="247" height="195" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 24"/></p>
<p>This is after adding the animation and it shows up.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36452 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-25.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 21" width="317" height="94" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-25.png 317w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-25-300x89.png 300w" sizes="auto, (max-width: 317px) 100vw, 317px" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 25"/></p>
<p>You add CollisioShape to it<br /><img decoding="async" loading="lazy" class="size-full wp-image-36453 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-37.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 22" width="236" height="170" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-37.png 236w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-37-120x86.png 120w" sizes="auto, (max-width: 236px) 100vw, 236px" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 26"/></p>
<p>Done then rotate CollisionShape2D to landscape.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36455 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-23-03.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 23" width="155" height="66" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 27"/></p>
<p>Click on the toolbar to make adjustments.</p>
</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36454 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-22-54.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 24" width="260" height="181" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 28"/></p>
<p>Then adjust the AnimatedSprite to fit the CollisionShape2D.</p>
<p><strong>Note: You always take the CollisionShape as the alignment point and don&#8217;t change the position or something of the CollisionShape .</strong></p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36457 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-28-41.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 25" width="284" height="80" title="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 29"/></p>
<p>Done then save the scene, I create a new folder in Scenes called Kethu and save it there.</p>
<h3 id="ftoc-them-script" class="ftwp-heading">More Scripts</h3>
<p>Next is the code part.<img decoding="async" loading="lazy" class="size-full wp-image-36456 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-27-44.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 26" width="302" height="136" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-27-44.png 302w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-27-44-300x135.png 300w" sizes="auto, (max-width: 302px) 100vw, 302px" title="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 30"/></p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36458 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-29-19.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 27" width="364" height="334" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-29-19.png 364w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-29-19-300x275.png 300w" sizes="auto, (max-width: 364px) 100vw, 364px" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 31"/></p>
<p>Add a little script.</p>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="eclipse">extends KinematicBody2D&#13;
&#13;
&#13;
var tocdo = 60&#13;
var trongluc = 10&#13;
var chuyendong = Vector2()&#13;
var huong_dichuyen = 1&#13;
onready var animation = $AnimatedSprite&#13;
&#13;
func _physics_process(delta):&#13;
    &#13;
    chuyendong.x = tocdo * huong_dichuyen&#13;
    chuyendong.y += trongluc&#13;
    chuyendong = move_and_slide(chuyendong,Vector2.UP)&#13;
    &#13;
    if is_on_wall():&#13;
        huong_dichuyen = huong_dichuyen * -1&#13;
</pre>
</p>
<p>Here, it is no different from Player as it needs 4 basic variables to be able to move and 1 variable to be able to use animation.</p>
<p>Change direction_dichuyen because this is AI so you don&#8217;t have to press the button to move it or anything, so I&#8217;ll set it to 1 by default.</p>
<p>At the function <strong>_physics_process(delta):</strong></p>
<ul>
<li>The first 3 lines are not far away</li>
<li>Current <strong>if is_on_wall() </strong>is a function that allows you to check if an enemy child is on the move and with whom it touches.</li>
<li>Below I will check if moving to the right meets a wall or something, it will turn to the left to move forward and vice versa.</li>
</ul>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36459 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-41-04.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 28" width="244" height="167" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 32"/></p>
<p>Then you Instance the fox into the Map so you can see it has moved.</p>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python">func _physics_process(delta):&#13;
    &#13;
    chuyendong.x = tocdo * huong_dichuyen&#13;
    chuyendong.y += trongluc&#13;
    chuyendong = move_and_slide(chuyendong,Vector2.UP)&#13;
    animation.play("dichuyen")&#13;
    &#13;
    if is_on_wall():&#13;
        huong_dichuyen = huong_dichuyen * -1&#13;
        scale.x = scale.y * huong_dichuyen</pre>
</p>
<p>At the function <strong>_physics_process(): </strong>then I added 2 command lines to be able to run the animation and rotate the image left and right.<img post-id="4541" fifu-featured="1" decoding="async" loading="lazy" class="size-full wp-image-36462 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-58-43.png" alt="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design" width="363" height="234" srcset="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-58-43.png 363w, https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-58-43-300x193.png 300w" sizes="auto, (max-width: 363px) 100vw, 363px" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 33"/></p>
<p>This is the result.<br /><img decoding="async" loading="lazy" class="size-full wp-image-36461 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-52-40.png" alt="Creating 2D Platformer Game with Godot]Part 7: Enemy Design 30" width="216" height="46" title="Creating a 2D Platformer Game with Godot]Part 7: Enemy Design 34"/></p>
<p>Sometimes the Sprite will be inverted and you can correct it by adjusting the Flip_H of the Sprite or AnimatedSprite.</p>
<h2 id="ftoc-tong-ket" class="ftwp-heading">Summary</h2>
<p>So in this part you can already make the most basic enemy, in the next part I will show you how to make it move on the surface.</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;36445&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/creating-a-2d-platformer-game-with-godotpart-7-enemy-design/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2021/11/11-11-2021-11-58-43.png" medium="image"></media:content>
            	</item>
		<item>
		<title>Creating 2D Platformer Game with Godot]Part 8: Enemy Design</title>
		<link>https://en.anonyviet.com/creating-2d-platformer-game-with-godotpart-8-enemy-design/</link>
					<comments>https://en.anonyviet.com/creating-2d-platformer-game-with-godotpart-8-enemy-design/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Fri, 27 Jan 2023 02:34:47 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[creating]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[GodotPart]]></category>
		<category><![CDATA[Platformer]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=4532</guid>

					<description><![CDATA[In the previous section, I showed you how to create the most basic enemy, in this part I will show you how to make the enemy move on a floating surface. Join the channel Telegram of the AnonyViet 👉 Link 👈 Enemy With the surface like above, I guarantee that when your enemy moves to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p>In the previous section, I showed you how to create the most basic enemy, in this part I will show you how to make the enemy move on a floating surface.</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2 id="ftoc-ke-thu" class="ftwp-heading">Enemy</h2>
<p><img decoding="async" class="aligncenter wp-image-36464 size-full" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-02-29.png" alt="Creating 2D Platformer Game with Godot]Part 8: Enemy Design" width="463" height="145" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-02-29.png 463w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-02-29-300x94.png 300w" sizes="(max-width: 463px) 100vw, 463px" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 12"/></p>
<p>With the surface like above, I guarantee that when your enemy moves to one of the two outer corners it will drop but usually in platformet games when it moves to the corner it will return like and hit the wall in the front part.</p>
<p>So in this section I will show you how to do this.</p>
<h3 id="ftoc-add-node" class="ftwp-heading">Add node</h3>
<p>First, you add yourself a new node, RayCast2D (this is the node used to query for targets that collide with rays).<img decoding="async" loading="lazy" class="size-full wp-image-36465 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-07-14.png" alt="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 9" width="312" height="325" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-07-14.png 312w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-07-14-288x300.png 288w" sizes="auto, (max-width: 312px) 100vw, 312px" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 13"/></p>
<p>This is a raycast and I&#8217;m going to use it to check if I&#8217;ve reached the corner I&#8217;ll call the enemy to turn around.<img decoding="async" loading="lazy" class="size-full wp-image-36469 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-14-53.png" alt="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 10" width="284" height="187" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 14"/></p>
<p>I&#8217;ll make it shorter and turn it on.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36468 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-14-39.png" alt="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 11" width="365" height="325" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-14-39.png 365w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-14-39-300x267.png 300w" sizes="auto, (max-width: 365px) 100vw, 365px" title="Creating 2D Platformer Game with Godot]Part 8: Enemy Design 15"/></p>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="python">func _physics_process(delta):&#13;
    &#13;
    chuyendong.x = tocdo * huong_dichuyen&#13;
    chuyendong.y += trongluc&#13;
    chuyendong = move_and_slide(chuyendong,Vector2.UP)&#13;
    animation.play("dichuyen")&#13;
    &#13;
    if is_on_wall():&#13;
        huong_dichuyen = huong_dichuyen * -1&#13;
        scale.x = scale.y * huong_dichuyen&#13;
    &#13;
    if $RayCast2D.is_colliding() == false:&#13;
        huong_dichuyen = huong_dichuyen * -1&#13;
        scale.x = scale.y * huong_dichuyen</pre>
<p>Here, I only added 3 lines of code, not much more.</p>
<p>First, the if line:</p>
<ul>
<li>I&#8217;m going to call the raycast node and check if it&#8217;s colliding with something, if not then I&#8217;ve reached the corner then come back.</li>
<li>The remaining 2 lines are used to rotate the enemy.</li>
<li>the line scale.x = … actually you can leave the if outside, but not in the function, but I don&#8217;t because to optimize it, I put it in the if statement, so it only runs when it happens. If you leave it out, it always runs -> what the result is, you can guess.</li>
</ul>
<p><img post-id="4532" fifu-featured="1" decoding="async" loading="lazy" class="size-full wp-image-36470 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-20-21.png" alt="Creating 2D Platformer Game with Godot]Part 8: Enemy Design" title="Creating 2D Platformer Game with Godot]Part 8: Enemy Design" width="529" height="250" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-20-21.png 529w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-20-21-300x142.png 300w" sizes="auto, (max-width: 529px) 100vw, 529px" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 16"/></p>
<p>This is the result after I run the game.</p>
<h3 id="ftoc-cach-hoat-dong" class="ftwp-heading">How it works</h3>
<p>If you do not understand, I will explain in more detail here.<img decoding="async" loading="lazy" class="size-full wp-image-36471 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-21-19.png" alt="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 13" width="311" height="253" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-21-19.png 311w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-21-19-300x244.png 300w" sizes="auto, (max-width: 311px) 100vw, 311px" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 17"/></p>
<p>Here is the enemy when it&#8217;s not out of the corner, and the Raycast it is colliding with the tilemap as shown in the image.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36472 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-22-19.png" alt="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 14" width="319" height="222" srcset="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-22-19.png 319w, https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-22-19-300x209.png 300w" sizes="auto, (max-width: 319px) 100vw, 319px" title="Creating a 2D Platformer Game with Godot]Part 8: Enemy Design 18"/></p>
<p>And here is the enemy, when it reaches the corner, you see that the raycast has come out of the tilemap (the raycast collides at the sharp corner of the arrow), when it goes out, it will not collide with anything Also, in the script, I added an if to check if it doesn&#8217;t collide, then go back.</p>
<h2 id="ftoc-tong-ket" class="ftwp-heading">Summary</h2>
<p>So I have guided you through how to create the most basic character, in the next part will be moving between levels, killing enemies.</p>
</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;36463&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/creating-2d-platformer-game-with-godotpart-8-enemy-design/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-12-20-21.png" medium="image"></media:content>
            	</item>
		<item>
		<title>[Tạo 2D Platformer Game với Godot] Part 11: Attack of the enemy</title>
		<link>https://en.anonyviet.com/tao-2d-platformer-game-voi-godot-part-11-attack-of-the-enemy/</link>
					<comments>https://en.anonyviet.com/tao-2d-platformer-game-voi-godot-part-11-attack-of-the-enemy/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Thu, 26 Jan 2023 23:17:11 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Attack]]></category>
		<category><![CDATA[Enemy]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Godot]]></category>
		<category><![CDATA[Part]]></category>
		<category><![CDATA[Platformer]]></category>
		<category><![CDATA[tạo]]></category>
		<category><![CDATA[với]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=4421</guid>

					<description><![CDATA[In this part I will show you how to set up attack on enemies and in the next part I will show you how to damage/kill enemies, player. Join the channel Telegram of the AnonyViet 👉 Link 👈 Attack setting In the previous section, I showed you how to set up the enemy and in [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p>In this part I will show you how to set up attack on enemies and in the next part I will show you how to damage/kill enemies, player.</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2 id="ftoc-thiet-lap-tan-cong" class="ftwp-heading">Attack setting</h2>
<p><img decoding="async" class="aligncenter wp-image-36608 size-full" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-47-03.png" alt="[Tạo 2D Platformer Game với Godot]  Part 10: Attack of the Enemy" width="385" height="81" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-47-03.png 385w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-47-03-300x63.png 300w" sizes="(max-width: 385px) 100vw, 385px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the enemy 12"/></p>
<p>In the previous section, I showed you how to set up the enemy and in it the above code is used to determine when it meets the wall and it will turn around.</p>
<p>But here when it meets the Player, it also turns around so we have to determine that when it hits the wall and it&#8217;s not the Player, it will turn around.</p>
<p>And vice versa, if I collide with a wall and it&#8217;s a Player, I&#8217;ll make the enemy&#8217;s child attack.</p>
<h3 id="ftoc-add-node" class="ftwp-heading">Add node</h3>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36609 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-50-59.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the enemy 9" width="307" height="199" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-50-59.png 307w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-10-50-59-300x194.png 300w" sizes="auto, (max-width: 307px) 100vw, 307px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 13"/></p>
<p>You add yourself a raycast node named XacDinhPlayer (this raycast node I use to determine if the Player is standing in front of the enemy, it will attack).</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36611 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-03-12.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Enemy's Attack 10" width="572" height="237" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-03-12.png 572w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-03-12-300x124.png 300w" sizes="auto, (max-width: 572px) 100vw, 572px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 14"/></p>
<p>Done, you adjust to horizontal and the raycast arrow should not collide with CollisionShape2D.</p>
<p>You turn it on and adjust the Cast To.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">var dangtancong = false&#13;
func _physics_process(delta):&#13;
    if dangtancong == false:&#13;
        chuyendong.x = tocdo * huong_dichuyen&#13;
        chuyendong.y += trongluc&#13;
        chuyendong = move_and_slide(chuyendong,Vector2.UP)&#13;
        animation.play("dichuyen")&#13;
        &#13;
        if $RayCast2D.is_colliding() == false:&#13;
            huong_dichuyen = huong_dichuyen * -1&#13;
            scale.x = scale.y * huong_dichuyen&#13;
        &#13;
        if is_on_wall() and $XacDinhPlayer.is_colliding() == false:&#13;
            huong_dichuyen = huong_dichuyen * -1&#13;
            scale.x = scale.y * huong_dichuyen&#13;
    &#13;
    var coll = $XacDinhPlayer.get_collider()&#13;
    if coll != null and coll.name == "Player" and dangtancong == false:&#13;
        dangtancong = true&#13;
        animation.play("tancong")</pre>
<p>I will have the same code as Player&#8217;s attack.</p>
<p>I omitted the moving part <code class="EnlighterJSRAW" data-enlighter-language="generic">if dangtancong == false:</code> is to move if not in attack mode and vice versa.</p>
<p>Current <code class="EnlighterJSRAW" data-enlighter-language="generic">if is_on_wall() and $XacDinhPlayer.is_colliding() == false:</code> then i add <code class="EnlighterJSRAW" data-enlighter-language="generic">$XacDinhPlayer.is_colliding() == false</code> is to determine that when it encounters a wall, if it&#8217;s a Player, it doesn&#8217;t rotate and vice versa.</p>
<p>Current <code class="EnlighterJSRAW" data-enlighter-language="generic">var coll = $XacDinhPlayer.get_collider()</code> I will create a variable and assign it as <code class="EnlighterJSRAW" data-enlighter-language="generic">$XacDinhPlayer.get_collider() là</code> jaw<strong> get_collider()</strong> allow me to identify <strong>RayCast</strong> which node is colliding with, I will assign the colliding node to the coll variable.</p>
<p>Current <code class="EnlighterJSRAW" data-enlighter-language="generic">if coll != null and coll.name == "Player" and dangtancong == false:</code> I check if <strong>col</strong> has been assigned with a node and the name is “<strong>Player</strong>” and not in attack state, it will perform the attack.</p>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">func _on_AnimatedSprite_animation_finished():&#13;
    if animation.animation == "tancong":&#13;
        dangtancong = false</pre>
<p><img decoding="async" loading="lazy" class="size-full wp-image-36612 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-11-55.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 11" width="314" height="183" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-11-55.png 314w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-11-55-300x175.png 300w" sizes="auto, (max-width: 314px) 100vw, 314px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Enemy's Attack 15"/> <img decoding="async" loading="lazy" class="size-full wp-image-36613 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-12-03.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the enemy 12" width="301" height="223" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the enemy 16"/> <img decoding="async" loading="lazy" class="size-full wp-image-36614 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-12-15.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 13" width="590" height="489" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-12-15.png 590w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-12-15-300x249.png 300w" sizes="auto, (max-width: 590px) 100vw, 590px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 17"/></p>
<p>I thought it was similar to the Player side, I needed to add a function to determine when the animation ended <strong>dangtancong = false </strong>by connecting the signal.</p>
<p><img alt="[Tạo 2D Platformer Game với Godot] Part 11: Attack of the enemy" title="[Tạo 2D Platformer Game với Godot] Part 11: Attack of the enemy" post-id="4421" fifu-featured="1" decoding="async" loading="lazy" class="size-full wp-image-36610 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-01-23.png" alt="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 14" width="436" height="276" srcset="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-01-23.png 436w, https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-01-23-300x190.png 300w" sizes="auto, (max-width: 436px) 100vw, 436px" title="[Tạo 2D Platformer Game với Godot]  Part 11: Attack of the Enemy 18"/></p>
<p>And this is the final result.</p>
<h2 id="ftoc-tong-ket" class="ftwp-heading">Summary</h2>
<p>So I&#8217;ve finished showing you how to do it, if you have any questions, please Join<strong> Godot Community Group VN</strong> or <strong>Anonyviet Community</strong> for answers,</p>
</p>
</p>
</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;36607&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/tao-2d-platformer-game-voi-godot-part-11-attack-of-the-enemy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-11-01-23.png" medium="image"></media:content>
            	</item>
	</channel>
</rss>
