Hello guys. It's my first topic. I'm new on Love world and I am getting started on implementing physics.
Before physics, I was making a 2d game using only basic functions. But now, I want to implement jump, gravity...
Without physics, I was using AnAL file to make the character to move. But now, I want to make it jump, so I need to implement physics. How can I draw this animations on a body?
thanks
Apologize for my English. I'm brazillian
How to load an animation (AnAL) on a body?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to load an animation (AnAL) on a body?
You want to keep a handle of the physics body in your player table (or wherever) and poll the body's position every frame, then use that position to draw your animation.
I will note here that body:getWorldCenter might be better than body:getPosition, but I don't know. You will have to experiment.
I will also note that anim8 is a much better library than AnAL, you should consider using that instead.
Code: Select all
player.body = love.physics.newBody(world, x, y, type)
love.draw()
local x, y = player.body:getPosition()
lov.graphics.draw(animation, x, y)
end
I will also note that anim8 is a much better library than AnAL, you should consider using that instead.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Who is online
Users browsing this forum: No registered users and 3 guests