x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to make a double jump function for a 2D platformer

Hi

We are making a 2D platformer and would like to add a wall jump function to the game. What is the easiest way to do this with blueprints?

Thanks!

Product Version: UE 4.10
Tags:
more ▼

asked Jun 04 '16 at 01:32 PM in Blueprint Scripting

avatar image

Sebburito
1 2 3 3

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

So you want to add wall jump or double jump function? :D

I assume you meant wall jump, so here it is.

Wall jump is pretty simple, you have bool IsOnWall and and float WallNormal. On event hit on CapsuleComponent (Make sure simulation creates hit events is on), set the IsOnWall to true and WallNormal to Impact normals X axis. After that delay 0.1 seconds and after it, set IsOnWall to false.

When the jump function is called, add a branch that checks the IsOnWall. If not, jump regularly. If is, add impulse to character movement: Make vectorX:WallNormal Z:1 and after the make vector, multiply it by float WallJumpImpulse. The number must be really high sometimes, just play with it. I think that's it, cheers! :)

more ▼

answered Jun 04 '16 at 02:20 PM

avatar image

Derzo
691 28 8 50

avatar image Sebburito Jun 04 '16 at 03:13 PM

Sorry for the confusion, yes we ment wall jump.

Thanks for the quick response! :)

avatar image Derzo Jun 04 '16 at 03:18 PM

No problem! :)

avatar image Sebburito Jun 04 '16 at 03:36 PM

Would it be possible for you to make this as a blueprint and send a screen shot? That would be much appreciated. We can't seem to get it to work, we are sort of new to Unreal.

Thanks again!

(comments are locked)
10|2000 characters needed characters left

Here you go :)

alt text

(pssst I'm also trying to beat Luos at answerhub leaderboards, so I'm begging for some karma.. ;)

more ▼

answered Jun 04 '16 at 03:54 PM

avatar image

Derzo
691 28 8 50

avatar image Sebburito Jun 04 '16 at 04:04 PM

You are our hero! <3

Thanks a lot!

avatar image Sebburito Jun 05 '16 at 10:23 AM

Hi again!

So we have a small problem. The Break Hit Result is there but we don't have the Impact Normal X option, so there is no way to connect it with the Set Wall Normal. Are we doing something wrong? alt text

(comments are locked)
10|2000 characters needed characters left

Right click on the impact normal and Split Structure Pin.

more ▼

answered Jun 05 '16 at 10:25 AM

avatar image

Derzo
691 28 8 50

avatar image Sebburito Jun 05 '16 at 10:32 AM

Well that was easy. Thanks yet again! :)

avatar image samuelhely Jun 05 '16 at 06:39 PM

The Unreal Stick Figure 2D already has a double jump implemented.

Just open the Learn tab in the launcher and look for it.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question