jumping tutorial?

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
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

jumping tutorial?

Post by toaster468 »

Ive been looking around and i cannot seem to find an example for some simple jumping! Can someone please tell me a place where i can find some simple code?
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: jumping tutorial?

Post by nevon »

There's really no way to write such a tutorial, since it all depends entirely on what the rest of your code looks like.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

I would write a game around it so if you could please write up some simple code, I would be grateful or at least point me to a simple physics example.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: jumping tutorial?

Post by Robin »

If you like to see a simple platformer, you could take a look at Jump Game (you can get it here: http://love2d.org/forums/viewtopic.php? ... 053#p21042), which is a garbled mess, but it could probably serve as a quick introduction.
Help us help you: attach a .love.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

that is very messy code, I cannot really understand it, i will post my code to see if anyone can help me

Code: Select all

-- Office Man Stan --



function love.load()

	love.graphics.setMode(320, 320)
	love.graphics.setCaption( "Office Man Stan" )



end


function love.update(dt)

end

function love.draw()



end
i deleted all the stuff that i tried so feel free to add jumping if you will, i can do the rest and i will include you in the credits
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: jumping tutorial?

Post by Robin »

I'm sorry, but this is not how programming works. ;)

I can give you code, but that will not help you. It seems you need to start at the beginning.
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: jumping tutorial?

Post by TechnoCat »

These are both really bad, very old examples of things I have done. But they can probably help you get started.

without love.physics https://bitbucket.org/dannyfritz/jumpbu ... .lua#cl-40
with love.physics https://bitbucket.org/dannyfritz/megama ... .lua#cl-21
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

well im not new to programming i know how this works and i like to read up about things work before i try it, but i could not find anything on the wiki about jumping. I know now that i should use impulse but i dont know how to save a picture to a table like in the physics example. would this work?:

Code: Select all


bodies = {}

bodies[0] = love.graphics.newImage("picturelocationhere.PNG")
...
--later on in the code

bodies[0]:applyImpulse( 0, -1000)

I did this in the physics example but the thing is that i need to use a picture instead of a circle
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

It seems that you are under the impression that making a jumping character takes 10 or 20 lines.

I'm afraid it takes a bit more than that.

I can help you, but I will not create the code for you. Sorry.

What I can do is help you gradually transform your code into a jumping one. Step by step.

First, I want you to create an image for your 'jumping man' and another one for the ground.

You will have to load the images inside love.load (with love.graphics.newImage) and draw them inside love.draw, using love.graphics.draw. Try not to make the ground image too big.

Draw the two images so the character seems to be on top of the ground.

When you finish with that, we'll go to the next step.
When I write def I mean function.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

ok, i get this error alot but i have all my images in my folder and they are the right names but i keep getting an error that they arent there. I am running a 64bit OS so could that be the problem?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 94 guests