I’m making a 2D sidescroller game, and I have some objects that do different effects (slow you, give you a speed boost, make you jump higher, stop you from jumping etc etc)
I’d like to add in an object that “scrambles” the left and right movement keys. So left becomes right and right becomes left for a few seconds.
Is there a simple way to accomplish this?
This is what I have currently. I’m trying to make it so I hit the object and it reveres the movement on the x axis for 5 seconds. Am I missing something?
So I’m not super familiar with BP, but it looks like you’e just adding character movement in the -x direction, creating a delay, and then reverting everything back to normal. BUT, you’re doing it all in the same update/tick. The next frame hasn’t even started. What you need to do it have some kind of public variable that belongs to your character, and update that variable when the event is hit.
So let’s say in the BP where you have you character movement logic Tick, you have a boolean variable called scrambleMovementControls defaulted to false. When the event triggers, you need to set the variable to true and create a timer that will set scrambleMovementControls back to false when it’s complete.
Meanwhile, back in your character movement logic you have a branch node that if the aforementioned boolean is true, you multiply the movementDirection by -1 if you only want the x-direction to be effected, if it’s false just use your regular movementDirection.
I updated the original post, I’m trying to scramble the direction on event hit, so when I touch an object it reverses directions briefly.
Would you happen to know what I’m missing in the above blueprint?