Ramps
Character going left
Go into the character’s <Left>event and add:
- Else
- Check Empty: (-4,-8), relative
is there something solid (a block) just a bit up and to the left (ie a ramp) to “slide” up to?
if so, do the following… inside start & end blocks…
- Jump to Position: (-4,-8), relative
- Move to Contact: use the landing action to move it down towards the contact position
direction = 270, maximum = 8, against solid object
Character going right
Go into the character’s <Right> event and add:
- Else
- Check Empty: (4,-8), relative
is there something solid (a block) just a bit up and to the right (ie a ramp) to “slide” up to?
If so, do the following: inside Start & End blocks, add the same actions as before, but the x values are “4” instead of “-4”.
- Jump to Position: (4,-8), relative
- Move to Contact: same as before
direction=270, maximum=8, solid objects
Room
You need to create a testing ramp in your room. Your ramp needs to have about 6-8 steps/levels. It works best if you have 2 squares per “step” so it’ll look like it’s gliding.
Start by adding the whole block objects with 2 spaces between.
Then place the horizontal blocks between for the ramp
Save and test out your room and make sure it works.
Ladder
Step event
Go into your character object.
In the Step event you already have and start by adding the following actions at the end:
- Comment: “check if on ladder”
- Check Object: object ‘ladder’, (0,0), rel.
- Add start & end blocks
Inside the Start & End blocks add:
- Set Gravity: direction 270, gravity 0
- Set Variable: variable “vspeed”, 0
- Change Sprite: sprite = characterClimbing
You should now have all these actions at the end…
Up event
Go into the <Up> event. When the character is at a ladder, the up arrow key should move it up, rather than jump. Before all actions, add:
- Check Object: object ladder, (0,0), relative
- also add Start & End blocks
- Add Else and start & end blocks around what you already have
Then inside Start & End blocks at the top (if on ladder):
- Check Empty: is there anything just above?
(0,-3), only solid, rel. - Jump to Position: if there isn’t, move it up a bit
(0,-3), rel.
So your <Up> event should now look like this…
Down event
We’ll do similar actions in the <Down> event…
- Check Object: object ‘ladder’, (0,0), rel.
Go into Check Empty and Jump to Position actions and change the Y values from “-3” to “3”. Checking if anything just below? If there isn’t, move it down a bit.
Room
Add the ladder object and a platform for the character to step off onto at the same height.
Save and test out your room and make sure it works.
So playing your testing level will look like this so far…
Your character should change as soon as it touches the ladder; the Up/Down arrows should make it climb up and down, and you should be able to step off onto the top platform.