Update do projeto ate a aula 10

This commit is contained in:
2026-05-09 16:25:30 -03:00
parent c95f8f98d8
commit b42d7cddc5
8 changed files with 2800 additions and 50 deletions
+1 -17
View File
@@ -7,11 +7,8 @@ const JUMP_VELOCITY = 10.0
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
@export var view : Node3D
@export var timer : Timer
var movement_velocity : Vector3
var rotation_direction : float
var can_jump := true
var can_timeout := true
func _physics_process(delta: float) -> void:
handle_input(delta)
@@ -19,13 +16,6 @@ func _physics_process(delta: float) -> void:
jump()
handle_animations()
if is_on_floor():
can_jump = true
else:
if can_timeout:
timer.start()
can_timeout = false
var applied_velocity : Vector3
applied_velocity = velocity.lerp(movement_velocity, delta * 10)
applied_velocity.y = -gravity
@@ -65,14 +55,8 @@ func apply_gravity(delta):
gravity += 25 * delta
func jump():
if Input.is_action_just_pressed("move_jump") and can_jump:
if Input.is_action_just_pressed("move_jump") and is_on_floor():
gravity = -JUMP_VELOCITY
can_jump = false
if gravity > 0 and is_on_floor():
gravity = 0
func _on_timer_timeout() -> void:
can_jump = false
can_timeout = true