So I’ve been working on a little arcade game in my free time, but I’ve just hit a snag;
When pressing the fire button for player 1 (w), the player shoots. Great! However, if you press it too soon after the game begins/its the first input you press, the player… moves forward?
My game is locked to a grid, using movetocomponent movements, so the ONLY way the player can move is by directly moving to components to the left or right of them. Going forwards should not happen, and as far as I can see in my script, CANNOT happen? I have not put a single piece of script in here for the player to move forward, so why does this happen? It feels strange enough for it to be a bug, but I can consistently get it to happen. If any other keys are pressed before W, the player will not move forwards until the game is reset.
It isn’t just W either, I’ve tried other keys like T, etc.
This is the code for the W key. I don’t see anything here for movement? Could it be to do with possession…?
Can you post a screenshot of your project settings input section? Also, do you happen to have any input action nodes placed on the player controller, etc?
I don’t have any axis inputs, they’re all action inputs, as all I need to use is movetocomponent scripts.
There is no code on my character blueprint other than shooting.
The only other input action code is on the level blueprint for moving left and right;
Which is bound to A or D, so shouldn’t be the thing causing the issue…
However, if you press it too soon
after the game begins/its the first
input you press, the player… moves
I wonder if this has something to do with default Pawn (which has a floating movement component and can process input).
Could you clarify briefly how your Pawn is set up in the Game Mode and/or how you Possess the Pawn that processes
P1_Shoots in the screenshots above?
The ship pawn is set to auto-possess player 0, I believe. I moreso did this so that when you click play it doesn’t spawn a new ship that just falls. If there’s a better way to do this that will also fix my input issue I’d love to know!
Ideally, you’d do this in the Game Mode, then the possession is automatic:
Another way to do it, is to disable input in the Player Controller, and only enable it once you possess your Pawn