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.
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 »

That's a nice fish, but toaster doesn't need a fish, but lessons on how to get his own fishes.
When I write def I mean function.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

It's supposed to be an example of how you would write a platformer with jumping...
I get -1'd for trying to help? What is this madness? It's not sparta. :ehem:
Hello, I am not dead.
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 »

You know, zac. You could try writing a real game yourself once, instead of complaining about your karma on the forums. ;) (How can someone have negative karma?)
Help us help you: attach a .love.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

Robin wrote:You know, zac. You could try writing a real game yourself once, instead of complaining about your karma on the forums. ;) (How can someone have negative karma?)
I try to help him through example (that's how I learn best, and I know I'm not the only one of nearly 7 billion people like that), and you -1 me. >_>
And I have written real games. Most are unreleased (because my interests sway to quickly to work on them). :ehem:
Hello, I am not dead.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

Alright, I got the movement down and bug free, now I'm shootin' for extra credit :). You can post the next step whenever you like. Thanks again guys you are all very helpful!
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

Update: I've gotten the player to turn right and left depending on which button in pressed :awesome:. LOVE is the most rewarding programming I have done in a long time, I cannot thank you guys enough
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

toaster468 wrote:Update: I've gotten the player to turn right and left depending on which button in pressed :awesome:. LOVE is the most rewarding programming I have done in a long time, I cannot thank you guys enough
I forgot something in the script I provided as an example: A friction coefficient. Just so you know, all you do is multiply your x-velocity by your coefficient for a nice sliding effect. Thanks for my first ever +1. :awesome:
Hello, I am not dead.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

Sweet I'll keep that in mind when I add sprinting!
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 »

Nice! You are doing quite fast.

The next part is : drawing your map using tiles.

Right now your map should be quite plain; basically a long horizontal corridor. But in order to spice up the jumping, you will need to have more variety. Stairs. Bottom-less pits. Platforms. That kind of thing.

For learning purposes, the best option is going tile-based.

So the first step is creating an image that you can use for your tiles on the ground and wallss. Probably a brick tile. If you don't feel like drawing it yourself, google for it (Make sure it has power-of-two dimensions, like 32x32 or 64x64 pixels). Load that new image inside love.load and call it tile_image.

Then, you need to change the way your level is modelled and drawn. The tile-based tutorial tutorial should help you on that part.
  • Start by defining a variable called map inside love.load. map will be a 2-dimensional array holding a representation of your map's tiles (see the tutorial).
  • Inside love.draw, draw your map using a loop. The loop should draw tile_image several times, depending on what your map variable contains.
Run the game several times making changes on map, and making sure that your level draws properly. Get familiar with the maximum size that a map can have before reaching the screen borders.

When you are sure it works correctly, create a level like the next one, with walls on both sides, ceiling and ground, a wall in the middle and two platforms (you don't need to respect these exact measures; adapt them to your tile/screen size)

Code: Select all

##########################################
#                                        #
#                                        #
#                                        #
#                    #      ####         #
#          ####      #                   #
#                    #                   #
##########################################
Your character should appear aligned with the ground. It should be able to move left and right as before. It should ignore the walls for now. On next step, we'll deal with that.

Take your time with this one, and ask any questions you have. Also, feel free to post screenshots with your progress!
When I write def I mean function.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

Kikito, I believe you forgot to tell him that collisions need to act independently per dimension. That way, you can slide without having crazy glitches. ;) Oh, I messed up. That's your next step. :cry:
Hello, I am not dead.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Bondrusiek and 4 guests