Climb on ladders

Sabnock

Member
there are a few ways of dealing with this but you could use a state machine so that your player has different modes of operation.

test for a ladder collision along with an up or down control and set your code to a state that deals with being on a ladder.

if you are unsure about state machines let us know and we can point you in the right direction.
 

Let's Clone

Member
It's not a clean solution, but you can ignore gravity while in contact with a ladder. Or, as Sabnock suggested, a state machine would work well here.
 

Gorshalox

Member
there are a few ways of dealing with this but you could use a state machine so that your player has different modes of operation.

test for a ladder collision along with an up or down control and set your code to a state that deals with being on a ladder.

if you are unsure about state machines let us know and we can point you in the right direction.
I'm just new in GMS 2,so I will be very thankful if you will explain me more about state machines
 

Sabnock

Member
I'm just new in GMS 2,so I will be very thankful if you will explain me more about state machines
I had a quick look online to see if there is any good resource explaining Finite State Engines and found this.


There are tutorials on Youtube that go through this topic but in simple terms it is a way of having your instances run a piece of code that is dependant on their current "state" or mode. It allows you to break things down into smaller, easier chunks rather than one tangled mess of code and i would recommend every coder learns about them.

Learn about scripts(), enums, switch() and case : and once your get you head around it you'll make your life a happier one.
 
Last edited:
Top