Let's create an MPAGD game - Part 12 - Adding Ladders
So far, in our game, its pretty much a standard platform affair, with controls for left, right and jump. But what if we wanted to add ladders for Stinky Dog to climb up and down?
First, we're going to need to add some Ladder Blocks, so open up the Block editor, we're going to need to create two blocks, one for the left side and one for the right side. We need to create two because our sprites are 16 pixels wide, but blocks are only 8 pixels. You can try doing it with a single block but its a bit ropey from a playability perspective.
I always try and keep my ladders as simple as possible, this is because of the way that MPAGD displays a sprite when it is over a non Empty block.
Something like this will do:
Remember to click the Block type box to cycle through to the correct type.
Once you've create your ladder blocks we can add a ladder to our screen, open up the Screens editor , select the blocks in turn and draw a ladder on your screen:
Now that we have a ladder, it would probably be a good idea for us to have a version of the Stinky Dog sprite that we will display when he is going up or down the ladder. Open up the Sprite Editor and create a new sprite.
(it's supposed to be Stinky Dog from behind....if you haven't guessed )
Now we're going check we have set the Keyboard Controls for Up and Down, from the Editor menu select Keyboard controls, and as we did before, choose the keys that you want to control Stinky Dogs up and Down movement.
QAOP....just how it should be :)
Next, were going to need to add the code for up and down ladders movement. But rather than use the script generator (since that might overwrite our code to date) we're going to write it ourselves.
This is it boys....we're going in...
NEXT: Part 13: Editing the Player Script