Dont know how to use IF

  • I know this May be a simple one, i have an object that Adds force up each time its touched. But i want to enable only 1 touch and then wait until it stops moving. Ive tried to use IF and the event “stop moving” but couldnt get it to work

  • @lucio-aquino Started touching

    If less than or equal to 0, trigger something
    Add force underneath as well, and then you are good to go.

    Should never be triggered again.

    You know about input fields right?

  • @lucio-aquino I might be misunderstanding what you're trying to do, but I'm guessing it's an object that jumps when you tap it when it is on the ground, in which case you'd probably want something like this:

    The 'while touching' can be replaced with a 'started touching' if you don't want players to be able to keep holding it.

    The behaviours basically apply a force once when you tap, then disable the applying of force until the object stops falling again.

    The two behaviours on the right are to stop the object from being able to jump mid-air if it walks off a ledge, they can be removed if the object doesn't walk off ledges.

    The biggest issue I can see is that it probably won't work well with vertically moving platforms, though I haven't tested it.

    Let me know if I've completely misunderstood what you're asking for. This is very similar to the functionality of the jump with button behaviour, so I'm guessing there's a chance I've misunderstood what you're asking.

  • @lucio-aquino what does IF mean!

  • @pinkie-pie IF is a behavior.

  • @pinkie-pie It's hard to know IF this is a serious question.

    IF it is:

      "If" is a conditional, and shorthand for:
          "if this condition is true, then do this.
           If not true, then don't."
      An If behaviour needs three things:
        1. An input that can be assessed for true or false
        2. A condition criteria checking if input is true or false    
        3. An Output Behaviour to perform if the above is true
     Else if having a lark, this is for others. 

Log in to reply