Anim8 newGrid() border parameter

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
tehryanx
Prole
Posts: 17
Joined: Fri Apr 04, 2014 8:26 pm

Anim8 newGrid() border parameter

Post by tehryanx »

I'm not entirely sure what I'm doing wrong here, but maybe someone could help me figure it out.

find my main.lua and love.lua here: http://www.hastebin.com/liwuxupomo.lua
and the tileset i'm using here: https://love2d.org/imgmirrur/dDSdTF7.png

When I set up my grid in player.load() using 0 as the border, everything works fine. I can adjust player.animations.tilesetRow to pick any of the 5 guys in the tileset. The problem is that there is a 1 pixel border surrounding them. When I set border to 1, the frame is offset by 1 pixel for every row I've moved on x or y. Am I using the border parameter wrong?
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Anim8 newGrid() border parameter

Post by Ranguna259 »

I don't think Anim8 works with love 0.9.1, try using [wiki]AnAL[/wiki] instead.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Anim8 newGrid() border parameter

Post by kikito »

Ranguna259 wrote:I don't think Anim8 works with love 0.9.1
That is incorrect. Anim8 works just fine in the latests LÖVE. Besides, AnAL can't handle borders around frames at all, so it's really inadecuate for this task.
tehryanx wrote:I'm not entirely sure what I'm doing wrong here, but maybe someone could help me figure it out.

[...]
. The problem is that there is a 1 pixel border surrounding them. When I set border to 1, the frame is offset by 1 pixel for every row I've moved on x or y. Am I using the border parameter wrong?
Yes.

The "border" property goes "on the outside" of the frames, not "on the inside". It seems that your frames are smaller than what you say they are (border is not "part of each frame", is "in addition to the frame dimensions"). Try making your frames 2 pixel smaller (width and height) and add a 1 px border around them. The planes demo uses the border quite a lot.

To clarify, given your image, I would use this grid:

Code: Select all

local g = anim8.newGrid(21, 21, 690, 690, 0, 0, 1)
You are probably using 22 or 23 on your frameWidth and height, and that's why you get weird things when you add borders.

BTW I can't see your code - the link to hastebin you wrote seems empty. I had to deduce what was happening by what you said. I recommend using uploading a .love file to the forum instead, you will get better answers.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 24 guests