I’m working on a 2D game, where the character can shoot in 3 ways: ground, air (while jumping) and grabbing a wall.
I’m having difficulty about grabbing the wall.
What I want to do is: when the character hits the wall collider and if I press the Shift button, it will make the character mantain his X,Y and Z positions, like the gravity was set to Zero in that moment. And the animation will change from jumping to wall_shoot.
I’m new at the unreal blueprint, so the thing I did is at the picture. I’m having 1 problem at this moment. When I’m in the air pressing Shift, the character still recieve all the Inputs, the only diference is he does not move. If I press A to move to the Left, the animation changes direction to my left.
So, I have to disable the inputs while I’m pressing Shift? But how can I enable it releasing the button?
If anyone has any ideas to help me here I’m open to anything.
Here is a blueprint pic with what I did till now
You can disable gravity using blueprints. There are overlap events for when you collide with things. You can give walls a specific tag and check for that tag when colliding with an item. Or, you could check if player is on the ground using the CanJump function which I believe is built in. If false, player is in air when colliding. There are a lot of things you have to consider though. If you overlapped something with your head it wouldn’t make sense to hang in the air by your head. When you receive an overlap event do a trace from your characters body to the direction he was traveling to make sure it hits land approximately at body height.
The character movement component and all its features is pretty neat but you might want to consider writing your own if going 2D. It would be good practice and you will have more control over things in the end.
You can change the movement mode from walking to flying.
If you got to you character blueprint then to the character movement options you can change the air boost multiplier to “0”. After that you can create an input event using “Shift” that fires the “Set Movement Mode” referenced by the character movement. Change the option to “Flying”. This will keep the player in-place when on a ledge. You can then disable the “Input axis move forward” to keep the player from moving forward and backwards. You simply change back to “walking” with another key or something when you are done ledge climbing.
I put a image now with my blueprint showing what I did. I have to disable the axis move right(because is 2D) and disable other actions, like jumping. But I have to mantain the Shoot action. How can I disable them? Like I said, I’m new at unreal so I dont know much about programming, sorry.
I guess I missed the part where you said 2d game, but the blueprints would be close to the same. You can create a bool variable that you you enable when you want to disable them and add a branch in front of the action. I use this when I am in menus because many times I cannot completely disable game inputs. Just change the variable to one that applies to you.