<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cédric Ricci on Medium]]></title>
        <description><![CDATA[Stories by Cédric Ricci on Medium]]></description>
        <link>https://medium.com/@riccicedric?source=rss-2e210ddc5ebe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kp1zJlP_5tjlWDxDHQymDQ.png</url>
            <title>Stories by Cédric Ricci on Medium</title>
            <link>https://medium.com/@riccicedric?source=rss-2e210ddc5ebe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:30:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@riccicedric/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to the LÖVE 2d Game Engine]]></title>
            <link>https://medium.com/@riccicedric/introduction-to-the-l%C3%B6ve-2d-game-engine-b40aeea5b03f?source=rss-2e210ddc5ebe------2</link>
            <guid isPermaLink="false">https://medium.com/p/b40aeea5b03f</guid>
            <category><![CDATA[love2d]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[löve]]></category>
            <category><![CDATA[lua]]></category>
            <dc:creator><![CDATA[Cédric Ricci]]></dc:creator>
            <pubDate>Sun, 15 Aug 2021 03:58:57 GMT</pubDate>
            <atom:updated>2021-08-20T05:11:52.505Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Introduction to the LÖVE 2d Game Engine" src="https://cdn-images-1.medium.com/max/960/1*4btY0HKqapF2T2LKoG7m3w.jpeg" /></figure><h3>Introduction to the LÖVE 2D Game Engine</h3><p>In this article, I will present you with the basics of the LÖVE game engine.<br><em>This article is partially based on the information from the Love2D wiki page (reference in the footnote)</em></p><h3>What is LÖVE Game Engine?</h3><p><a href="https://love2d.org/"><strong>LÖVE</strong></a> is an open-source cross-platform 2D video game engine, which uses the <a href="https://www.lua.org/"><strong>LUA</strong></a> programming language. Its API takes advantage of the <a href="https://www.libsdl.org/"><strong>SDL</strong></a> and <a href="https://www.opengl.org/"><strong>OpenGL</strong></a> libraries to give you easy access to the video and sound functions of your computer. Completely free, cross-platform and easy to learn and use, it is an ideal engine to start developing games and practice programming.</p><h3>Installing the LÖVE framework</h3><p>To be able to use the LÖVE game engine on your computer, you will need to install it first. To do so, you will need to download the version of LÖVE corresponding to your computer system. The latest version of LÖVE can be easily downloaded from the official website, <a href="https://love2d.org/#download">https://love2d.org/#download</a>.</p><blockquote>On Windows system, if at any point, the installer asks you to add LÖVE to your path, check the box and accept it.</blockquote><p>After you have completed the installation process, you can check the LÖVE version in your Command prompt / PowerShell (Windows) or Terminal (Mac / Linux) by typing :</p><pre>love --version</pre><p><strong><em>Version 11.3 (Mysterious Mysteries)</em></strong><em> at the time of this article for the stable version.</em></p><p>To be able to code with LÖVE, you will also need an IDE or text editor.<br>The next step is optional, but I recommend you to install and use <a href="https://code.visualstudio.com/"><strong>Visual Studio Code</strong></a> by Microsoft to easily follow the last chapter of this article. Visual Studio Code is a modern cross-platform IDE that will give you access to some really handy extensions for programming with LÖVE.</p><h3>Installing Visual Studio Code and LÖVE (Love2D Support) extension</h3><p>First, download and install the latest version of Visual Studio Code corresponding to your computer system. <a href="https://code.visualstudio.com/Download">https://code.visualstudio.com/Download</a></p><p>When the installation is completed, launch the program, then click on the Extensions button (Ctrl + Shift + x) on the left side menu, then type <strong>Love2D Support</strong> in the search bar at the top of the left side panel <strong>Extensions Marketplace.</strong></p><figure><img alt="LÖVE (Love2D Support) extension for VS Code" src="https://cdn-images-1.medium.com/max/1024/1*lSLp9-HZ44NuI7J_AeqXxg.png" /></figure><p>Install the extension by clicking on the blue <strong>Install</strong> button</p><p>Once the extension is installed, you will need to configure it by clicking on the little gear at the top below the title, and choose <strong>Extension Settings</strong> from the drop-down menu.</p><figure><img alt="Love2D Support extension settings" src="https://cdn-images-1.medium.com/max/745/1*O56PcNYn-El8Vi7q3dDEtg.png" /></figure><p>You must fill in the correct path to LÖVE.</p><p><strong>Example for Linux :<br></strong><em>/usr/bin/love</em></p><p><strong>Example for Windows :<br></strong><em>C:\Program Files\Love\love.exe</em></p><p>Thanks to the extension, you now have access to <strong>Intelissense</strong> for the LÖVE API (Code Completion), access to the online help when hovering the mouse cursor and a shortcut (Alt + L) to directly launch and test your code.</p><h3>Callback functions</h3><p><strong>LÖVE uses different predefined callback functions, to serve different needs. </strong>In programming, a callback function is called at a certain predefined time, opposed to an ordinary function, that does something the moment it is called.</p><p>For example, the <strong>love.load</strong> function is called only once at the beginning of the code, and before any other callback, unlike the <strong>love.update </strong>function which is called continuously. <br>In programming, functions are great to keep your code organized and efficient, or for reusability.</p><blockquote>It is the main loop function <strong>love.run</strong> that takes care of executing all these callback functions. This function is handled by default by LÖVE and, in most cases, you do not need to declare it in your code.</blockquote><h4><strong>The 3 main callback functions of LÖVE are:</strong></h4><p><strong>love.load</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1911654c26f2bd322fe65ec80d71267d/href">https://medium.com/media/1911654c26f2bd322fe65ec80d71267d/href</a></iframe><p>The <strong>love.load</strong> function is called only once at startup. This is where you habitually initialize variables and load your resources. You can do all these things anywhere else, but by doing them here you ensure that they are only executed once.</p><p><strong>love.update</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a050550ec03f123e5950cb35d8f7c7a/href">https://medium.com/media/8a050550ec03f123e5950cb35d8f7c7a/href</a></iframe><p>The <strong>love.update</strong> function is called continuously (repeatedly) and is where most of your operations and calculations are performed.<br><em>(dt)</em> after the name of the callback function means <strong>delta time</strong> and represents the number of seconds since the last call of this function relative to the speed of your machine (speed of your computer / processor). It ensures that your program will run at the same speed on any computer.</p><p><strong>love.draw</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf3361f258d3fc760b8ac51c579b446a/href">https://medium.com/media/cf3361f258d3fc760b8ac51c579b446a/href</a></iframe><p>The <strong>love.draw</strong> function is dedicated to drawing operations, all functions of type <strong>love.graphics.draw</strong> must be called within it.<br>Like the <strong>love.update</strong> function, this function is also called continuously. All operations performed inside this function, and placed at the end of it, will affect those at the beginning.</p><blockquote>All callback functions are optional, but most projects use at least the 3 basic callback functions above.</blockquote><h3>Skeleton of a LÖVE program</h3><p>Here is what the code skeleton of a game / program in LÖVE looks like, once those 3 main callback functions are written together :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/305c702eec8791b402fdb030809e17ed/href">https://medium.com/media/305c702eec8791b402fdb030809e17ed/href</a></iframe><blockquote>In programming, we usually comment on some parts of our code, to remember or give information to others about what a specific part of the code do. With LÖVE and Lua, you can write a <strong>comment</strong> using “--” in front of a text/line. This element will be ignored by the program and not executed. That is what the repeated “-- Your code here” line is in the code example above.</blockquote><h3>Creating your first program with LÖVE</h3><p>For our first example program, I advise you to create a new folder on your computer, which we will call <strong>HelloWorld</strong>.</p><p>If Visual Studio Code is not running, it is time to open it and go to the <strong>File</strong> menu and click on <strong>Open Folder…</strong>.<br>Point to the new <strong><em>HelloWorld </em></strong>folder you have just created and select it.</p><p>You are now inside the relevant folder. To start coding, you need to create a new file by going to the <strong>File</strong> menu and clicking on <strong>New File</strong> (Ctrl + N) or by using the little Page <strong>+</strong> icon on the left sidebar.</p><blockquote>In this example program, we will only use the <strong>love.draw</strong> callback function. You can write down in your code the 3 main functions listed in the previous chapter, if you want, but we will only use one in the following example.</blockquote><p>Create a file named <strong>main.lua</strong>, we will type our first lines of code in it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48f37c98eb3945891b61ae31786f2a4f/href">https://medium.com/media/48f37c98eb3945891b61ae31786f2a4f/href</a></iframe><figure><img alt="LÖVE HelloWord example program" src="https://cdn-images-1.medium.com/max/1024/1*4vhzUmLvYbdlSMDV0WGorg.png" /></figure><p>Save your file <strong>(Ctrl + S)</strong> and use the keyboard shortcut <strong>(Alt + L)</strong> to launch your first application in LÖVE. If everything goes as planned, you should see the window below:</p><figure><img alt="LÖVE HelloWorld launched program" src="https://cdn-images-1.medium.com/max/745/1*AUq4x9EeiGBup9xBeyh4VQ.png" /></figure><p>In a future article, I will cover the basics of programming with LÖVE, and we will learn how to create a first mini-game. Meanwhile, you can also take a look at my blog <a href="https://riccicedricdesign.net/">https://riccicedricdesign.net</a></p><p>If you want additional information on the LÖVE game engine and the Lua programming language, I invite you to consult the reference links below:</p><p><strong>LÖVE (Love2d)</strong><br><a href="https://love2d.org/wiki/Main_Page">https://love2d.org/wiki/Main_Page</a></p><p><strong>Programming in Lua</strong><br><a href="https://www.lua.org/pil/">https://www.lua.org/pil/</a></p><p><strong>Thank you for reading this article, and stay tuned for more.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b40aeea5b03f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>