<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UI on Godot 4 レシピ</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/index.html</link><description>Recent content in UI on Godot 4 レシピ</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://kamera25.github.io/godot_recipes/4.x/ui/index.xml" rel="self" type="application/rss+xml"/><item><title>Labels</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/labels/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/labels/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 display some text on the screen.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Sooner or later you&amp;rsquo;re going to need to display some text on your screen. Examples include a title, countdown timer, score counter, and many others. For the majority of these, Godot&amp;rsquo;s &lt;i class="gd-Label"&gt;&lt;/i&gt;&lt;code&gt;Label&lt;/code&gt; node is the answer.&lt;/p&gt;
&lt;h3 id="working-with-fonts"&gt;Working with fonts&lt;/h3&gt;
&lt;p&gt;Before you can start, you&amp;rsquo;re going to need a font. We&amp;rsquo;ll go into the full details of Godot&amp;rsquo;s font support in a separate recipe, but for our purposes, let&amp;rsquo;s assume you have a TTF or OTF font file. For using bitmap fonts, see the associated recipe.&lt;/p&gt;</description></item><item><title>Containers</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/containers/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/containers/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;Your UI has problem(s): it&amp;rsquo;s become overcomplicated, it doesn&amp;rsquo;t resize well, and/or you can&amp;rsquo;t keep track of how everything fits together.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;For many developers, building a UI is their least favorite part. It&amp;rsquo;s very easy for a complex UI to spiral out of control and become impossibly painful to fix or modify. Godot provides some great tools for building UI - and if you take the time to learn to use them, you&amp;rsquo;ll find that they take away a lot of that pain.&lt;/p&gt;</description></item><item><title>Cooldown Button</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/cooldown_button/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/cooldown_button/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 make RPG-style ability buttons, including a cooldown effect.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-2d15c26f3ac788b149ad7ea3dcb7304d" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cooldown_01.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-2d15c26f3ac788b149ad7ea3dcb7304d"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/cooldown_01.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;If you need art for your buttons, you can find a wide variety of well-designed buttons at &lt;a href="https://game-icons.net/" target="_blank"&gt;Game-icons.net&lt;/a&gt;. We&amp;rsquo;ll be using a few from there for this recipe.&lt;/p&gt;
&lt;h3 id="node-setup"&gt;Node setup&lt;/h3&gt;
&lt;p&gt;The scene for our ability button will need the following nodes:&lt;/p&gt;</description></item><item><title>Heart Containers: 3 Ways</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/heart_containers_3/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/heart_containers_3/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 need to display a heart container bar (or other icon-based bar).&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;A common way of displaying the player&amp;rsquo;s health is via a series of icons (typically hearts) that disappear as the player takes damage.&lt;/p&gt;
&lt;p&gt;In this recipe, we&amp;rsquo;re going to explore three ways of displaying this information, which I&amp;rsquo;m labeling &amp;ldquo;simple&amp;rdquo;, &amp;ldquo;empty&amp;rdquo;, and &amp;ldquo;partial&amp;rdquo;:&lt;/p&gt;</description></item><item><title>Floating combat text</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/floating_text/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/floating_text/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 units to display damage as floating numbers when hit.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-39428d97123bcbb046c0e514a65ed5f8" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/fct_demo.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-39428d97123bcbb046c0e514a65ed5f8"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/fct_demo.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;There are many ways to approach this problem. For example, you could use a bitmap font and build an image for each number out of its digits, then use a &lt;i class="gd-Sprite2D"&gt;&lt;/i&gt;&lt;code&gt;Sprite2D&lt;/code&gt; node to display and move it.&lt;/p&gt;
&lt;p&gt;However, for this recipe, we&amp;rsquo;ll use a &lt;i class="gd-Label"&gt;&lt;/i&gt;&lt;code&gt;Label&lt;/code&gt; node (named &amp;ldquo;FCT&amp;rdquo;). This will give us the flexibility to change the font, as well as making it easy to display the number as a string - or even other messages such as &amp;ldquo;miss&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Level Select Menu</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/level_select/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/level_select/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;Your game needs a &amp;ldquo;level select&amp;rdquo; menu, where the user can choose from a grid of options.&lt;/p&gt;
&lt;p&gt;
&lt;a href="#image-fbc096dbb03d933df0ec43f0d1801a13" class="lightbox-link"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/level_select_03.gif" alt="alt" style="height: auto; width: auto;" loading="lazy"&gt;
&lt;/a&gt;
&lt;a href="javascript:history.back();" class="lightbox" id="image-fbc096dbb03d933df0ec43f0d1801a13"&gt;
&lt;img src="https://kamera25.github.io/godot_recipes/4.x/img/level_select_03.gif" alt="alt" class="lightbox-image" loading="lazy"&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;As shown in the example above, we&amp;rsquo;ll make a scrolling grid of level &amp;ldquo;boxes&amp;rdquo; that the player can choose from. Let&amp;rsquo;s start with the individual level boxes:&lt;/p&gt;
&lt;h3 id="1-level-box"&gt;1: Level box&lt;/h3&gt;
&lt;p&gt;Here&amp;rsquo;s the node setup:&lt;/p&gt;</description></item><item><title>Minimap/radar</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/minimap/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/minimap/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want a minimap or radar-style UI item showing the locations of objects outside of the player&amp;rsquo;s view.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s an example of what we are going for:
&lt;video controls src="https://kamera25.github.io/godot_recipes/4.x/img/minimap_01.webm"&gt;&lt;/video&gt;&lt;/p&gt;
&lt;h3 id="project-setup"&gt;Project setup&lt;/h3&gt;
&lt;p&gt;To illustrate this feature, we&amp;rsquo;ll start with a simplified top-down game using the &lt;a href="https://kamera25.github.io/godot_recipes/4.x/2d/autotile_intro/"&gt;Autotile recipe&lt;/a&gt; and a player based on the &lt;a href="godot_recipes/2d/topdown_movement/#option-2-rotate-and-move"&gt;Top-down character recipe&lt;/a&gt;. See the linked recipes for details on how these parts work.&lt;/p&gt;
&lt;div class="box notices cstyle note"&gt;
&lt;div class="box-label"&gt;&lt;i class="fa-fw fas fa-exclamation-circle"&gt;&lt;/i&gt; Note&lt;/div&gt;
&lt;div class="box-content"&gt;
&lt;p&gt;The art in this project comes from &lt;a href="https://kenney.nl" target="_blank"&gt;kenney.nl&lt;/a&gt;, which you can download here: &lt;a href="https://kamera25.github.io/godot_recipes/4.x/files/minimap_assets.zip"&gt;Minimap Assets&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Radial Popup Menu</title><link>https://kamera25.github.io/godot_recipes/4.x/ui/radial_menu/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kamera25.github.io/godot_recipes/4.x/ui/radial_menu/index.html</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;You want a radial menu - a ring of buttons that pops up for you to choose an option.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Radial menus are used in a variety of games to allow access to a selection of buttons. For example, clicking on an NPC in a game allows you to choose what action to take: talk, inspect, attack, etc.&lt;/p&gt;
&lt;p&gt;The specific look-and-feel of your menu should match with your game&amp;rsquo;s esthetic. For this demo, we&amp;rsquo;ll focus on the mechanics of making the menu work, and leave the styling choices to you.&lt;/p&gt;</description></item></channel></rss>