# How to add jumping with "add force"

**URL:** <https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070>\
**Category:** Blueprint\
**Tags:** platformer, jump, unreal-engine, UE4, question, Blueprint\
**Created:** [January 4, 2016, 5:00pm UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070 "2016-01-04T17:00:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 4, 2016, 10:11pm UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/21 "2016-01-04T22:11:23Z")

</div>

Should have something for you to try shortly. Working out a slightly different solution to your problem, it will be all BP, since I know thats the solution you’re looking for. Just making sure I am correct: You’re making a perpetual runner, that needs to be able to move to the right constantly, but also able to jump and slide based on keypress commands?

I’ll do a quick mockup using some generic assets, so you can see if its what you’re thinking. If so, you should be able to duplicate the solution easily. I’ll provide some basic instructions, just in case.

Edit: Answer posted. It works for me without issue.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 4, 2016, 10:33pm UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/22 "2016-01-04T22:33:39Z")

</div>

I really REALLY appreciate the work you’re going through to help me. Ya that’s correct. It will eventually be for the App store for apple products. But ya, really thank you.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 3:10am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/23 "2016-01-05T03:10:25Z")

</div>

So I went ahead and threw together a basic 2d side scroller, using the generic assets that were provided for the livestream to get a 2d character to play with. I built out the basics of a state machine, that calls the different sprite animations based on the current state, and also updates that state based on input from the player. This could be changed later, based on whatever you were looking to do with it. I also have the game set to check the state every tick, so that it can call the animation update as necessary. Additionally, the update ensures that if the game is started, the forward movement proceeds non-stop. You can jump and slide, but will always return to the default run state/animation.

You’ll need to create two variables and one enum. The enum will be Char\_States and the variables are an enum variable that is linked to that enum (Which I called CharState) and a boolean variable of GameStarted.

In the images, you’ll see each piece of the BP, built in the 2DSideScrollerCharacter BP, just for clarity.  
(The PrintString calls are just for testing purposes and can be removed. I’m sure there are cleaner ways to do this, but this is what I thought of off the top of my head, and it works, so there it is.)

 ![72914-beginplay.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/5/515105674530bd4f3e3d8a897c6e560655e24066.png)

 ![72915-jumpandslide.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/9/3094b0cdac6b9cd12db980e652fd0d68ef421847.png)

 ![72916-updateanimations.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/f/92ff70492a6b4e87afea807a28578763b1a1c924.png)

 ![72917-stateleft.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/d/ccde1b6d277862ca7ac45c76168ea8e7af40e3f5.png)

 ![72918-stateright.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/2/e928a9f502d73a37e4d85988845378e9260541e2.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 3:17am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/24 "2016-01-05T03:17:46Z")

</div>

Thank you so much for all the time you’ve spent. I will let you know when I’m done.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 3:18am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/25 "2016-01-05T03:18:08Z")

</div>

By done, I mean done with trying your suggestion.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 3:19am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/26 "2016-01-05T03:19:28Z")

</div>

No problem. Hopefully it does what you need it to! Good Luck!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 3:29am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/27 "2016-01-05T03:29:09Z")

</div>

I’m sorry, how do I make an “enum”?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 3:38am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/28 "2016-01-05T03:38:32Z")

</div>

When you’re in the content browser, right click, select Blueprints, then select Enumeration. In the enumeration, you’ll add your “states” that you intend to use when you add the switch later in the BP. Be sure to save the enum as a name you’ll recognize for when you set up the "switch on (whatever you named it).

Also, dont forget to create a enum variable in the BP as well, that links to the enum you just created. Additionally, make its name something recognizable also, so when you drop the getters and setters you’ll know what it’s referencing easier.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 3:46am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/29 "2016-01-05T03:46:17Z")

</div>

Alright, and how do I link the variable to the enum?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 3:56am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/30 "2016-01-05T03:56:58Z")

</div>

When you create the variable, it’ll default to boolean. Click the red pill and select the enum option, then click the enum you created. That’ll make a variable linked to your enum. Then just click on the name and set it to whatever you want, rather than NewVar\_0 or whatever it creates it as.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 3:58am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/31 "2016-01-05T03:58:56Z")

</div>

Alright…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:01am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/32 "2016-01-05T04:01:18Z")

</div>

Okay, so my “update animation” for the third photo is all blue rather than red, is that okay?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 4:01am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/33 "2016-01-05T04:01:20Z")

</div>

If you’re still having trouble, i’ll do a little tutorial video for it and go through how I set it up. Would take me a few hours to get that posted.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 4:02am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/34 "2016-01-05T04:02:50Z")

</div>

wrong node. The red one is a “custom event” the blue one points to that event.

Essentially, the red one is what is called by the blue nodes. When they are executed, they trigger the event, which is where the red one fires off. So you’ll need to have the red one to link to your switch to handle the animation switching, and then the blue ones that link to the machine that runs each tick, telling it when to run the red update animation node.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:05am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/35 "2016-01-05T04:05:08Z")

</div>

Alright, well we’ll see how this ends up, I’m getting close.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:06am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/36 "2016-01-05T04:06:48Z")

</div>

Alright. How do I do a custom one?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d180f57a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d180f57a](https://forums.unrealengine.com/u/anonymous_user_d180f57a)\
**Post date:** [January 5, 2016, 4:08am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/37 "2016-01-05T04:08:15Z")

</div>

right click anywhere in the BP, select events, then select “add custom event”. can also do a search for “add custom event”, that works too.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:15am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/38 "2016-01-05T04:15:49Z")

</div>

Alright! I’m done. Haven’t tested it out yet, would you mind looking over these screenshots real quick to make sure I got everything correct?alt text

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:16am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/39 "2016-01-05T04:16:04Z")

</div>

![72941-screenshot+(7).png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/9/3/d9384f91964574d9b656c62588e57a457405acdb.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1086f6781](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1086f6781](https://forums.unrealengine.com/u/anonymous_user_1086f6781)\
**Post date:** [January 5, 2016, 4:16am UTC](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070/40 "2016-01-05T04:16:19Z")

</div>

![72942-screenshot+(8).png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/2/1e2de21b6c18c06a1ed9010e51d852a60392dd12.png)

[Previous page](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070.md?page=1)

[Next page](https://forums.unrealengine.com/t/how-to-add-jumping-with-add-force/343070.md?page=3)
