Page 1 of 1

anim8 grid creation error

Posted: Fri Jan 16, 2015 1:47 pm
by Fenrir5543
Hi there everyone, I'm a relatively new Love programmer and I'm having issues figuring out a problem when I try to use the anim8 library for my project.

The "problem" code is as follows

Code: Select all

local anim8 = require "anim8"
--require "Equipment"

PlayerData = {}
PlayerData.__index = PlayerData

moving = false
dir = "down"
HeightHolder = love.graphics.getHeight()
WidthHolder = love.graphics.getWidth()
timer = 0
num = 0
--PlayerGear = EquipData.new("Toque","Winter","Snowpants","Winter","Nil")

function PlayerData.new(PlayerName, PlayerSpecies, X, Y)
	local self = setmetatable({}, PlayerData)
	self.Name = PlayerName
	self.Species = PlayerSpecies
	self.Xplayer = X
	self.Yplayer = Y
	self.Animations = {}
	--PlayerGear:LoadEquipment()
	return self
end

function PlayerData.Load_Player(self)
	
	local PlayerFrames = love.graphics.newImage("Resources/Characters/Player/Subland.png")
	local PlayGrid = anim8.newGrid(25,44,100,176,0,0,0) --This is where the error is being shown
	self.Animations[1] = anim8.newAnimation(PlayGrid('1-4,1-4'),0.25)
end
Very basically, this is the player class that handles the player movement, animations and whatever else is needed.

The error message that I receive is as follows "Player.lua:29: attempt to index upvalue 'anim8' (a boolean value)"

Thanks ahead of time for any help you can give me.

Re: anim8 grid creation error

Posted: Fri Jan 16, 2015 1:58 pm
by kikito
It sounds like you either didn't put the anim8.lua file in the right place, or you modified it (by removing the last line, the one which says return anim8. Without seeing your whole project, it is difficult to know.

Re: anim8 grid creation error

Posted: Fri Jan 16, 2015 2:02 pm
by Fenrir5543
I just double checked the anim8 file and indeed I made an error while copying your code and forgot return anim8. Thank you so much for pointing this out to me.

Re: anim8 grid creation error

Posted: Fri Jan 16, 2015 2:51 pm
by kikito
No problem! And welcome to the forums, by the way :)