Posted 29 July 2012 - 01:49 PM
Posted 31 July 2012 - 11:27 AM
This is a slightly tricky one. Basically, you'll want to 'snap' to the ladder. I might write it like this:
if keyboard_press up
if x is only 4 pixels away from the ladder x
then x= ladder x
so he kind of snaps to the ladder when you press up (or down). This is just a general idea of how to go about coding it.
Posted 31 July 2012 - 11:58 AM
If you want to make the center of your character's sprite be aligned with the center of the ladder's sprite, you will need to set the sprites' origins to center, so a simple my x = your x could line them up perfectly. If you have a reason not to do that, you will need to make a few calculations regarding where exactly the position should be snapped.
Also, a common problem is that the calling "ladder" usually ends up with the wrong ladder, as you are generally not supposed to call for the ladder object, but instead call for an instance that represents that particular ladder that is in front of you and you want to climb. So, to recognize the ladder that you're touching, you can use a function like instance_place() - with the proper arguments, of course - or other similar functions.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users