[gd_scene load_steps=37 format=2] [ext_resource path="res://3d_platforma/golden_bay_512.hdr" type="Texture" id=2] [ext_resource path="res://Obstacles/SwingingAxe.tscn" type="PackedScene" id=3] [ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4] [ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=5] [sub_resource type="CubeMesh" id=1] [sub_resource type="MultiMesh" id=2] mesh = SubResource( 1 ) [sub_resource type="GDScript" id=3] resource_name = "Player" script/source = "extends KinematicBody export var move_speed := 12.0 export var jump_force := 30.0 export var gravity := 0.98 export var max_fall_speed := 30 export var look_sens_h := 0.2 var is_on_floor_prev := false onready var anim = $Mesh/AnimationPlayer var y_velo = 0 func _ready(): anim.get_animation(\"walk\").set_loop(true) func _input(event): if event is InputEventMouseMotion: rotation_degrees.y -= event.relative.x * look_sens_h if event.is_action_pressed(\"ui_end\"): global_translation = Vector3.ZERO func _physics_process(_delta): var move_vec = Vector3() if Input.is_action_pressed(\"move_forward\"): move_vec.z -= 1 if Input.is_action_pressed(\"move_backwards\"): move_vec.z += 1 if Input.is_action_pressed(\"move_right\"): move_vec.x += 1 if Input.is_action_pressed(\"move_left\"): move_vec.x -= 1 move_vec = move_vec.normalized() move_vec = move_vec.rotated(Vector3(0, 1, 0), rotation.y) move_vec *= move_speed move_vec.y = y_velo var _vel:Vector3 = move_and_slide(move_vec, Vector3(0, 1, 0)) # questionable??? if is_on_floor_prev and not is_on_floor(): $CoyoteJump.start() is_on_floor_prev = is_on_floor() var grounded :bool= is_on_floor() or not $CoyoteJump.is_stopped() y_velo -= gravity var just_jumped := false if Input.is_action_just_pressed(\"jump\") and grounded: just_jumped = true y_velo = jump_force if grounded and y_velo <= 0: y_velo = -0.1 if y_velo < -max_fall_speed: y_velo = -max_fall_speed if just_jumped: play_anim(\"jump\") elif grounded: if move_vec.x == 0 and move_vec.z == 0: play_anim(\"idle\") else: play_anim(\"walk\") func play_anim(name): if anim.current_animation == name: return anim.play(name) " [sub_resource type="CapsuleShape" id=4] radius = 0.202191 height = 1.09113 [sub_resource type="CylinderShape" id=32] height = 0.224826 radius = 0.194837 [sub_resource type="GDScript" id=11] resource_name = "Camera" script/source = "extends Spatial export var look_sens_v := 0.5 #this will not work export(float) onready var not_working := 0.1 func _ready() -> void: pass func _input(event): if event is InputEventMouseMotion: rotation_degrees.x -= event.relative.y * look_sens_v rotation_degrees.x = clamp(rotation_degrees.x, -90, 90) if event is InputEventMouseButton: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) if event.is_action_pressed(\"ui_focus_next\"): Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) " [sub_resource type="CylinderMesh" id=31] radial_segments = 8 rings = 0 [sub_resource type="SpatialMaterial" id=33] albedo_color = Color( 0.08, 0.08, 0.08, 1 ) roughness = 0.73 [sub_resource type="QuadMesh" id=34] size = Vector2( 0.3, 0.5 ) [sub_resource type="SpatialMaterial" id=35] emission_enabled = true emission = Color( 0.95, 0.95, 0.95, 1 ) emission_energy = 10.0 emission_operator = 0 emission_on_uv2 = false [sub_resource type="SpatialMaterial" id=19] params_cull_mode = 2 albedo_color = Color( 0.752941, 0, 0, 1 ) [sub_resource type="Animation" id=6] length = 0.001 tracks/0/type = "value" tracks/0/path = NodePath("Body:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0 ), "transitions": PoolRealArray( 1 ), "update": 0, "values": [ Vector3( 1, 1, 1 ) ] } tracks/1/type = "value" tracks/1/path = NodePath("Body:translation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { "times": PoolRealArray( 0 ), "transitions": PoolRealArray( 1 ), "update": 0, "values": [ Vector3( 0, 0.744519, 0 ) ] } [sub_resource type="Animation" id=7] resource_name = "idle" length = 2.0 loop = true tracks/0/type = "value" tracks/0/path = NodePath("Body:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 1, 2 ), "transitions": PoolRealArray( 1, 1, 1 ), "update": 0, "values": [ Vector3( 1, 1, 1 ), Vector3( 1.1, 1.1, 1 ), Vector3( 1, 1, 1 ) ] } [sub_resource type="Animation" id=8] resource_name = "jump" length = 0.6 loop = true tracks/0/type = "value" tracks/0/path = NodePath("Body:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 0.3, 0.6 ), "transitions": PoolRealArray( 1, 1, 1 ), "update": 0, "values": [ Vector3( 1.07, 1.07, 1 ), Vector3( 1.07, 1.07, 1.07262 ), Vector3( 1.07, 1.07, 1 ) ] } [sub_resource type="Animation" id=9] resource_name = "walk" length = 0.4 loop = true tracks/0/type = "value" tracks/0/path = NodePath("Body:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4 ), "transitions": PoolRealArray( 1, 1, 1, 1, 1 ), "update": 0, "values": [ Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ), Vector3( 0, 0.763796, 0 ), Vector3( 0, 0.744519, 0 ) ] } tracks/1/type = "value" tracks/1/path = NodePath("Body:rotation_degrees:z") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { "times": PoolRealArray( 0, 0.1, 0.3, 0.4 ), "transitions": PoolRealArray( 1, 1, 1, 1 ), "update": 0, "values": [ 0.0, 10.0, -10.0, 0.0 ] } [sub_resource type="PlaneMesh" id=18] material = SubResource( 19 ) size = Vector2( 0.16, 1.6 ) subdivide_depth = 8 [sub_resource type="GDScript" id=17] resource_name = "Shadow" script/source = "extends Spatial export var offset := 0.25 func _process(_delta) -> void: var collide :bool= $RayCast.is_colliding() $Circle.visible = collide if collide: var py:float = $RayCast.get_collision_point().y $Circle.global_translation.y = py + offset " [sub_resource type="Gradient" id=13] offsets = PoolRealArray( 0.103704, 0.422222, 0.766667 ) colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 0.447059, 0, 0, 0, 0 ) [sub_resource type="GradientTexture2D" id=14] gradient = SubResource( 13 ) width = 32 height = 32 fill = 1 fill_from = Vector2( 0.5, 0.5 ) fill_to = Vector2( 1, 0.5 ) [sub_resource type="SpatialMaterial" id=15] flags_transparent = true flags_unshaded = true albedo_texture = SubResource( 14 ) [sub_resource type="QuadMesh" id=16] material = SubResource( 15 ) size = Vector2( 0.75, 0.75 ) [sub_resource type="SpatialMaterial" id=36] resource_name = "CheckerGrid" albedo_color = Color( 0.85, 0.85, 0.85, 1 ) albedo_texture = ExtResource( 5 ) roughness = 0.85 uv1_triplanar = true [sub_resource type="Animation" id=37] resource_name = "move" length = 10.0 loop = true tracks/0/type = "value" tracks/0/path = NodePath(".:translation:z") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 4.4, 9.9 ), "transitions": PoolRealArray( 1, 1.8025, 1 ), "update": 0, "values": [ 0.0, -10.0, 0.0 ] } [sub_resource type="Animation" id=38] length = 0.001 tracks/0/type = "value" tracks/0/path = NodePath(".:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0 ), "transitions": PoolRealArray( 1 ), "update": 0, "values": [ Vector3( 4.86647, 0, 5.22355 ) ] } [sub_resource type="Animation" id=39] resource_name = "move" length = 10.0 loop = true tracks/0/type = "value" tracks/0/path = NodePath(".:translation") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 5.3 ), "transitions": PoolRealArray( 1, 1 ), "update": 0, "values": [ Vector3( 4.86647, 0, 5.22355 ), Vector3( 12.1605, 0, 5.22355 ) ] } [sub_resource type="BoxShape" id=20] [sub_resource type="CubeMesh" id=21] [sub_resource type="OpenSimplexNoise" id=28] octaves = 2 period = 0.8 [sub_resource type="NoiseTexture" id=29] flags = 3 width = 32 height = 32 noise = SubResource( 28 ) [sub_resource type="SpatialMaterial" id=22] albedo_color = Color( 0.603922, 0.0235294, 0.619608, 1 ) roughness = 0.25 roughness_texture = SubResource( 29 ) normal_enabled = true normal_scale = 1.0 normal_texture = ExtResource( 4 ) uv1_scale = Vector3( 3, 3, 3 ) uv1_triplanar = true [sub_resource type="PanoramaSky" id=23] panorama = ExtResource( 2 ) [sub_resource type="Environment" id=24] resource_name = "black_env" background_mode = 2 background_sky = SubResource( 23 ) background_sky_custom_fov = 50.0 background_color = Color( 0.137255, 0.137255, 0.137255, 1 ) background_energy = 2.0 ambient_light_color = Color( 0.501961, 0.501961, 0.501961, 1 ) ambient_light_energy = 0.45 ambient_light_sky_contribution = 0.6 fog_color = Color( 0.2304, 0.273707, 0.32, 1 ) fog_sun_amount = 0.25 fog_depth_begin = 5.0 fog_depth_end = 20.0 fog_transmit_enabled = true fog_height_enabled = true dof_blur_far_distance = 20.0 dof_blur_far_quality = 2 glow_intensity = 2.0 glow_bloom = 0.05 glow_blend_mode = 1 glow_hdr_scale = 4.0 [node name="Game" type="Spatial"] [node name="MultiMeshInstance" type="MultiMeshInstance" parent="."] multimesh = SubResource( 2 ) [node name="Player" type="KinematicBody" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2 ) collision_layer = 2 script = SubResource( 3 ) move_speed = 3.2 jump_force = 20.0 gravity = 1.2 [node name="CollisionShape" type="CollisionShape" parent="Player"] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.724957, 0 ) shape = SubResource( 4 ) [node name="CollisionShape2" type="CollisionShape" parent="Player"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.884122, 0 ) shape = SubResource( 32 ) [node name="CamRoot" type="Spatial" parent="Player"] script = SubResource( 11 ) [node name="Camera" type="ClippedCamera" parent="Player/CamRoot"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 4 ) current = true margin = 0.1 process_mode = 1 [node name="Mesh" type="Spatial" parent="Player"] [node name="Body" type="Spatial" parent="Player/Mesh"] transform = Transform( 0.976315, -0.216353, 9.45709e-09, 0, -4.37114e-08, -1, 0.216353, 0.976315, -4.26761e-08, 0, 0.744519, 0 ) [node name="Body" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.195555, 0, 0, 0, -1.04907e-08, 0.135018, 0, -0.24, -5.90182e-09, 0, 0, 0 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="Body2" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, -0.122125, 0.049392, 0.057337 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="Body3" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.0876868, 0, 0, 0, -1.1745e-08, -0.0631662, 0, 0.268694, -2.76108e-09, 0.123573, 0.0493927, 0.0573372 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="head" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.088, 0, 0, 0, -4.19629e-09, 0.08, 0, -0.096, -3.49691e-09, 0, 0, -0.339126 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="eye_left" type="MeshInstance" parent="Player/Mesh/Body/head"] transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0.568194, 0.255432, -1.05656 ) mesh = SubResource( 34 ) material/0 = SubResource( 35 ) [node name="eye_right" type="MeshInstance" parent="Player/Mesh/Body/head"] transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, -0.365176, 0.255432, -1.05656 ) mesh = SubResource( 34 ) material/0 = SubResource( 35 ) [node name="OmniLight" type="SpotLight" parent="Player/Mesh/Body/head"] transform = Transform( 11.3636, 0, 0, 0, 10.4167, -2.21659e-13, 0, 2.1684e-19, 12.5, 0, 0.257117, -0.572075 ) light_energy = 0.75 spot_range = 4.51976 spot_attenuation = 1.31951 spot_angle = 66.4019 [node name="hat_top" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.1056, 0, 0, 0, -5.03555e-09, 0.096, 0, -0.1152, -4.19629e-09, 0, 0, -0.578262 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="hat_bottom" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.2024, 0, 0, 0, -1.25889e-09, 0.184, 0, -0.0288, -8.0429e-09, 0, 0, -0.464094 ) mesh = SubResource( 31 ) material/0 = SubResource( 33 ) [node name="scarf" type="MeshInstance" parent="Player/Mesh/Body"] transform = Transform( 0.17204, 0, 0, 0, -1.39107e-09, 0.1564, 0, -0.031824, -6.83646e-09, 0, 0, -0.271663 ) mesh = SubResource( 31 ) material/0 = SubResource( 19 ) [node name="LegR" type="CSGCylinder" parent="Player/Mesh/Body"] transform = Transform( 0.99863, -0.0659433, 1.81562e-09, 0, -5.50763e-08, -0.793651, 0.052336, 1.25827, -3.4644e-08, 0.0637822, 0, 0.548993 ) radius = 0.1 height = 0.5 cone = true material = SubResource( 33 ) [node name="LegL" type="CSGCylinder" parent="Player/Mesh/Body"] transform = Transform( 0.99863, 0.0659433, -1.81562e-09, 0, -5.50763e-08, -0.793651, -0.052336, 1.25827, -3.4644e-08, -0.0650757, 0, 0.548993 ) radius = 0.1 height = 0.5 cone = true material = SubResource( 33 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="Player/Mesh"] anims/RESET = SubResource( 6 ) anims/idle = SubResource( 7 ) anims/jump = SubResource( 8 ) anims/walk = SubResource( 9 ) [node name="SoftBody" type="SoftBody" parent="Player"] transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.04064, 0.928791 ) mesh = SubResource( 18 ) collision_layer = 2 collision_mask = 3 damping_coefficient = 0.1 drag_coefficient = 0.1 ray_pickable = false pinned_points = [ 0, 1 ] attachments/0/point_index = 0 attachments/0/spatial_attachment_path = NodePath("..") attachments/0/offset = Vector3( -0.0800001, 1.04064, 0.128791 ) attachments/1/point_index = 1 attachments/1/spatial_attachment_path = NodePath("..") attachments/1/offset = Vector3( 0.0799999, 1.04064, 0.128791 ) [node name="Shadow" type="Spatial" parent="Player"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0 ) script = SubResource( 17 ) offset = 0.02 [node name="Circle" type="MeshInstance" parent="Player/Shadow"] transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 ) mesh = SubResource( 16 ) skeleton = NodePath("../..") [node name="RayCast" type="RayCast" parent="Player/Shadow"] enabled = true cast_to = Vector3( 0, -50, 0 ) [node name="CoyoteJump" type="Timer" parent="Player"] wait_time = 0.16 one_shot = true [node name="Platforms" type="Spatial" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0 ) [node name="start" type="CSGBox" parent="Platforms"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) use_collision = true width = 1.65541 height = 0.2 depth = 10.0 material = SubResource( 36 ) [node name="thin" type="CSGBox" parent="Platforms"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -12 ) use_collision = true width = 4.0 height = 0.2 depth = 10.0 material = SubResource( 36 ) [node name="ramp" type="CSGBox" parent="Platforms"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -22 ) use_collision = true width = 4.0 height = 1.0 depth = 10.0 material = SubResource( 36 ) [node name="lift" type="Spatial" parent="Platforms"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, -30 ) [node name="platform" type="CSGBox" parent="Platforms/lift"] use_collision = true width = 4.0 height = 1.0 depth = 4.0 material = SubResource( 36 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="Platforms/lift/platform"] autoplay = "move" anims/move = SubResource( 37 ) [node name="platform2" type="CSGBox" parent="Platforms/lift"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.86647, 0, 5.22355 ) use_collision = true width = 4.0 height = 1.0 depth = 4.0 material = SubResource( 36 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="Platforms/lift/platform2"] autoplay = "move" anims/RESET = SubResource( 38 ) anims/move = SubResource( 39 ) [node name="lego" type="StaticBody" parent="Platforms"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, -1.9, -8 ) __meta__ = { "_edit_group_": true } [node name="CollisionShape" type="CollisionShape" parent="Platforms/lego"] shape = SubResource( 20 ) [node name="MeshInstance" type="MeshInstance" parent="Platforms/lego"] mesh = SubResource( 21 ) material/0 = SubResource( 22 ) [node name="CSGPolygon" type="CSGPolygon" parent="Platforms"] transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, -12 ) use_collision = true polygon = PoolVector2Array( 3, -4, 3, 1, 4, 1, 4, -4 ) mode = 1 spin_degrees = 360.0 spin_sides = 16 material = SubResource( 36 ) [node name="DirectionalLight" type="DirectionalLight" parent="."] transform = Transform( 0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 5, 0 ) light_energy = 0.65 [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource( 24 ) [node name="MusicChangedSlowAction" type="Node" parent="."] [node name="Obstacles" type="Spatial" parent="."] [node name="SwingingAxe" parent="Obstacles" instance=ExtResource( 3 )] transform = Transform( 0.50747, -0.861669, 0, 0.861669, 0.50747, 0, 0, 0, 1, 0, 6.26892, -2.22879 ) [node name="SwingingAxe2" parent="Obstacles" instance=ExtResource( 3 )] transform = Transform( 0.50747, -0.861669, 0, 0.861669, 0.50747, 0, 0, 0, 1, 0, 6.26892, -0.83494 )