This commit is contained in:
Spencer Killen 2023-08-20 16:25:45 -06:00
commit 5894fd7826
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
11 changed files with 55 additions and 24 deletions

View File

@ -22,10 +22,10 @@
[ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="24_ddfvk"]
[ext_resource type="PackedScene" uid="uid://b3aus2kigf8xt" path="res://Models/beach_decor/cooler.tscn" id="24_sl7ne"]
[ext_resource type="PackedScene" uid="uid://cft26nug7kyqb" path="res://ambient_light_1.tscn" id="25_novxt"]
[ext_resource type="PackedScene" uid="uid://ukful430mmkn" path="res://color_cube.tscn" id="25_rm0cr"]
[ext_resource type="PackedScene" uid="uid://d2pvg0f5jtpve" path="res://slime_kill_box.tscn" id="27_cjxk6"]
[ext_resource type="PackedScene" path="res://color_cube.tscn" id="25_rm0cr"]
[ext_resource type="PackedScene" path="res://slime_kill_box.tscn" id="27_cjxk6"]
[ext_resource type="PackedScene" uid="uid://bw3k2c75qavce" path="res://Models/beach_decor/bucket.tscn" id="27_f3p1i"]
[ext_resource type="PackedScene" uid="uid://6ycop5t3nra5" path="res://Level/World/DayNightEnvironment.tscn" id="27_jutn4"]
[ext_resource type="PackedScene" path="res://Level/World/DayNightEnvironment.tscn" id="27_jutn4"]
[ext_resource type="PackedScene" uid="uid://g4gmc0pwlak1" path="res://Models/buildings/fence.tscn" id="28_prydb"]
[ext_resource type="PackedScene" uid="uid://ckbba1bs71tl" path="res://crate.tscn" id="28_x0lrj"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=42 format=3 uid="uid://bgoo1lbt28na"]
[gd_scene load_steps=41 format=3 uid="uid://bgoo1lbt28na"]
[ext_resource type="PackedScene" uid="uid://bhanbx2dyhv2d" path="res://Models/grape_man.glb" id="1_fh5yr"]
[ext_resource type="Script" path="res://Models/grape_man.gd" id="2_ksje8"]
@ -6,7 +6,6 @@
[ext_resource type="AudioStream" uid="uid://baocyd0p3jcku" path="res://Sounds/pickup_grunt.ogg" id="4_nvurj"]
[ext_resource type="AudioStream" uid="uid://b80t5xqckjoqk" path="res://Sounds/heartychuckle.ogg" id="5_b32re"]
[ext_resource type="AudioStream" uid="uid://0mhkf1ls1wcn" path="res://Sounds/sadsound.ogg" id="6_qe4bi"]
[ext_resource type="AudioStream" uid="uid://bmocmgq06o6f5" path="res://Sounds/footstep.ogg" id="7_b2ik0"]
[sub_resource type="AnimationNodeAdd2" id="AnimationNodeAdd2_a0vxm"]
filters = ["rig/Skeleton3D:forearm.L", "rig/Skeleton3D:forearm.R", "rig/Skeleton3D:head", "rig/Skeleton3D:upper_arm.L", "rig/Skeleton3D:upper_arm.R"]
@ -155,7 +154,7 @@ transform = Transform3D(0.065, 0, 0, 0, 0.065, 0, 0, 0, 0.065, 0, 0, 0)
script = ExtResource("2_ksje8")
[node name="Skeleton3D" parent="rig" index="0"]
bones/0/rotation = Quaternion(0.0733902, 0, 0, 0.997303)
bones/0/rotation = Quaternion(0.0664168, 0, 0, 0.997792)
bones/1/rotation = Quaternion(-0.0891896, 1.18734e-07, -1.06322e-08, 0.996015)
bones/2/rotation = Quaternion(0.0133933, -1.19199e-07, 1.5966e-09, 0.99991)
bones/3/rotation = Quaternion(-0.00997737, 0.100365, -0.694951, 0.711948)
@ -170,7 +169,6 @@ bones/15/rotation = Quaternion(0.105246, -0.0039338, 0.0113526, 0.994374)
[node name="OmniLight3D" type="OmniLight3D" parent="." index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.289473, 8.26292, 4.26359)
light_energy = 0.5
[node name="AnimationTree" type="AnimationTree" parent="." index="3"]
tree_root = SubResource("AnimationNodeStateMachine_6mfdu")
@ -193,9 +191,5 @@ stream = ExtResource("5_b32re")
[node name="sad" type="AudioStreamPlayer" parent="." index="7"]
stream = ExtResource("6_qe4bi")
[node name="soundboard" type="AudioStreamPlayer" parent="." index="8"]
[node name="woohoo" type="AudioStreamPlayer" parent="." index="8"]
stream = ExtResource("6_qe4bi")
[node name="footstep" type="AudioStreamPlayer" parent="." index="9"]
stream = ExtResource("7_b2ik0")
volume_db = -10.0

View File

@ -1,11 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://difi2tur2j4dg"]
[gd_scene load_steps=5 format=3 uid="uid://difi2tur2j4dg"]
[ext_resource type="PackedScene" uid="uid://dfyt6kjw8yli" path="res://Models/island.glb" id="1_5vc8b"]
[ext_resource type="Script" path="res://Models/island.gd" id="2_1q8nk"]
[ext_resource type="Material" uid="uid://yuhlhpwji3c4" path="res://Textures/sand.tres" id="2_nhexh"]
[ext_resource type="Material" uid="uid://b88xmds4mx7rd" path="res://Textures/grass.tres" id="4_uusb2"]
[node name="island" instance=ExtResource("1_5vc8b")]
script = ExtResource("2_1q8nk")
[node name="Island" parent="." index="0"]
material_override = ExtResource("2_nhexh")
[node name="Island_001" parent="." index="2"]
surface_material_override/0 = ExtResource("4_uusb2")

View File

@ -23,9 +23,6 @@ func _ready():
func _process(_delta):
# Brings your mouse out of the window if you press escape. Add pause screen function here?
if Input.is_action_just_pressed("Pause"):
$PauseMenu.pause()
var obj = holding.get_ref()
if obj:

View File

@ -6,7 +6,7 @@
[resource]
diffuse_mode = 3
specular_mode = 1
albedo_color = Color(0.423529, 0.619608, 0.145098, 1)
albedo_color = Color(0.294118, 0.435294, 0.0980392, 1)
albedo_texture = ExtResource("1_40rrr")
normal_texture = ExtResource("1_r1qrb")
uv1_scale = Vector3(75, 75, 75)

View File

@ -6,7 +6,7 @@
[resource]
diffuse_mode = 3
specular_mode = 1
albedo_color = Color(0.439216, 0.552941, 0, 1)
albedo_color = Color(0.192157, 0.376471, 0.156863, 1)
albedo_texture = ExtResource("1_5s240")
normal_texture = ExtResource("2_blarx")
uv1_scale = Vector3(2, 2, 2)

View File

@ -5,6 +5,17 @@ var is_paused = false
@onready var resume_button = $CenterContainer/HBoxContainer/ResumeButton
@onready var quit_button = $CenterContainer/HBoxContainer/QuitButton
func _input(event):
if Input.is_action_just_pressed("Pause"):
toggle()
func toggle():
if self.visible:
unpause()
else:
pause()
func unpause():
self.hide()
get_tree().paused = false
@ -12,6 +23,7 @@ func unpause():
func pause():
self.show()
resume_button.grab_focus()
get_tree().paused = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

View File

@ -48,6 +48,9 @@ alignment = 1
[node name="ResumeButton" type="Button" parent="CenterContainer/HBoxContainer"]
process_mode = 3
layout_mode = 2
focus_neighbor_left = NodePath("../QuitButton")
focus_neighbor_right = NodePath("../QuitButton")
focus_next = NodePath(".")
text = " "
icon = ExtResource("1_c4do0")
flat = true
@ -56,6 +59,9 @@ icon_alignment = 1
[node name="QuitButton" type="Button" parent="CenterContainer/HBoxContainer"]
process_mode = 3
layout_mode = 2
focus_neighbor_left = NodePath("../ResumeButton")
focus_neighbor_right = NodePath("../ResumeButton")
focus_next = NodePath("../ResumeButton")
theme_override_constants/outline_size = 1
theme_override_constants/h_separation = 0
theme_override_constants/icon_max_width = 0

View File

@ -1,9 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://7utef1nnena8"]
[gd_scene load_steps=6 format=3 uid="uid://7utef1nnena8"]
[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"]
[ext_resource type="PackedScene" uid="uid://bgoo1lbt28na" path="res://Models/grape_man.tscn" id="2_ctyy5"]
[ext_resource type="Script" path="res://Holster.gd" id="3_a68da"]
[ext_resource type="PackedScene" uid="uid://cbca7q18ae42h" path="res://UI/PauseMenu.tscn" id="4_kcqpl"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"]
radius = 0.0669067
@ -25,7 +24,7 @@ shape = SubResource("CapsuleShape3D_kb4ms")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.389874, 0)
[node name="PlayerCam" type="Camera3D" parent="CameraMount"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.930216)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.643936)
current = true
fov = 50.0
@ -38,9 +37,6 @@ script = ExtResource("3_a68da")
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0.0672282, 0)
shape = SubResource("SphereShape3D_6l1w6")
[node name="PauseMenu" parent="." instance=ExtResource("4_kcqpl")]
visible = false
[connection signal="anim_check_grab" from="grape_man" to="." method="_on_grape_man_anim_check_grab"]
[connection signal="body_entered" from="Holster/Area3D" to="." method="_on_holster_enter"]
[connection signal="body_exited" from="Holster/Area3D" to="." method="_on_holster_exit"]

View File

@ -22,11 +22,18 @@ var task = "idle"
# Margin of accuracy to which the character will correct their direction when off course (radians).
@export var dir_accuracy = deg_to_rad(0.1)
var wall_timer
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
$slime.idle()
wall_timer = Timer.new()
wall_timer.wait_time = 5
wall_timer.one_shot = true
wall_timer.timeout.connect(_on_timer_timeout)
add_child(wall_timer)
func walk():
$slime.walk()
@ -43,6 +50,9 @@ func walk():
target_location_xz = location_xz
task = "idle"
if !wall_timer.is_stopped():
wall_timer.stop()
func spin():
# Continue to correct direction to within a margin of dir_accuracy degrees.
if direction_xz.angle_to(target_direction_xz) >= dir_accuracy:
@ -59,6 +69,7 @@ func idle():
if task <= walk_chance:
task = "walk"
target_location_xz = transform.origin * Vector3(1, 0, 1) + (direction_xz * 4)
wall_timer.start()
# 6% chance to rotate.
elif task > walk_chance and task <= (walk_chance + spin_chance):
task = "spin"
@ -69,6 +80,15 @@ func idle():
elif task > (spin_chance + walk_chance):
task = "idle"
# Stops walking if cannot reach destination in 5 sec.
func _on_timer_timeout():
# Try to turn around before walking again.
if task == "walk":
task = "spin"
var rotation_angle = rng.randf_range(-2*PI, 2*PI)
var rotation_vector = Vector3(cos(rotation_angle), 0, sin(rotation_angle))
target_direction_xz = direction_xz + rotation_vector
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
location_xz = transform.origin * Vector3(1, 0, 1)

View File

@ -15,3 +15,5 @@ transform = Transform3D(0.035, 0, 0, 0, 0.035, 0, 0, 0, 0.035, 0, 0, 0)
[node name="slime_collision" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0408143, 0)
shape = SubResource("SphereShape3D_k5rhc")
[node name="IsTrappedOnWall" type="Timer" parent="."]