[Solved] quad spritesheet assistance

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
walking_post
Prole
Posts: 2
Joined: Mon Dec 26, 2011 4:40 am

[Solved] quad spritesheet assistance

Post by walking_post »

Hi, new to love2d, and having a little trouble understanding using quads with a spritesheet. I can use love.graphics.draw to show the whole sheet, but quads don't show up.

Adjusted image in Gimp to 256x256 as per a post about non-2* image having trouble with some video cards (mine is a GT430, which shouldn't be a problem), and tried different file formats (png, jpg, bmp).

Probably an embarrassingly easy answer, but I'm stumped. Thanks!
Attachments
ty4helping.love
quads aren't working
(8.72 KiB) Downloaded 172 times
Last edited by walking_post on Wed Dec 28, 2011 12:01 pm, edited 1 time in total.
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: quad spritesheet assistance

Post by osgeld »

you are doing it wrong

A) until you figure it out use no padding so your spritesheet looks like this

Image

B) the last 2 arguments of quad is not ever going to be 0,0 its the total size of your image

putting those two together ends up looking like

player = love.graphics.newQuad(0, 0, 55, 30, 111, 60)

which works fine to display the first quad

its startX,startY, width, height, total imageX, total image Y

have fun!
Attachments
spritesheet3.png
spritesheet3.png (8.15 KiB) Viewed 3298 times
walking_post
Prole
Posts: 2
Joined: Mon Dec 26, 2011 4:40 am

[Solved] Re: quad spritesheet assistance

Post by walking_post »

Wow, that's easier than what I was trying to do...lol. Thank you, osgeld! :)

quad = love.graphics.newQuad( x, y, width, height, sw, sh )
x, y = starting point of sprite
width, height = just the w/h of the sprite, not the x/y coordinates of the sprite's corner
sw, sh = total size of the spritesheet
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests