O'Reilly logo

LÖVE for Lua Game Programming by Damilare Darmie Akinlaja

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The anim8 library

We have already set up our player and collider box; the player object is now collidable, but we need to animate it. Earlier on, we already created animation with quad (Chapter 2, LÖving Up!). Now we'll be using a cleaner and straightforward animation library—anim8 (love2D.org/wiki/anim8). Just as with the bump library and ATL, we are also going to require the anim8 library in main.lua; be sure that you have already downloaded a copy of the library for use and make sure anim8.lua is in the same directory with main.lua.

anim8 = require "anim8"
  1. Set the player character sprite, the same one we loaded in Tiled as the player object:
    playerSprite = love.graphics.newImage("maps/sprite.png")
  2. Set up the character's grid and size (playerSprite:getWidth() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required