How to use Ease?

In my game, I have a red block that I want to move up 3 spaces when A is pressed, but only once. I’ve got it set up to where it does just that, but I want the movement to ease, or transition, instead of being an automatic jump (my idea is to have it be a rising platform). I’m not sure how to do this, but I think it requires the Ease function? I don’t know how Ease works, so if anyone could give me pointers on how to use Ease for this purpose, it would be much appreciated.
http://www.flowlab.io/game/play/807319

Hey @goodberry - you have the right idea, I think an Ease block is what you want.

The Ease block is documented here: http://flowlab.io/behavior_handbook/#logic-math-ease

The basic idea is that when you send two values into it, it will “Ease” from one value to another. You’ll want to do something like this:

  1. Send the red block’s starting y position into the “from” input
  2. Send the red block’s ending y position into the “to” input
  3. When both inputs are received, the Ease block will start generating output values
  4. Send the output value into the red object’s y property

You can delete your behaviors, then copy this, click the behavior window, select “import”, and paste it in:

{
  "behavior": {
    "nodes": [
      {
        "name": "Ease",
        "outputCount": 2,
        "group": "",
        "y": 224,
        "duration": 37,
        "easing": "Quadratic",
        "behaviorType": "logic.logic.Ease",
        "x": 540,
        "inputCount": 2,
        "id": "07f6e73caab33046"
      },
      {
        "name": "Number",
        "outputCount": 1,
        "tag": "",
        "group": "",
        "y": 320,
        "behaviorType": "logic.logic.Value",
        "startVal": 128,
        "x": 360,
        "inputCount": 3,
        "id": "07f76535cdfc9746"
      },
      {
        "resetVelocity": false,
        "name": "Position",
        "outputCount": 2,
        "group": "",
        "y": 224,
        "pixelUnits": true,
        "behaviorType": "logic.properties.Position",
        "x": 720,
        "inputCount": 4,
        "id": "e3e810e9aa605145"
      },
      {
        "name": "Keyboard",
        "outputCount": 2,
        "group": "",
        "y": 224,
        "delay": 0,
        "behaviorType": "logic.triggers.Keyboard",
        "repeats": false,
        "keyCode": 65,
        "x": 180,
        "inputCount": 0,
        "id": "e3e7cdd5289fcc47"
      },
      {
        "name": "Number",
        "outputCount": 1,
        "tag": "",
        "group": "",
        "y": 128,
        "behaviorType": "logic.logic.Value",
        "startVal": 240,
        "x": 360,
        "inputCount": 3,
        "id": "e417fe3a11ffd74a"
      }
    ],
    "links": [
      {
        "input_id": "07f6e73caab33046i0",
        "output_id": "e417fe3a11ffd74ao0"
      },
      {
        "input_id": "07f6e73caab33046i1",
        "output_id": "07f76535cdfc9746o0"
      },
      {
        "input_id": "e3e810e9aa605145i1",
        "output_id": "07f6e73caab33046o0"
      },
      {
        "input_id": "07f76535cdfc9746i1",
        "output_id": "e3e7cdd5289fcc47o1"
      },
      {
        "input_id": "e417fe3a11ffd74ai1",
        "output_id": "e3e7cdd5289fcc47o0"
      },
      {
        "input_id": "07f76535cdfc9746i1",
        "output_id": "e3e7cdd5289fcc47o1"
      },
      {
        "input_id": "e417fe3a11ffd74ai1",
        "output_id": "e3e7cdd5289fcc47o0"
      }
    ],
    "v": "2"
  }
}

Thank you! That’s really cool, and I think understand it now, and it worked. What would I need to do to make this action perform only once?

You can add a switch after the Keyboard block, and turn the switch off after it triggers once.