Changing Character gravity in Paper2D starter project

Hey guys, first post here. :slight_smile:

So basically the general idea is I want to make a 1 level paper 2d side scroller (I’m using the template that comes packaged with UE 4). There’s three things I want to code for it.

  • First I want to code a “pickup” so that when you run into it, it changes how high the character can jump, or give the character double jump so that the character may get to the last platform. (maybe even put a message on screen telling players this has happened).
  • Secondly I want to be able to code in a failure state so that if you fall off one of the platforms it puts you back at the beginning.
  • Thirdly I want a success state. Basically if you reach the final platform I want there to be a message that says well done and then resets the level.

I’m not expecting the code to just be given to me, as I’d love to be able to learn how to do all of this for future reference. Thanks for your time in reading this, and thanks in advance if you decide to help me :slight_smile:


  1. Create a blueprint actor and give it a box volume. Call it, “pick up”.
  2. Place it in the level.
  3. In the blueprint actor’s event graph, place an event called, “Event Begin Overlap”.
  4. From that event, drag off “Cast to WhateverYourPlayerActorIsCalled”, make sure to connect the blue node from the Event to the Cast.
  5. From the right side of the Cast, drag from the blue node, and search for “Jump Z Velocity”. Set this to whatever number you wish.
  6. From there, drag off a node called “Destroy Actor”. This will tell it to destroy itself after the pickup was activated.
  7. To see it in game, add a sprite component, the box volume will be invisible by default.

You can use the World KillZ to restart the level, however, I prefer to do my own coding. So I always go to Settings->World Settings and uncheck “Enable World Bounds Checks”.

  1. Then on the player blueprint, drag from the “Tick Event” a node called “Branch”.
  2. Right click somewhere and search for “Get Actor Location”.
  3. Drag from the orange pin, and “Break Vector”.
  4. Drag from the Z pin, and find “< float”.
  5. Drag from the red pin on the < float, to the branch.

This is saying, if Z less than 0, then go to true, otherwise, go to false on the branch.

Set to to a low negative number.

  1. Drag from the True pin on your branch, and look for “Open Level”, and type the exact map asset name.

When you get this working, the success state should be easy.