mirror of
https://github.com/Steffo99/cinnos.git
synced 2024-11-27 10:34:21 +00:00
garasauto
This commit is contained in:
parent
5216510551
commit
fdacf94978
3 changed files with 24 additions and 3 deletions
13
Camera3D.gd
Normal file
13
Camera3D.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends Camera3D
|
||||
|
||||
|
||||
@export var target: Node
|
||||
@onready var offset: Vector3
|
||||
|
||||
|
||||
func _ready():
|
||||
offset = position - target.position
|
||||
|
||||
|
||||
func _process(delta):
|
||||
position = target.position + offset
|
|
@ -14,6 +14,8 @@ class_name Player
|
|||
|
||||
@export var collision_normal_max_y_for_floor: float = 0.9
|
||||
|
||||
var last_direction: Vector2 = Vector2.UP
|
||||
|
||||
|
||||
func refill_jumps():
|
||||
current_jumps = max_jumps
|
||||
|
@ -45,7 +47,10 @@ func _physics_process(delta):
|
|||
|
||||
move_and_slide()
|
||||
|
||||
rotation.y = input_dir.normalized().angle_to(Vector2.UP)
|
||||
if input_dir.length() > 0.01:
|
||||
last_direction = input_dir
|
||||
|
||||
rotation.y = last_direction.normalized().angle_to(Vector2.UP)
|
||||
|
||||
# Gestisci collisioni
|
||||
for collision_idx in range(get_slide_collision_count()):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=17 format=3 uid="uid://4whij2hmts0t"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://4whij2hmts0t"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player.gd" id="1_wt4gx"]
|
||||
[ext_resource type="Material" uid="uid://dondfiavgo2ws" path="res://Unshaded.material" id="2_upp15"]
|
||||
|
@ -7,6 +7,7 @@
|
|||
[ext_resource type="Script" path="res://GameTimer.gd" id="3_y362g"]
|
||||
[ext_resource type="Script" path="res://TextBox.gd" id="4_gpkq6"]
|
||||
[ext_resource type="FontFile" uid="uid://qf3uxmta6lpw" path="res://fonts/FiraCode-Medium.ttf" id="5_yvnu2"]
|
||||
[ext_resource type="Script" path="res://Camera3D.gd" id="8_auifr"]
|
||||
[ext_resource type="PackedScene" uid="uid://ck1im1d6yhv84" path="res://obstacles/house.tscn" id="8_ntqnl"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_hkcet"]
|
||||
|
@ -142,8 +143,10 @@ mesh = SubResource("PlaneMesh_opk07")
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0)
|
||||
shape = SubResource("BoxShape3D_2bm1d")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
[node name="Camera3D" type="Camera3D" parent="." node_paths=PackedStringArray("target")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.582109, 0.813111, 0, -0.813111, 0.582109, 0, 14.3066, 11.1673)
|
||||
script = ExtResource("8_auifr")
|
||||
target = NodePath("../Player")
|
||||
|
||||
[node name="House" parent="." instance=ExtResource("8_ntqnl")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14, 0, -11)
|
||||
|
|
Loading…
Reference in a new issue