Created new tile map that isnt depreciated, organized variables a lit…#1
Created new tile map that isnt depreciated, organized variables a lit…#1DylanSoule wants to merge 1 commit into
Conversation
…tle bit, new floor that doesn't look abismal and actulaly has a decent hit box,
| var is_rolling: bool = false | ||
| enum State{IDLE, WALK, JUMP, DOWN, CROUCH, SNEAK, ROLL, SPRINT, SLIDE} | ||
| var current_state: State = State.IDLE |
There was a problem hiding this comment.
Why is there a separate is rolling variable as well as the state variable, can you not just check the state to see if character is rolling?
| var is_rolling: bool = false | ||
| enum State{IDLE, WALK, JUMP, DOWN, CROUCH, SNEAK, ROLL, SPRINT, SLIDE} | ||
| var current_state: State = State.IDLE |
There was a problem hiding this comment.
Is crouching and rolling not the same thing? Also I get putting the functionality in for all of this but realistically how many of these things do we actually need for the game? Cuz isn't the whole thing that hes just a normal guy that found a magic object
| @@ -9,20 +10,26 @@ | |||
| @export var sprint: float = 1.5 | |||
| @export var sneak_speed: float = speed * 2/3 | |||
| @export var crouch: bool = false | |||
There was a problem hiding this comment.
Do we need a crouch variable in addition to the state of the character
| velocity.y = jump_speed | ||
| current_state = State.JUMP | ||
| velocity.x += wall_jump_pushback | ||
| if Input.is_action_pressed("move_right"): | ||
| velocity.y = jump_speed | ||
| current_state = State.JUMP | ||
| velocity.x -= wall_jump_pushback |
There was a problem hiding this comment.
having to have an input pressed when wall jumping feels a little clunky. Potentially do raycasts?
| handle_input() | ||
| update_animation() | ||
| move_and_slide() | ||
| update_movement(delta) | ||
| update_states() |
There was a problem hiding this comment.
Having these all in different functions feels a little bit weird, would it not be better to have a function for each individual action that can be called in the physics process instead of breaking everything up, which means a lot more checks/if statements and more possibilty for errors and makes debugging a pain
|
|
||
| var direction = Input.get_axis("move_left", "move_right") | ||
|
|
||
| if (is_on_floor() || coyote_timer.time_left > 0) && jump_buffer_timer.time_left > 0: |
There was a problem hiding this comment.
not a big deal but inconsistancy of switching between oporator syntax is a little weird
| if (is_on_floor() or coyote_timer.time_left > 0) and jump_buffer_timer.time_left > 0: |
| State.ROLL when is_rolling == false: | ||
| if velocity.x == 0: | ||
| current_state = State.IDLE | ||
| else: | ||
| current_state = State.WALK |
There was a problem hiding this comment.
roll never idles when you stop moving, im guessing becuase is_rolling never gets set to false
| @@ -146,5 +154,5 @@ | |||
| State.ROLL when is_rolling == false: | |||
| if velocity.x == 0: | |||
| current_state = State.IDLE | |||
| else: | |||
| current_state = State.WALK | |||
There was a problem hiding this comment.
I feel like theres gotta be a better way to do this, might get fixed by implamenting functions per action. Not totally sure tho
|
|
||
| func _on_animated_sprite_2d_animation_finished() -> void: | ||
| if animations.name == "roll": | ||
| is_rolling = false # Replace with function body. |
There was a problem hiding this comment.
| is_rolling = false |
| func _on_animated_sprite_2d_animation_finished() -> void: | ||
| if animations.name == "roll": | ||
| is_rolling = false # Replace with function body. |
There was a problem hiding this comment.
function isn't actually linked to the animated sprite(At least on my side)
| if is_on_floor(): | ||
| if velocity.x == 0: | ||
| current_state = State.IDLE | ||
| elif velocity.x > speed - 20: |
There was a problem hiding this comment.
this seems like a weird way to do a roll, so is it just basically a sprint 2 once you get up to speed?
DylanSoule
left a comment
There was a problem hiding this comment.
Left comments on peices of code I found weird. Mostly boils down to seemingly unessesary variables in addition to the character state and instead of having function for updating different parts(eg. input, animations, state, etc.) have a function for each action(eg. jump, roll, walk, etc.)
Also assests are a little freaky so I imported an itch io sprite sheet for world map.
Changed tilemap to TileMapLayer to get non depreciated object(Just need multiple for background, midground, foreground, etc(change order on z-layer)
Nitpicky, but it sorta feels like when you stop moving left or right it takes a while to slow down, which doesn't work great if we want precise movement for compat/platforming(idk how you balence this with just stopping feeling bad too)
| # Exported variables to allow editing in inspector | ||
| @export var speed: float = 150 | ||
| @export var accelleration: int = 10 | ||
| @export var jump_speed: float = -speed * 5/3 |
There was a problem hiding this comment.
why are variables based on speed still exported?
…tle bit, new floor that doesn't look abismal and actulaly has a decent hit box,