Gravity problems

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
roggie12
Prole
Posts: 13
Joined: Sat May 25, 2013 6:00 pm
Location: The Matrix

Gravity problems

Post by roggie12 »

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 :)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Gravity problems

Post by Robin »

... did you just make three topics about the same thing?
Help us help you: attach a .love.
roggie12
Prole
Posts: 13
Joined: Sat May 25, 2013 6:00 pm
Location: The Matrix

Re: Gravity problems

Post by roggie12 »

Sorry. I thought that they didn't post properly so i made them again they didn't show up in my 'View your posts' option. Im really new to this. I also didn't know how to edit topics til just now
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Gravity problems

Post by Robin »

Because of spam, new members have to have their first post approved before they can post freely. You're not the first that didn't see their post and tried again.
Help us help you: attach a .love.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Gravity problems

Post by micha »

Try this tutorial. It covers gravity:
Platform game tutorial
roggie12
Prole
Posts: 13
Joined: Sat May 25, 2013 6:00 pm
Location: The Matrix

Re: Gravity problems

Post by roggie12 »

thank you
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests