#Something is Very Wrong.

9 messages · Page 1 of 1 (latest)

visual epoch
#

Hey! I tried out just the movement script part of this and found that the buck stopped with moving right if I pressed right first, and it wouldn't take any other input thereafter. So I think doing a list of if-statements like you have isn't doing you any good here.

I found the attached code to be much simpler and functional.

Exchange my "Forward" with "move_up", "Backwards" with move_down", Right with move_right and so on. (I just quickly tested this in a project where I already had an Input map set up.)

I had no problems with the player disappearing just based on the movement, so this is likely something to do with your animations, or triggering the hit function somehow.

brazen talon
#

Thank you. I'm not quite sure what to do with this, but should I replace the move_down, move_up etc. with the names of the directions in the input map for the player? Or additionally, should I replace that whole section with your bit of code that you sent me? Because I am working with what the tutorials document things gave me, and right now don't have the ability to come up with other ideas, since I'm still trying to get a grasp on the basics.

#

I see you spoke of a node (I assume seperate) should I add a node and attach a script to it, and have that node as a child of the player, and put the code on that?

#

I feel like I should have added before, I didn't encounter these problems until I tried to put the player in the "node" node called "node" initially, that I renamed to "main" because I had to set it as the main scene, and it has a lot of child nodes (3 of them are just timers and one is just an instance of the player) and they might have something to do with it.

#

Right now, I can't really go into the editor for this project, since I'm on a laptop right now, and I have only worked on my desktop for this.

visual epoch
#

I'm afraid I can't make much of what you're saying, that's a lot of confusing information without seeing screenshots and seeing what you mean 😅

I assume what you sent was the main player-movement script attached to whatever node is your player. So you can copy my code into your process function and delete the four if-statements for Input.

You must have set up an Input map in Project Settings > Input, and named your Input "move_down", "move_up", etc.

So in the Input.get_axis I proposed, instead of writing "Forward" as I did (which is my input name for "up"), you'll want to put "move-up", etc.

#

I tried adding this script to an area-2D node as it seemed that'swhat you had done. So it would be moving that area 2D, and a player sprite and collision object should be children of that area 2D.

brazen talon
#

Thanks, and thank you for still trying to help after having not understood my admittedly confusing words. Good day.

#

I don't don't really have a proper grasp on the correct terminology, so that doesn't help