The error is because you used a dot (".") instead of a colon (":") when calling the getWidth and getHeight functions.
The corresponding line of code needs to be either of the two:
Code: Select all
-- with "."
love.graphics.draw(sprites.player, px, py, .1, .1, sprites.player.getWidth(sprites.player) / 2, sprites.player.getHeight(sprites.player) / 2)
-- with ":", the preferred method in a case like this, and is syntactically equivalent to the "." method
love.graphics.draw(sprites.player, px, py, .1, .1, sprites.player:getWidth() / 2, sprites.player:getHeight() / 2)
What the colon syntax does is implicitly send the invoked function the object it's attached to as the first function argument. As such, in this case it sends the löve object representing the texture. getWidth and getHeight both expect a texture as the first passed function argument, hence the error if you don't do either of the two above.