improve code to move player

This commit is contained in:
AleaJactaEst 2022-03-25 19:20:34 +01:00
parent a1940e3d45
commit e29fa2f4dd
11 changed files with 901 additions and 864 deletions

View file

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" path="res://maps/objects/cave.tscn" id="4_pc85h"] [ext_resource type="PackedScene" path="res://maps/objects/cave.tscn" id="4_pc85h"]
[ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/objects/ramp.tscn" id="5_dfm8h"] [ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/objects/ramp.tscn" id="5_dfm8h"]
[ext_resource type="PackedScene" uid="uid://bl1widitqdugs" path="res://maps/objects/obstacles.tscn" id="5_mi3we"] [ext_resource type="PackedScene" uid="uid://bl1widitqdugs" path="res://maps/objects/obstacles.tscn" id="5_mi3we"]
[ext_resource type="PackedScene" path="res://maps/water-zone.tscn" id="6_0o80c"] [ext_resource type="PackedScene" uid="uid://clmlpy36ghsio" path="res://maps/water-zone.tscn" id="6_0o80c"]
[ext_resource type="PackedScene" uid="uid://c7sga2ipka52x" path="res://maps/waypoint/waypoint.tscn" id="7_5rpqq"] [ext_resource type="PackedScene" uid="uid://c7sga2ipka52x" path="res://maps/waypoint/waypoint.tscn" id="7_5rpqq"]
[ext_resource type="PackedScene" uid="uid://dxghflr1tlhai" path="res://maps/objects/panel_dummy.tscn" id="11_gb0sk"] [ext_resource type="PackedScene" uid="uid://dxghflr1tlhai" path="res://maps/objects/panel_dummy.tscn" id="11_gb0sk"]
[ext_resource type="PackedScene" uid="uid://damn2u4n5ien" path="res://maps/objects/panel.tscn" id="11_vd4qp"] [ext_resource type="PackedScene" uid="uid://damn2u4n5ien" path="res://maps/objects/panel.tscn" id="11_vd4qp"]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=14 format=3] [gd_scene load_steps=18 format=3 uid="uid://clmlpy36ghsio"]
[ext_resource type="Shader" path="res://maps/shaders/water.gdshader" id="1_j5guc"] [ext_resource type="Shader" path="res://maps/shaders/water.gdshader" id="1_j5guc"]
[ext_resource type="Script" path="res://maps/water-zone.gd" id="1_s4mf8"] [ext_resource type="Script" path="res://maps/water-zone.gd" id="1_s4mf8"]
[ext_resource type="PackedScene" uid="uid://duptl2212yaxs" path="res://maps/objects/delta_boat.tscn" id="2_824w2"] [ext_resource type="PackedScene" uid="uid://duptl2212yaxs" path="res://maps/objects/delta_boat.tscn" id="2_824w2"]
[ext_resource type="PackedScene" path="res://maps/objects/water_space.tscn" id="2_nnfoe"] [ext_resource type="PackedScene" uid="uid://ip4lkyho0gry" path="res://maps/objects/water_space.tscn" id="2_nnfoe"]
[ext_resource type="Texture2D" uid="uid://dppjl2jpko3lx" path="res://maps/textures/water_normal_a.png" id="3_vwt8h"] [ext_resource type="Texture2D" uid="uid://dppjl2jpko3lx" path="res://maps/textures/water_normal_a.png" id="3_vwt8h"]
[ext_resource type="Texture2D" uid="uid://b8tu2ncerig3r" path="res://maps/textures/water_normal_b.png" id="4_gohr5"] [ext_resource type="Texture2D" uid="uid://b8tu2ncerig3r" path="res://maps/textures/water_normal_b.png" id="4_gohr5"]
[ext_resource type="Texture2D" uid="uid://dv1ywlb7inqyu" path="res://maps/textures/water_uv_sampler.png" id="5_uyeqp"] [ext_resource type="Texture2D" uid="uid://dv1ywlb7inqyu" path="res://maps/textures/water_uv_sampler.png" id="5_uyeqp"]
@ -42,6 +42,15 @@ material = SubResource( "ShaderMaterial_tfcq0" )
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_7h41h"] [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_7h41h"]
points = PackedVector3Array(1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1) points = PackedVector3Array(1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1)
[sub_resource type="BoxMesh" id="BoxMesh_wdr26"]
[sub_resource type="ORMMaterial3D" id="ORMMaterial3D_o3dm5"]
cull_mode = 1
no_depth_test = true
albedo_color = Color(0.14902, 0.372549, 1, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_gp2c0"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bmkr3"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_bmkr3"]
render_priority = 0 render_priority = 0
shader = ExtResource( "1_j5guc" ) shader = ExtResource( "1_j5guc" )
@ -75,7 +84,6 @@ script = ExtResource( "1_s4mf8" )
transform = Transform3D(-0.870957, 0, -0.49136, 0, 1, 0, 0.49136, 0, -0.870957, 7.46743, -1.07318, 12.6543) transform = Transform3D(-0.870957, 0, -0.49136, 0, 1, 0, 0.49136, 0, -0.870957, 7.46743, -1.07318, 12.6543)
[node name="Area3D" type="Area3D" parent="delta_boat"] [node name="Area3D" type="Area3D" parent="delta_boat"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="delta_boat/Area3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="delta_boat/Area3D"]
shape = SubResource( "SphereShape3D_08c7l" ) shape = SubResource( "SphereShape3D_08c7l" )
@ -91,6 +99,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.49012e-08, -5.96046e-08, 2
transform = Transform3D(20, 0, 0, 0, 3, 0, 0, 0, 20, 0, -4.10377, 0) transform = Transform3D(20, 0, 0, 0, 3, 0, 0, 0, 20, 0, -4.10377, 0)
shape = SubResource( "ConvexPolygonShape3D_7h41h" ) shape = SubResource( "ConvexPolygonShape3D_7h41h" )
[node name="MeshInstance3D" type="MeshInstance3D" parent="underwater"]
transform = Transform3D(40, 0, 0, 0, 6, 0, 0, 0, 40, 0, -4.3, 0)
visible = false
transparency = 0.58
cast_shadow = 2
mesh = SubResource( "BoxMesh_wdr26" )
[node name="MeshInstance3D2" type="MeshInstance3D" parent="underwater"]
transform = Transform3D(20, 0, 0, 0, 1, 0, 0, 0, 20, 0, -1.11376, 0)
material_override = SubResource( "ORMMaterial3D_o3dm5" )
transparency = 0.59
mesh = SubResource( "PlaneMesh_gp2c0" )
[node name="water-space" parent="." instance=ExtResource( "2_nnfoe" )] [node name="water-space" parent="." instance=ExtResource( "2_nnfoe" )]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]

View file

@ -83,5 +83,8 @@ bones/159/rotation = Quaternion(-0.533238, 0.00141206, -0.0644206, 0.843508)
bones/162/rotation = Quaternion(-0.716109, 9.68884e-05, -0.0860518, 0.692664) bones/162/rotation = Quaternion(-0.716109, 9.68884e-05, -0.0860518, 0.692664)
bones/164/rotation = Quaternion(-0.38892, -0.00569121, -0.0466897, 0.92007) bones/164/rotation = Quaternion(-0.38892, -0.00569121, -0.0466897, 0.92007)
[node name="raferens" parent="char_grp/rig/Skeleton3D" index="0"]
layers = 2
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
autoplay = "CHAR_idle_bored" autoplay = "CHAR_idle_bored"

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://dwxrvijqyym70"] [gd_scene load_steps=7 format=3 uid="uid://dwxrvijqyym70"]
[ext_resource type="Script" path="res://player/player.gd" id="1_myhjw"] [ext_resource type="Script" path="res://player/player.gd" id="1_myhjw"]
[ext_resource type="PackedScene" uid="uid://cjklxedjnvc1c" path="res://player/character/character.tscn" id="1_rqqo8"] [ext_resource type="PackedScene" uid="uid://cjklxedjnvc1c" path="res://player/character/character.tscn" id="1_rqqo8"]
[ext_resource type="Script" path="res://player/camera.gd" id="2_xvdvx"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_a1omj"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_a1omj"]
radius = 0.446849 radius = 0.446849
@ -12,16 +11,14 @@ height = 1.52436
radius = 0.781675 radius = 0.781675
height = 1.69837 height = 1.69837
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_w6qjk"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_lc75a"]
radius = 0.220923 radius = 0.4
height = 2.83965 height = 2.75615
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_645as"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_645as"]
radius = 0.608862 radius = 0.608862
height = 1.69456 height = 1.69456
[sub_resource type="PlaneMesh" id="PlaneMesh_p36im"]
[node name="player" type="CharacterBody3D"] [node name="player" type="CharacterBody3D"]
script = ExtResource( "1_myhjw" ) script = ExtResource( "1_myhjw" )
@ -31,6 +28,7 @@ script = ExtResource( "1_myhjw" )
[node name="CollisionFly" type="CollisionShape3D" parent="."] [node name="CollisionFly" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0.994976, -0.258262) transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0.994976, -0.258262)
visible = false
shape = SubResource( "CapsuleShape3D_a1omj" ) shape = SubResource( "CapsuleShape3D_a1omj" )
disabled = true disabled = true
@ -42,16 +40,15 @@ disabled = true
[node name="CollisionWalk" type="CollisionShape3D" parent="."] [node name="CollisionWalk" type="CollisionShape3D" parent="."]
transform = Transform3D(0.999787, 0, 0, 0, 0.589349, 0, 0, 0, 0.371542, 0, 0.836561, 0) transform = Transform3D(0.999787, 0, 0, 0, 0.589349, 0, 0, 0, 0.371542, 0, 0.836561, 0)
shape = SubResource( "CapsuleShape3D_w6qjk" ) shape = SubResource( "CylinderShape3D_lc75a" )
[node name="CollisionSwim" type="CollisionShape3D" parent="."] [node name="CollisionSwim" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0)
visible = false
shape = SubResource( "CapsuleShape3D_645as" ) shape = SubResource( "CapsuleShape3D_645as" )
disabled = true disabled = true
[node name="camera_root" type="Node3D" parent="."] [node name="camera_root" type="Node3D" parent="."]
visible = false
script = ExtResource( "2_xvdvx" )
[node name="horizontal_root" type="Node3D" parent="camera_root"] [node name="horizontal_root" type="Node3D" parent="camera_root"]
@ -60,6 +57,25 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.55554, 0)
[node name="Camera3D_TPS" type="Camera3D" parent="camera_root/horizontal_root/vertical_root"] [node name="Camera3D_TPS" type="Camera3D" parent="camera_root/horizontal_root/vertical_root"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -2.14563) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -2.14563)
current = true
[node name="Down" type="RayCast3D" parent="camera_root/horizontal_root/vertical_root/Camera3D_TPS"]
target_position = Vector3(0, -0.2, 0)
[node name="Up" type="RayCast3D" parent="camera_root/horizontal_root/vertical_root/Camera3D_TPS"]
target_position = Vector3(0, 0.2, 0)
[node name="Left" type="RayCast3D" parent="camera_root/horizontal_root/vertical_root/Camera3D_TPS"]
target_position = Vector3(-0.2, 0, 0)
[node name="Back" type="RayCast3D" parent="camera_root/horizontal_root/vertical_root/Camera3D_TPS"]
target_position = Vector3(0, 0, 0.2)
[node name="Right" type="RayCast3D" parent="camera_root/horizontal_root/vertical_root/Camera3D_TPS"]
target_position = Vector3(0.2, 0, 0)
[node name="Camera3D_TPS_Debug" type="Camera3D" parent="camera_root/horizontal_root/vertical_root"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0, -3)
[node name="Camera3D_FPS_WALK" type="Camera3D" parent="camera_root"] [node name="Camera3D_FPS_WALK" type="Camera3D" parent="camera_root"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.56633, 0.222061) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.56633, 0.222061)
@ -76,11 +92,6 @@ visible = false
[node name="RayCastGround" type="RayCast3D" parent="."] [node name="RayCastGround" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -0.3, 0, 0, 0.01, 0) transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -0.3, 0, 0, 0.01, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="RayCastGround"]
transform = Transform3D(0.2, 0, 0, 0, 0, -10, 0, 1, 0, 0, 0, 0)
visible = false
mesh = SubResource( "PlaneMesh_p36im" )
[node name="RayCastStep" type="RayCast3D" parent="."] [node name="RayCastStep" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -0.4, 0, 0, 0.4, 0) transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -0.4, 0, 0, 0.4, 0)
@ -88,4 +99,10 @@ transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -0.4, 0, 0, 0.4, 0)
wait_time = 5.0 wait_time = 5.0
one_shot = true one_shot = true
[node name="Water_Walk_Max_Level" type="Position3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.35, 0)
[node name="Water_Swim_Max_Level" type="Position3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.600346, 0)
[connection signal="timeout" from="TimerJump" to="." method="_on_timer_jump_timeout"] [connection signal="timeout" from="TimerJump" to="." method="_on_timer_jump_timeout"]

View file

@ -21,6 +21,10 @@ Themes="*res://scripts/themes.gd"
Common="*res://scripts/common.gd" Common="*res://scripts/common.gd"
Screenshot="*res://scripts/screenshot.gd" Screenshot="*res://scripts/screenshot.gd"
[debug]
shapes/collision/shape_color=Color(0, 0.6, 0.701961, 0.419608)
[input] [input]
ui_left={ ui_left={

View file

@ -9,7 +9,7 @@
script = ExtResource( "1_ld2xt" ) script = ExtResource( "1_ld2xt" )
[node name="player" parent="." instance=ExtResource( "1_btdsd" )] [node name="player" parent="." instance=ExtResource( "1_btdsd" )]
transform = Transform3D(0.750872, 0, -0.660447, 0, 1, 0, 0.660447, 0, 0.750872, -3.68624, 0, -17.6199) transform = Transform3D(-0.513017, 0, -0.858378, 0, 1, 0, 0.858378, 0, -0.513017, -3.68624, 0.045102, -38.3111)
[node name="terrain_basic_setup" parent="." instance=ExtResource( "2_jj4oa" )] [node name="terrain_basic_setup" parent="." instance=ExtResource( "2_jj4oa" )]

View file

@ -3,21 +3,27 @@ extends Node
var debug:bool = true var debug:bool = true
func get_time_text() -> String:
var time = Time.get_datetime_dict_from_system()
return "%s/%02d/%02d %02d:%02d:%02d" % [
time['year'], time['month'], time['day'],
time['hour'], time['minute'], time['second'],
]
func msg_debug(text): func msg_debug(text):
if debug: if debug:
var frame = get_stack()[1] var frame = get_stack()[1]
print("DEBUG [%s:%d] %s" % [frame.source, frame.line, text] ) print("%s DEBUG [%s:%d] %s" % [get_time_text(), frame.source, frame.line, text] )
func msg_info(text): func msg_info(text):
var frame = get_stack()[1] var frame = get_stack()[1]
print("INFO [%s:%d] %s" % [frame.source, frame.line, text] ) print("%s INFO [%s:%d] %s" % [get_time_text(), frame.source, frame.line, text] )
func msg_error(text): func msg_error(text):
var frame = get_stack()[1] var frame = get_stack()[1]
print("ERROR [%s:%d] %s" % [frame.source, frame.line, text] ) print("%s ERROR [%s:%d] %s" % [get_time_text(), frame.source, frame.line, text] )
func get_string_input_mousse_button(event:InputEventMouseButton) -> String: func get_string_input_mousse_button(event:InputEventMouseButton) -> String: