Subindo repositorio

This commit is contained in:
2026-05-02 19:54:53 -03:00
parent 9db1e98761
commit d01e2e8578
493 changed files with 63532 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
extends Node3D
@export_group("Properties")
@export var target: Node3D
@export_group("Zoom")
@export var zoom_minimum = 16
@export var zoom_maximum = 4
@export var zoom_speed = 10
@export_group("Rotation")
@export var rotation_speed = 120
@export var maximum_rotation_angle_x = -80
@export var minimum_rotation_angle_x = -10
var camera_rotation:Vector3
var zoom = 10
@onready var camera = $Camera
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
camera_rotation = rotation_degrees
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
self.position = self.position.lerp(target.position, 4 * delta)
rotation_degrees = rotation_degrees.lerp(camera_rotation, 6 * delta)
camera.position = camera.position.lerp(Vector3(0, 0, zoom), 8 * delta)
handle_input(delta)
func handle_input(delta):
var input := Vector3.ZERO
input.y = Input.get_axis("camera_left", "camera_right")
input.x = Input.get_axis("camera_up", "camera_down")
camera_rotation += input * rotation_speed * delta
camera_rotation.x = clamp(camera_rotation.x, maximum_rotation_angle_x, minimum_rotation_angle_x)
zoom += Input.get_axis("zoom_in", "zoom_out") * zoom_speed * delta
zoom = clamp(zoom, zoom_maximum, zoom_minimum)
+1
View File
@@ -0,0 +1 @@
uid://ciatq4g0mefhf
+22
View File
@@ -0,0 +1,22 @@
extends Area3D
const ROTATION_SPEED := 50.0
var start_pos := position.y
var end_pos := position.y + 0.5
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var coin_tween := create_tween().set_loops().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE)
coin_tween.tween_property(self, "position:y", end_pos, 1.0).from(start_pos)
coin_tween.tween_property(self, "position:y", start_pos, 1.0).from(end_pos)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
rotate_y(deg_to_rad(ROTATION_SPEED * delta))
func _on_body_entered(body: Node3D) -> void:
if body.name == "Player":
queue_free()
+1
View File
@@ -0,0 +1 @@
uid://6rimb66h8q5h
+62
View File
@@ -0,0 +1,62 @@
extends CharacterBody3D
const SPEED = 200.0
const JUMP_VELOCITY = 10.0
@onready var animator = get_node("gobot/AnimationPlayer") as AnimationPlayer
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
@export var view : Node3D
var movement_velocity : Vector3
var rotation_direction : float
func _physics_process(delta: float) -> void:
handle_input(delta)
apply_gravity(delta)
jump()
handle_animations()
var applied_velocity : Vector3
applied_velocity = velocity.lerp(movement_velocity, delta * 10)
applied_velocity.y = -gravity
velocity = applied_velocity
move_and_slide()
if Vector2(velocity.z, velocity.x).length() > 0:
rotation_direction = Vector2(velocity.z, velocity.x).angle()
rotation.y = lerp_angle(rotation.y, rotation_direction, delta * 10)
func handle_input(delta):
var input := Vector3.ZERO
input.x = Input.get_axis("move_left", "move_right")
input.z = Input.get_axis("move_backward", "move_foward")
input = input.rotated(Vector3.UP, view.rotation.y).normalized()
velocity = input * SPEED * delta
func handle_animations():
if is_on_floor():
if abs(velocity.x) > 1 or abs(velocity.z) > 1:
animator.play("Run", 0.3)
else:
animator.play("Idle", 0.3)
else:
animator.play("Jump", 0.3)
if !is_on_floor() and gravity > 2:
animator.play("Fall", 0.3)
func apply_gravity(delta):
if not is_on_floor():
gravity += 25 * delta
func jump():
if Input.is_action_just_pressed("move_jump") and is_on_floor():
gravity = -JUMP_VELOCITY
if gravity > 0 and is_on_floor():
gravity = 0
+1
View File
@@ -0,0 +1 @@
uid://br37fvj5ces50