Sidescroller Template: Can't figure out jumping
I'm trying to make my first game with Unreal. I figured I'd start simple so I booted up the sidescroller template and figured I'd go from there. I decided to make you jump higher when you hold the button, and found the variable JumpMaxHoldTime.
Whenever I set this variable to a non-zero value, it gets the desired effect, but it also makes the character able to jump infinitely without touching the ground. I've tried looking at the ACharacter class it inherits from, but couldn't find the cause of it. What's more, when I comment out some of the code in the template's character class...
The character still jumps normally. I've rebuilt, testing with a log statement to make sure the rebuild worked, but the odd behaviours are consistent. From what I can tell there isn't any instance of a Jump() or StopJumping()
I was hoping someone could explain to me what's causing this behaviour.
asked Nov 22 '14 at 05:38 AM in C++ Programming
Alright, I figured out how to solve it.
ACharacter::Jump() does not properly check whether the player can jump or not before executing the jump. By including:
in the (GameName)Character.h file and then adding a modified jump function in (GameName)Character.cpp file:
Seems to have fixed the infinite jumping problem and has "holding jump" working as intended.
As for TouchStarted() and TouchStopped(), after reading their parameters I realized they were functions for jumping with a touch screen or similar interface and removed them from my class's .h and .cpp files.
Follow this question
Once you sign in you will be able to subscribe for any updates here