<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Animation on Godot 4 レシピ</title><link>https://kamera25.github.io/godot_recipes/4.x/animation/index.html</link><description>Recent content in Animation on Godot 4 レシピ</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://kamera25.github.io/godot_recipes/4.x/animation/index.xml" rel="self" type="application/rss+xml"/><item><title>Spritesheet animation</title><link>https://kamera25.github.io/godot_recipes/4.x/animation/spritesheet_animation/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/animation/spritesheet_animation/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to use a spritesheet containing 2D animations.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Spritesheets are a common way for 2D animations to be distributed. In a spritesheet, all of the animation frames are packed into a single image.&lt;/p&gt;
&lt;p&gt;For this demo, we&amp;rsquo;ll be using the excellent &amp;ldquo;Adventurer&amp;rdquo; sprite by Elthen. You can get this and lots of other great art at&lt;a href="https://elthen.itch.io/" target="_blank"&gt;https://elthen.itch.io/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-383b868bb0ef03b746a887d04dc325ba" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/adventurer_sprite_sheet_v1.1.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-383b868bb0ef03b746a887d04dc325ba"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/adventurer_sprite_sheet_v1.1.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;div class="box notices cstyle warning"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-exclamation-triangle"&gt;&lt;/i&gt; Warning&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;Make sure the images in your spritesheet are laid out in a constant-sized grid. This will enable Godot to automatically slice them. If they&amp;rsquo;re packed irregularly, you will not be able to use the following technique.&lt;/p&gt;</description></item><item><title>Melee attacks</title><link>https://kamera25.github.io/godot_recipes/4.x/animation/melee_attacks/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/animation/melee_attacks/index.html</guid><description>&lt;div class="box notices cstyle tip"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-lightbulb"&gt;&lt;/i&gt; Tip&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;This article is being updated from Godot 3 to Godot 4.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want to implement a melee attack, such as a sword or punch.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;For this example, we&amp;rsquo;ll assume we have already set up a character with one or more attack animations. To illustrate, we&amp;rsquo;ll use these two attacks:&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-4eead497fc1a89010ea9717490aeb38b" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/img/attack2.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-4eead497fc1a89010ea9717490aeb38b"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/img/attack2.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-dc732470ea139069c966e8b08a4c6de9" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/img/attack1.png" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-dc732470ea139069c966e8b08a4c6de9"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/godot_recipes/3.x/img/attack1.png" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can detect the sword hitting the target using an &lt;i class="gd-Area2D"&gt;&lt;/i&gt;&lt;code&gt;Area2D&lt;/code&gt;, but we only want that area to be active during the swing. In order for this activation to be in sync with the animation, we&amp;rsquo;ll use the AnimationPlayer to control it.&lt;/p&gt;</description></item><item><title>Using the AnimationTree StateMachine</title><link>https://kamera25.github.io/godot_recipes/4.x/animation/using_animation_sm/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/animation/using_animation_sm/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;A common situation: you have a large number of animations, and it&amp;rsquo;s becoming difficult to manage transitions between them. Your code has become full of &lt;code&gt;if&lt;/code&gt; statements, and every time you change something, it all breaks.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Use an &lt;i class="gd-AnimationTree"&gt;&lt;/i&gt;&lt;code&gt;AnimationTree&lt;/code&gt; to create an animation &lt;em&gt;state machine&lt;/em&gt;. This will allow us to organize our animations and most importantly, control the transitions between them.&lt;/p&gt;
&lt;h3 id="getting-started"&gt;Getting started&lt;/h3&gt;
&lt;p&gt;For this demo, we&amp;rsquo;ll be using the excellent &amp;ldquo;Adventurer&amp;rdquo; sprite by Elthen. You can get this and lots of other great art at &lt;a href="https://elthen.itch.io/" target="_blank"&gt;https://elthen.itch.io/&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>