Skip to content

Created new tile map that isnt depreciated, organized variables a lit…#1

Open
DylanSoule wants to merge 1 commit into
mainfrom
movement
Open

Created new tile map that isnt depreciated, organized variables a lit…#1
DylanSoule wants to merge 1 commit into
mainfrom
movement

Conversation

@DylanSoule
Copy link
Copy Markdown
Collaborator

…tle bit, new floor that doesn't look abismal and actulaly has a decent hit box,

…tle bit, new floor that doesn't look abismal and actulaly has a decent hit box,
Comment thread Scripts/player.gd
Comment on lines +22 to 24
var is_rolling: bool = false
enum State{IDLE, WALK, JUMP, DOWN, CROUCH, SNEAK, ROLL, SPRINT, SLIDE}
var current_state: State = State.IDLE
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread Scripts/player.gd
Comment on lines +22 to 24
var is_rolling: bool = false
enum State{IDLE, WALK, JUMP, DOWN, CROUCH, SNEAK, ROLL, SPRINT, SLIDE}
var current_state: State = State.IDLE
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread Scripts/player.gd
@@ -9,20 +10,26 @@
@export var sprint: float = 1.5
@export var sneak_speed: float = speed * 2/3
@export var crouch: bool = false
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a crouch variable in addition to the state of the character

Comment thread Scripts/player.gd
Comment on lines 56 to 62
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
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having to have an input pressed when wall jumping feels a little clunky. Potentially do raycasts?

Comment thread Scripts/player.gd
Comment on lines 31 to 35
handle_input()
update_animation()
move_and_slide()
update_movement(delta)
update_states()
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread Scripts/player.gd

var direction = Input.get_axis("move_left", "move_right")

if (is_on_floor() || coyote_timer.time_left > 0) && jump_buffer_timer.time_left > 0:
Copy link
Copy Markdown
Collaborator Author

@DylanSoule DylanSoule Jun 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big deal but inconsistancy of switching between oporator syntax is a little weird

Suggested change
if (is_on_floor() or coyote_timer.time_left > 0) and jump_buffer_timer.time_left > 0:

Comment thread Scripts/player.gd
Comment thread Scripts/player.gd
Comment on lines 154 to 158
State.ROLL when is_rolling == false:
if velocity.x == 0:
current_state = State.IDLE
else:
current_state = State.WALK
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roll never idles when you stop moving, im guessing becuase is_rolling never gets set to false

Comment thread Scripts/player.gd
Comment on lines 89 to 158
@@ -146,5 +154,5 @@
State.ROLL when is_rolling == false:
if velocity.x == 0:
current_state = State.IDLE
else:
current_state = State.WALK
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like theres gotta be a better way to do this, might get fixed by implamenting functions per action. Not totally sure tho

Comment thread Scripts/player.gd

func _on_animated_sprite_2d_animation_finished() -> void:
if animations.name == "roll":
is_rolling = false # Replace with function body.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_rolling = false

Comment thread Scripts/player.gd
Comment on lines 176 to 178
func _on_animated_sprite_2d_animation_finished() -> void:
if animations.name == "roll":
is_rolling = false # Replace with function body.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function isn't actually linked to the animated sprite(At least on my side)

Comment thread Scripts/player.gd
if is_on_floor():
if velocity.x == 0:
current_state = State.IDLE
elif velocity.x > speed - 20:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like a weird way to do a roll, so is it just basically a sprint 2 once you get up to speed?

Copy link
Copy Markdown
Collaborator Author

@DylanSoule DylanSoule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread Scripts/player.gd
# 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
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are variables based on speed still exported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant