This commit is contained in:
vengefulcartographer 2023-08-20 13:32:04 -06:00
commit 264a029cbd
17 changed files with 123 additions and 50 deletions

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,7 @@
[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" path="res://color_cube.tscn" id="25_rm0cr"]
[ext_resource type="PackedScene" uid="uid://ukful430mmkn" path="res://color_cube.tscn" id="25_rm0cr"]
[ext_resource type="PackedScene" uid="uid://bw3k2c75qavce" path="res://Models/beach_decor/bucket.tscn" id="27_f3p1i"]
[ext_resource type="PackedScene" uid="uid://g4gmc0pwlak1" path="res://Models/buildings/fence.tscn" id="28_prydb"]

BIN
godot/Models/grape_man.glb (Stored with Git LFS)

Binary file not shown.

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://g8vvg7c5ddkr"]
[ext_resource type="PackedScene" uid="uid://djmky2hkbqcni" path="res://Models/rocks/rock1.glb" id="1_81161"]
[ext_resource type="Material" uid="uid://c5u3wq66dejxt" path="res://Textures/rock.tres" id="2_iyn5h"]
[ext_resource type="Material" path="res://Textures/rock.tres" id="2_iyn5h"]
[node name="rock1" instance=ExtResource("1_81161")]

View File

@ -1,11 +1,13 @@
extends CharacterBody3D
const SPEED = 0.5
const SPEED = 0.4
const JUMP_VELOCITY = 4.5
@export var horiz_sens = 0.25
@export var vert_sens = 0.25
var LOWER_CAMERA_LIMIT = -60
var UPPER_CAMERA_LIMIT = -11
var target: WeakRef = weakref(null)
var holding: WeakRef = weakref(null)
@ -15,7 +17,7 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11))
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(LOWER_CAMERA_LIMIT), deg_to_rad(UPPER_CAMERA_LIMIT))
func _process(_delta):
@ -27,6 +29,14 @@ func _process(_delta):
if obj:
obj.global_transform.origin = $grape_man.get_pickup_bone_location()
var event = Input.get_vector("camera_left", "camera_right", "camera_up", "camera_down") * 4
rotate_y(deg_to_rad(-event.x * horiz_sens))
$CameraMount.rotate_x(deg_to_rad(-event.y * vert_sens))
var roty = deg_to_rad(event.x * horiz_sens)
$grape_man.rotate_y(roty)
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(LOWER_CAMERA_LIMIT), deg_to_rad(UPPER_CAMERA_LIMIT))
func _input(event):
# Handle the rotation of the camera using mouse movement.
@ -35,7 +45,9 @@ func _input(event):
$CameraMount.rotate_x(deg_to_rad(-event.relative.y * vert_sens))
var roty = deg_to_rad(event.relative.x * horiz_sens)
$grape_man.rotate_y(roty)
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11))
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(LOWER_CAMERA_LIMIT), deg_to_rad(UPPER_CAMERA_LIMIT))
if Input.is_action_just_pressed("ui_accept"):
var obj = holding.get_ref()

BIN
godot/Sounds/footstep.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://bmocmgq06o6f5"
path="res://.godot/imported/footstep.ogg-a3742943496340f7ceaa5ff03c6d5aa9.oggvorbisstr"
[deps]
source_file="res://Sounds/footstep.ogg"
dest_files=["res://.godot/imported/footstep.ogg-a3742943496340f7ceaa5ff03c6d5aa9.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -1,18 +1,24 @@
extends SharedSlime
class_name Cultist
const SPEED = 5.0
const JUMP_VELOCITY = 4.
var victim
func _on_area_3d_body_entered(body):
var items_in_range = $Area3D.get_overlapping_bodies()
var villagers = []
for item in items_in_range:
if is_class("Villager"):
villagers.append(item)
var rng = RandomNumberGenerator.new()
var victim_num = rng.randi_range(0, villagers.size())
func _process(delta):
super._process(delta)
if task == "corrupt":
pass
# For corruption detection range.
func _on_target_radius_body_entered(body):
if body.is_class("Villager"):
victim = body
walk_speed = 2 * walk_speed
target_location_xz = victim.location_xz
task = "walk"
# For collision with other slimes.
func _on_collision_detection_body_entered(body):
if body.is_class("Villager"):
task = "corrupt"

View File

@ -1,31 +1,34 @@
[gd_scene load_steps=7 format=3 uid="uid://e0s4phx2jiit"]
[gd_scene load_steps=6 format=3 uid="uid://e0s4phx2jiit"]
[ext_resource type="Script" path="res://cultist.gd" id="1_k6djk"]
[ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_y0hcm"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vxnad"]
albedo_texture = ExtResource("1_x8j7f")
[sub_resource type="CapsuleMesh" id="CapsuleMesh_17ljq"]
material = SubResource("StandardMaterial3D_vxnad")
[ext_resource type="PackedScene" uid="uid://c3q6fva1c1baa" path="res://Models/slime.tscn" id="2_004fn"]
[sub_resource type="SphereShape3D" id="SphereShape3D_rypky"]
radius = 20.0
radius = 5.0
[sub_resource type="SphereShape3D" id="SphereShape3D_pa038"]
radius = 3.0
[sub_resource type="SphereShape3D" id="SphereShape3D_bmc5i"]
radius = 0.3
[node name="Cultist" type="CharacterBody3D"]
script = ExtResource("1_k6djk")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_y0hcm")
[node name="TargetRadius" type="Area3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CapsuleMesh_17ljq")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="TargetRadius"]
shape = SubResource("SphereShape3D_rypky")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
[node name="slime" parent="." instance=ExtResource("2_004fn")]
[node name="CollisionDetection" type="Area3D" parent="."]
[node name="collision_ range" type="CollisionShape3D" parent="CollisionDetection"]
shape = SubResource("SphereShape3D_pa038")
[node name="cultist_collision" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_bmc5i")
[connection signal="body_entered" from="TargetRadius" to="." method="_on_target_radius_body_entered"]
[connection signal="body_entered" from="CollisionDetection" to="." method="_on_collision_detection_body_entered"]

View File

@ -21,10 +21,10 @@ shape = SubResource("CapsuleShape3D_kb4ms")
[node name="grape_man" parent="." instance=ExtResource("2_ctyy5")]
[node name="CameraMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
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, 1.39043)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.643936)
current = true
fov = 50.0

View File

@ -56,7 +56,7 @@ ui_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
@ -64,7 +64,7 @@ ui_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
@ -72,7 +72,7 @@ ui_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
@ -80,7 +80,7 @@ ui_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
@ -97,3 +97,23 @@ Pause={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
}
camera_up={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
camera_down={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
camera_right={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
camera_left={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
]
}

View File

@ -1,17 +1,27 @@
[gd_scene load_steps=4 format=3 uid="uid://c4s6y758n77lw"]
[gd_scene load_steps=5 format=3 uid="uid://c4s6y758n77lw"]
[ext_resource type="PackedScene" uid="uid://dmtmign72vtlm" path="res://slime_shared.tscn" id="1_qm1jp"]
[ext_resource type="Script" path="res://Villager.gd" id="2_uf6mh"]
[sub_resource type="SphereShape3D" id="SphereShape3D_0wi6w"]
[sub_resource type="SphereShape3D" id="SphereShape3D_k5rhc"]
radius = 0.05
[sub_resource type="SphereShape3D" id="SphereShape3D_wx128"]
radius = 0.1
[node name="villager" instance=ExtResource("1_qm1jp")]
script = ExtResource("2_uf6mh")
[node name="Area3D" type="Area3D" parent="." index="2"]
[node name="CollisionDetection" type="Area3D" parent="." index="2"]
[node name="slime_collision" type="CollisionShape3D" parent="CollisionDetection" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0408143, 0)
shape = SubResource("SphereShape3D_k5rhc")
[node name="Area3D" type="Area3D" parent="." index="3"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" index="0"]
shape = SubResource("SphereShape3D_0wi6w")
shape = SubResource("SphereShape3D_wx128")
[connection signal="body_entered" from="CollisionDetection" to="." method="_on_collision_detection_body_entered"]
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]