I'm having trouble with gravity. I know how to do character movement (Moving left, right, up, down) but i don't understand the gravity part. I'm making a game with my friends from school and i'm only starting with Love2d. I'm finding it hard to understand most of the stuff. I don't know if it's that the tutorials are really complexed or if i'm just not cut out to be making games but i'm gonna try my best
.I'm just learning from video tutorials on YouTube but i don't understand gravity and physics so any help will be much appreciated.
Thank you in advance
Here's the code that i have so far:
Code: Select all
function love.load()
stuff = love.graphics.newImage("textures/enemy1.png")
x=10
y=1
end
function love.update(dt)
if love.keyboard.isDown("up") then
y = y - 1
elseif love.keyboard.isDown("down") then
y = y + 1
elseif love.keyboard.isDown("left") then
x = x - 1
elseif love.keyboard.isDown("right") then
x= x + 1
end
end
function love.draw()
love.graphics.draw(stuff, x, y)
end
This code just makes the pic move it's not animated or anything.sorry i had to delete the love2d file another one will be uploaded soon