1
0
Files
godotminiprojects/Collision/Scripts/PlayerMovement.gd
FoxSpellCaster 7afbac49d9 Final
2025-01-12 15:36:42 -05:00

15 lines
357 B
GDScript

extends RigidBody3D
@export var move_speed : float = 2.0
func _physics_process(_delta: float) -> void:
if Input.is_key_pressed(KEY_LEFT):
linear_velocity.x = -move_speed
if Input.is_key_pressed(KEY_RIGHT):
linear_velocity.x = move_speed
func _on_body_entered(body: Node) -> void:
if body.is_in_group("Tree"):
get_tree().reload_current_scene()