I have a question regarding movements
So I have a box and when I press W,A,S,D or touchpad I want that box not just to move, but to move an exact distance.
See the box2 photo to understand what I mean
Thanks
I have a question regarding movements
So I have a box and when I press W,A,S,D or touchpad I want that box not just to move, but to move an exact distance.
See the box2 photo to understand what I mean
Thanks
Try using this setup:
AddActorLocalOffset will change the offset of the actor by the specified values depending on its orientation (if you want to change it in relation to the world use AddActorWorldOffset). Modify the Delta Location pin as you see fit to get the movement you want.
EDIT: I updated the image! Ofc you are right, this is what happens when you don’t test your blueprint before commenting and assume it is right ^^
Problems i did not think of:
1 InputAxisWhatever and related blocks fire every single tick, even when the axis value is 0, so a quick check makes sure the player actually pressed the button
2 If you keep the button pressed it will move every tick, the Do Once block only allows this to happen once, as the name says. As soon as you release (axis value goes back to 0) it is reset and you are allowed to move again.
Things left for you to do: change the InPutAxisWhatever to what you want and change the values and axes in the AddActorLocalOffset to what you want.
Phew… Let me know if this helped!
The box just keeps on going without stop. I need just one step and stop! For example like in Crossy Road game))
Just a liiitle question How you have combined axis value to condition(green to red)? Yeah maybe an embarrassing question
You should move when the axis value (a float, green) is greater than 0.0, that’s why you first have to compare it (search for greater than in the searchbox) what comes out of the comparison is a boolean (either true or false). This will be the condition for the branch.
In case it is true (the axis value is greater than 0.0), you proceed to move the cube, in case it is false (it is not greater than 0.0, therefore the button has not been pressed) you reset the DoOnce so the movement can be executed as soon as you press again.
It worked. Thank you so much.
But I have another problem now
I am having a really hard time imagining what you are trying to achieve. Maybe some idea on what the game should look like could help me give you some precise pointers. Every other advice i can give you right now would be guessing.
Anyways I would suggest you to try to find solutions by yourself (that’s what game development is all about!), and ask as a last resort. Try to find similiar projects on the web and take a look at how they made it, i am sure you will be successful!
Cheers
So, how is it going? Need any more advice or can we close the problem as resolved?
The moving part is resolved, but as I don’t have much time now, I am not looking for answers to my other questions that came after that part. But thanks for the help, you really helped me!