Compare commits

...

2 Commits

Author SHA1 Message Date
5c2ddb4936 remove zeroing velocity when hitting floor 2025-08-22 23:50:58 +10:00
c57b275b83 add trajectory starting dashed line and fixed walk 2025-08-22 23:50:24 +10:00
3 changed files with 15 additions and 6 deletions

View File

@@ -1071,5 +1071,13 @@ position = Vector2(119, -2686)
script = ExtResource("4_74lek")
_steps = 190
_jump = false
_walk = true
_stop_on_landing = false
metadata/_custom_type_script = "uid://ceyu5der8j8gq"
[node name="Trajectory17" type="Marker2D" parent="Trajectories"]
position = Vector2(114, -2672)
script = ExtResource("4_74lek")
flip = true
_steps = 190
metadata/_custom_type_script = "uid://ceyu5der8j8gq"

View File

@@ -75,15 +75,12 @@ static func process_movement(
static func process_collision(
new_velocity: Vector2,
hit_floor: bool,
hit_slope: bool,
hit_ceiling: bool,
hit_wall: bool,
floor_angle: float,
wall_bounce_velocity_loss: float,
) -> Vector2:
if hit_floor and not hit_slope and not hit_wall and not hit_ceiling:
new_velocity = Vector2.ZERO
if hit_slope:
new_velocity = (
new_velocity.slide(Vector2.UP.rotated(floor_angle))
@@ -289,7 +286,6 @@ func _handle_collision() -> void:
_velocity = process_collision(
_velocity,
hit_floor,
hit_slope,
hit_ceiling,
hit_wall,

View File

@@ -193,9 +193,14 @@ func _draw() -> void:
Vector2(sin(charge_strength * PI * 2), -cos(charge_strength * PI * 2)) * 30
)
draw_line(pos, pos + charge_strength_line, _charge_color)
draw_dashed_line(
pos + Vector2.LEFT * _player_size.x / 2,
pos + Vector2.RIGHT * _player_size.x / 2,
Color.WHITE
)
var velocity: Vector2
var direction: float = -1.0 if flip else 1.0
var direction: float = 0
var jump_released: bool = false
var floor_angle: float = 0
@@ -211,6 +216,7 @@ func _draw() -> void:
break
jump_released = i == 0 and _jump
direction = (-1.0 if flip else 1.0) if (_walk or jump_released) else 0.0
velocity = (
Player
@@ -282,7 +288,6 @@ func _draw() -> void:
Player
. process_collision(
velocity,
hit_floor,
hit_slope,
hit_ceiling,
hit_wall,