mirror of
https://github.com/Steffo99/cinnos.git
synced 2024-11-22 08:04:20 +00:00
oiujhgyfvcdv
This commit is contained in:
parent
ab27c3f440
commit
b4b114d7b1
4 changed files with 38 additions and 25 deletions
|
@ -5,6 +5,8 @@ class_name Player
|
||||||
@export var input_accel: float = 7.0
|
@export var input_accel: float = 7.0
|
||||||
@onready var current_input_accel = input_accel
|
@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")
|
@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 jump_impulse: Vector3 = Vector3.UP * 5;
|
||||||
@export var friction: float = 0.8
|
@export var friction: float = 0.8
|
||||||
|
@ -30,6 +32,9 @@ func on_banana():
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
# Applica attrito
|
||||||
|
velocity *= friction
|
||||||
|
|
||||||
# Refilla salto
|
# Refilla salto
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
refill_jumps()
|
refill_jumps()
|
||||||
|
@ -44,7 +49,9 @@ func _physics_process(delta):
|
||||||
# Applica input
|
# Applica input
|
||||||
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
var input_change = input_dir * input_accel
|
var input_change = input_dir * input_accel
|
||||||
|
if velocity.x <= maxspeed:
|
||||||
velocity.x += input_change.x * delta
|
velocity.x += input_change.x * delta
|
||||||
|
if velocity.z <= maxspeed:
|
||||||
velocity.z += input_change.y * delta
|
velocity.z += input_change.y * delta
|
||||||
|
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
48
Root.tscn
48
Root.tscn
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@ dest_files=["res://.godot/imported/bar.glb-139074adc7849aaaa341d878a4111029.scn"
|
||||||
nodes/root_type="Node3D"
|
nodes/root_type="Node3D"
|
||||||
nodes/root_name="Scene Root"
|
nodes/root_name="Scene Root"
|
||||||
nodes/apply_root_scale=true
|
nodes/apply_root_scale=true
|
||||||
nodes/root_scale=1.0
|
nodes/root_scale=4.0
|
||||||
meshes/ensure_tangents=true
|
meshes/ensure_tangents=true
|
||||||
meshes/generate_lods=true
|
meshes/generate_lods=true
|
||||||
meshes/create_shadow_meshes=true
|
meshes/create_shadow_meshes=true
|
||||||
|
|
|
@ -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"]
|
[ext_resource type="Texture2D" uid="uid://cpbb24lnr0sf4" path="res://addons/asphalt.png" id="1_6yda2"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue