playMaker

Author Topic: Enabling move up action on ladder  (Read 1650 times)

dt74

  • Playmaker Newbie
  • *
  • Posts: 2
Enabling move up action on ladder
« on: October 27, 2013, 04:32:37 PM »
Hi I am new to Playmaker and I am struggling with something that I guess is really simple. I am building a 2d platform game using 2d Toolkit and Playmaker and I created a simple move left, right action by following the sprite tutorial in Playmaker. For going up or down I am using a ladder which I can easily detect with a trigger. At this point I want to enable the move up or down action. How do I do this? I am using Get Key Down and Up as well as Translate for the movement. 

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Enabling move up action on ladder
« Reply #1 on: October 27, 2013, 06:40:40 PM »
Try this:

Create a global boolean titled "Near Ladder" or something similar. The default state of the boolean should be 0 (off).

Create a box collider around the ladder.

Create an FSM on the ladder, with  the Trigger Event action. (Your character will need a collider attached to it, that has the "is trigger" box checked). Add to this first FSM state a "set bool value" action. Target the "Near Ladder" boolean and have the action set its value to 0.

Have the Trigger Event action switch the FMS to a new state "On trigger enter". In this new state, add a "Set bool value" action, which targets the "Near Ladder" boolean and sets it to 1.

To this second FSM state, add another "Trigger Event" action, this time "On Trigger exit", the FSM should switch back to the first state.

Lastly, on your character control FSM, whenever the key for "up" is pressed, send the FSM to a new state with a "Bool Test" action - if the Boolean "near Ladder" is true, continue sending the FSM to the state that enables upwards movement. if the boolean isn't true, set an event to send the FSM back to the original state, which will stop the "up" key from working :D

dt74

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Enabling move up action on ladder
« Reply #2 on: October 28, 2013, 06:01:43 PM »
Thanks that seemed to work however the movement still has some issues. It doesn't feel very natural but I suspect it has to do with the physics.