This commit is contained in:
Spencer Killen 2023-08-19 20:42:02 -06:00
parent d052cf41ed
commit b310830c9d
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
5 changed files with 25 additions and 10 deletions

View File

@ -33,7 +33,8 @@ func _input(event):
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
rotate_y(deg_to_rad(-event.relative.x * horiz_sens)) rotate_y(deg_to_rad(-event.relative.x * horiz_sens))
$CameraMount.rotate_x(deg_to_rad(-event.relative.y * vert_sens)) $CameraMount.rotate_x(deg_to_rad(-event.relative.y * vert_sens))
$grape_man.rotate_y(deg_to_rad(event.relative.x * horiz_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(-60), deg_to_rad(-11))
if Input.is_action_just_pressed("ui_accept"): if Input.is_action_just_pressed("ui_accept"):

View File

@ -1,10 +1,10 @@
extends CharacterBody3D extends SharedSlime
var rng = RandomNumberGenerator.new() var rng = RandomNumberGenerator.new()
@export var target_location_xz = transform.origin * Vector3(1, 0, 1) @onready var target_location_xz = transform.origin * Vector3(1, 0, 1)
@export var location_xz = transform.origin * Vector3(1, 0, 1) @onready var location_xz = transform.origin * Vector3(1, 0, 1)
@export var target_direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized() @onready var target_direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized()
@export var direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized() @onready var direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized()
var task = "idle" var task = "idle"
# Percentage chances of the character performing certain actions while idle. # Percentage chances of the character performing certain actions while idle.

View File

@ -1,8 +1,10 @@
extends CharacterBody3D extends CharacterBody3D
class_name SharedSlime
var is_holdable: bool = true var is_holdable: bool = true
func _ready(): func _ready():
$slime.foo()
$slime.idle() $slime.idle()
func walk(): func walk():

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://bax01mdng0pbb"] [gd_scene load_steps=5 format=3 uid="uid://bax01mdng0pbb"]
[ext_resource type="PackedScene" uid="uid://dmtmign72vtlm" path="res://slime_shared.tscn" id="2_dchwa"]
[ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="2_fy870"] [ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="2_fy870"]
[ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="2_oxniy"]
[sub_resource type="QuadMesh" id="QuadMesh_lasv3"] [sub_resource type="QuadMesh" id="QuadMesh_lasv3"]
@ -10,9 +10,6 @@ data = PackedVector3Array(0.5, -0.5, 0, -0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, -0.5,
[node name="test_pickup_slimes" type="Node3D"] [node name="test_pickup_slimes" type="Node3D"]
[node name="slime_shared" parent="." instance=ExtResource("2_dchwa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.127323, 0.879136)
[node name="Player" parent="." instance=ExtResource("2_fy870")] [node name="Player" parent="." instance=ExtResource("2_fy870")]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
@ -24,3 +21,6 @@ skeleton = NodePath("")
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
shape = SubResource("ConcavePolygonShape3D_x4p8c") shape = SubResource("ConcavePolygonShape3D_x4p8c")
[node name="villager" parent="." instance=ExtResource("2_oxniy")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.513896)

View File

@ -0,0 +1,12 @@
[gd_scene load_steps=3 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"]
[node name="villager" instance=ExtResource("1_qm1jp")]
script = ExtResource("2_uf6mh")
walk_chance = 0.1
spin_chance = 0.2
walk_speed = 0.5
dir_correction_rate = 0.95
dir_accuracy = 0.00174533