1
Fork 0
mirror of https://github.com/Steffo99/cinnos.git synced 2024-11-21 23:54:20 +00:00
This commit is contained in:
Leonardo 2023-11-25 20:37:20 +01:00
commit 148b8df31b
4 changed files with 43 additions and 19 deletions

View file

@ -5,6 +5,8 @@ class_name Player
@export var input_accel: float = 7.0
@onready var current_input_accel = input_accel
@export var maxspeed: float = 100
@onready var gravity_accel: Vector3 = ProjectSettings.get_setting("physics/3d/default_gravity") * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
@export var jump_impulse: Vector3 = Vector3.UP * 5;
@export var friction: float = 0.8
@ -30,6 +32,9 @@ func on_banana():
func _physics_process(delta):
# Applica attrito
velocity *= friction
# Refilla salto
if is_on_floor():
refill_jumps()
@ -44,8 +49,10 @@ func _physics_process(delta):
# Applica input
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
var input_change = input_dir * input_accel
velocity.x += input_change.x * delta
velocity.z += input_change.y * delta
if velocity.x <= maxspeed:
velocity.x += input_change.x * delta
if velocity.z <= maxspeed:
velocity.z += input_change.y * delta
move_and_slide()

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@ dest_files=["res://.godot/imported/bar.glb-139074adc7849aaaa341d878a4111029.scn"
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/root_scale=4.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true

View file

@ -1,4 +1,4 @@
[gd_resource type="PlaneMesh" load_steps=3 format=3 uid="uid://jy4q18wf2j41"]
[gd_resource type="PlaneMesh" load_steps=3 format=3 uid="uid://by8t4bly4lrhj"]
[ext_resource type="Texture2D" uid="uid://cpbb24lnr0sf4" path="res://addons/asphalt.png" id="1_6yda2"]