<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Game Development on Daniel Lyons</title><link>https://dandylyons.net/topics/game-development/</link><description>Recent content in Game Development on Daniel Lyons</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><lastBuildDate>Tue, 11 Feb 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://dandylyons.net/topics/game-development/index.xml" rel="self" type="application/rss+xml"/><item><title>What's the difference between class and class_name in Godot?</title><link>https://dandylyons.net/posts/godot-class-vs-class_name/</link><pubDate>Tue, 11 Feb 2025 00:00:00 +0000</pubDate><guid>https://dandylyons.net/posts/godot-class-vs-class_name/</guid><description>&lt;p>When you&amp;rsquo;re writing scripts in Godot, you might have noticed that some scripts use &lt;code>class&lt;/code> and others use &lt;code>class_name&lt;/code>. What&amp;rsquo;s the difference between these two keywords? Let&amp;rsquo;s find out.&lt;/p>
&lt;h2 id="class_name-keyword">&lt;code>class_name&lt;/code> keyword&lt;/h2>
&lt;p>You may have noticed that so many GDScript scripts in Godot start with &lt;code>extends Node&lt;/code> or &lt;code>extends Resource&lt;/code>. This is because Godot uses a common programming feature called class inheritance.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-gdscript" data-lang="gdscript">&lt;span class="line">&lt;span class="cl">&lt;span class="kd">extends&lt;/span> &lt;span class="nc">Node&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kd">var&lt;/span> &lt;span class="nb">str&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;Hello, World!&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>So when you use &lt;code>extends&lt;/code>, you are telling GDScript that your class inherits from an existing class. So when we write &lt;code>extends Node&lt;/code>, we are creating a new class that inherits from the &lt;code>Node&lt;/code> class.&lt;/p></description></item></channel></rss>