improved the player movement script and made some of its constants and variables static#17
improved the player movement script and made some of its constants and variables static#17Sulucnal wants to merge 6 commits intoMaruno17:mainfrom
Conversation
|
At first glance this appears to work as intended. However, it only appears to work as it simply ignores controller input. Changing line 59 in For |
|
I would also put the whole logic of deciding the player direction into a component that would return the new direction (and maybe hold last) so we can easily swap between dir4, dir8, dir360 :) |
There is now a new constant called GRID_MODE in the Constants class that let you chouse between 3 modes of movements. When the process_player_input function from the Player script gets the input_direction, it now goes through a _get_appropriate_direction function to get reassigned to a proper value depending on the movement mode. IMPORTANT: For now, the input_direction conversion is the only thing working. The proper way to handle movement and animation outside of the "GRID_4" movement mode hasn't been implemented.
|
I tried to implement a function to do what you asked for but I'm not 100% sure if that's what you had in mind, so feel free to take a look at the |
|
Not really. I did not ask to implement the dir8 or dir4 but make it composable. Here's a video that would explain better what I had in mind: https://www.youtube.com/watch?v=74y6zWZfQKk (Don't overwork yourself btw) |
|
I imagine that in most cases, you'd want every overworld entity to move the same way as the player for the sake of consistency. In that case, wouldn't making it a component mean that we'd have to remember to attach the node we want not only to the player, but also to every single moving entity in our game? |
|
Entities should move with a velocity vector or something. This one in particular it's only about controlling the player movements with inputs |
Animations aren't implemented yet.
Still no proper handling of animations.
|
I didn't know there was new commits. Remind me tomorrow to take a look please :) |
|
Sure. However, movement animations haven't been re-implemented yet and I got too lazy to find a way to fix it so if you (or anyone else) want to give it a go, be my guest. |
|
It looks a bit better but there's few stuff that bother me. Can you give me write permission to your repository so I can work a bit on that as well? |
|
I just added you as a collaborator. |
|
Nice, thanks :D |
When an horizontal movement key and a vertical one are both pressed at once, the player will move in the direction of the last key pressed instead of defaulting to the horizontal direction.
I also added inputs specific to the player's movements separate from the UI ones and changed the deadzone of the movement input from 0.5 to 0.1.