Page 4 of 14

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 1:58 pm
by kikito
That's a nice fish, but toaster doesn't need a fish, but lessons on how to get his own fishes.

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 2:19 pm
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:

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 4:59 pm
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?)

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 8:13 pm
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:

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 9:18 pm
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!

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 9:34 pm
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

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 9:46 pm
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:

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 10:12 pm
by toaster468
Sweet I'll keep that in mind when I add sprinting!

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 10:18 pm
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!

Re: jumping tutorial?

Posted: Tue Nov 09, 2010 10:47 pm
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: