function love.load() ---loads all we need in game
character = {}
character.player = love.graphics.newImage "gripe.run_right.png"
character.x = 50
character.y = 50
direction = "right"
iteration = 1
max = 8
idle = true
timer = 0.1
quads = {}
quads['right'] = {}
quads['left'] = {}
for j=1,8 do
quads['right'][j] = Quad((j-1) * 32, 0, 32,32, 256, 32);
quads['left'][j] = Quad((j-1) * 32, 0, 32, 32, 256, 32);
-- for the characgter to face the opposite
-- direction, the quad needs to be flipped
-- by using the Quad:flip(x,y) method, where
-- x and y are Boolean.
[color=#FFFF00]quads.left[j]:flip(true, false)[/color] --flip horizontaly x = true, y = false
end
end
local Quad = {
-- Quad information goes in here.
}
function Quad:flip( sx, sy ) -- sx, sy = new scale for Quad.
self.sx, self.sy = nx, ny
end
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
love.graphics.draw(image, quad, x, y, angle, -1, 1)
You might also want to use half the image's width and height for the ox and oy parameters of love.graphics.draw, so it's drawn (and rotated and scaled) from the image's center.
Off-topic, but why does angle come before scale and offset? It seems like more people would use offset and scaling with an angle of 0 than they would actually use the angle without scaling or offset. Just something I've always wondered.