Skip to content

Commit

Permalink
Update movement speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Trey2k committed Oct 13, 2023
1 parent cf40d21 commit 52e189d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions scenes/ships/player/player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ scale = Vector2(2, 2)
script = ExtResource("1_mugof")
health_bar = NodePath("HealthBar")
sprite = NodePath("Sprite2D")
max_strafe_speed = null
weapon_hardpoints = [NodePath("LeftPhaser"), NodePath("RighPhaser"), NodePath("CenterMissile")]

[node name="Sprite2D" type="Sprite2D" parent="."]
Expand Down
7 changes: 4 additions & 3 deletions scenes/ships/ship.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ extends CharacterBody2D

@export var max_health: int = 100

@export var max_speed: int = 200
@export var max_strafe_speed: int = 100
@export var max_speed: int = 400
@export var friction: int = 10
@export var acceleration: int = 15
@export var yaw_acceleration: float = 1
Expand Down Expand Up @@ -90,7 +89,9 @@ func _physics_process(delta: float) -> void:
if input.thrust == 0 and input.strafe == 0:
velocity = velocity.move_toward(Vector2(0, 0), friction)
else:
velocity = velocity.move_toward(Vector2(input.strafe * max_strafe_speed, input.thrust * max_speed).rotated(rotation), acceleration)
velocity = velocity.move_toward(Vector2(input.strafe * max_speed, input.thrust * max_speed).rotated(rotation), acceleration)

velocity = velocity.limit_length(max_speed)

move_and_slide()

Expand Down
1 change: 0 additions & 1 deletion scenes/ui/canvas_layer.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ layout_mode = 1
[node name="GameOverMenu" parent="Menus" instance=ExtResource("6_k28s6")]
visible = false
layout_mode = 1
is_paused = true

0 comments on commit 52e189d

Please sign in to comment.