anim8 grid creation error

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Fenrir5543
Prole
Posts: 2
Joined: Fri Jan 16, 2015 1:40 pm

anim8 grid creation error

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: anim8 grid creation error

Post 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.
When I write def I mean function.
Fenrir5543
Prole
Posts: 2
Joined: Fri Jan 16, 2015 1:40 pm

Re: anim8 grid creation error

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: anim8 grid creation error

Post by kikito »

No problem! And welcome to the forums, by the way :)
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Google [Bot], YaCy [Bot] and 5 guests