A LÖVE animation primer
User Libraries
That is how you can create an animation from scratch using LÖVE's built-in tools. But you could also use anim8 [4], a LÖVE library that takes the drudgery out of animating sprites and lets you have the different frames on a grid (as opposed to just on a line) and pick what frames to use in an animation.
Like anim8, there are many other libraries for LÖVE, that apart from making animation easy, cover physics, isometric 3D tiles, collision detection, and much more. Before putting yourself through the hassle of programming a whole super-framework from scratch, check that someone hasn't already done it for you [5] – unless you are doing so to learn the basics. (Also, for a brief word about the editor you use for programming, see the box "Ideal IDE.")
Ideal IDE
Although your regular, favorite text editor will do just fine, there is some merit in going with ZeroBrane Studio [6] (Figure 4). Not only is it an efficient little editor with all the bells and whistles you need for Lua programming (syntax highlighting, text completion, file management, etc.), it also comes with hooks to a bunch of the most popular Lua interpreters, including LÖVE and Moai, another framework for gaming development.
Go to Project | Lua Interpreter in the menu, pick LÖVE from the list, and you'll be able to run and debug your game directly from the IDE.
![](/var/linux_magazin/storage/images/issues/2020/234/tutorial-loeve-animation/figure-4/766615-1-eng-US/Figure-4_large.png)
LÖVE Platforms
Your LÖVE games can be ported to other platforms, including Windows, iOS, and Android (Figure 5), and the LÖVE wiki explains in detail how to do that [7]. However, you can test-run your program on Android before you go to all the trouble of compiling or pushing it through a toolchain to get a native APK.
![](/var/linux_magazin/storage/images/issues/2020/234/tutorial-loeve-animation/figure-5/766618-1-eng-US/Figure-5_large.png)
On your computer, you have to create a file called conf.lua
, like the one in Listing 9.
Listing 9
conf.lua
01 function love.conf(t) 02 t.version = "XX.X" 03 end
"XX.X"
is the version of the LÖVE interpreter on your computer. You can find this out by running the LÖVE interpreter from the command line with love
. The version of LÖVE is shown in the titlebar.
Put conf.lua
in the same directory as your main.lua
file, enter the directory and zip everything up with
zip -9 -r YourGame.love .
You can choose a different name from YourGame
, of course, but your zipped file must have the extension .love
.
On your phone, download the LÖVE interpreter for Android from Google Play [8] and then copy the .love
file from your computer over to your Android device. You'll be able to run it with your newly installed LÖVE interpreter.
Conclusions
We have only touched on one of the many superficial tasks you will have to carry out when creating your own game. However, my hope is to tempt you to get your toes wet and to help you get your head round the most basic principles of programming with LÖVE. As a fan of old-school, casual gaming, I can't wait to see what you do with it.
Infos
- LÖVE game framework: https://love2d.org
- Lua programming language: https://www.lua.org/
- LÖVE wiki: https://love2d.org/wiki/Tutorial:Callback_Functions
- The anim8 library for LÖVE: https://love2d.org/forums/viewtopic.php?f=5&t=8281
- List of LÖVE libraries: https://www.love2d.org/wiki/Category:Libraries
- ZeroBrane Studio: https://studio.zerobrane.com/
- How to port your games to other platforms: https://love2d.org/wiki/Game_Distribution
- LÖVE interpreter for Android: https://play.google.com/store/apps/details?id=org.love2d.android
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.