Compare commits

...

8 Commits

Author SHA1 Message Date
ncusimano a8465d9962 Updates to Villager and Update to Main 2023-08-19 16:08:58 -06:00
ncusimano e52f893517 Merge branch 'master' into Player 2023-08-19 16:06:42 -06:00
Spencer Killen 86b796b09f
Add camera lock 2023-08-19 11:51:06 -06:00
Spencer Killen 4f01afff2f
a 2023-08-19 11:32:30 -06:00
Spencer Killen cc12e8fc12
Merge remote-tracking branch 'origin/Player' 2023-08-19 11:32:26 -06:00
Spencer Killen b84692b120
Merge branch 'master' of https://git.sjkillen.ca/sjkillen/ABGJ-23 2023-08-19 11:06:06 -06:00
Spencer Killen 2c3c20a503
Environment 2023-08-19 11:06:05 -06:00
vengefulcartographer 10b8fa0cac decorations 2023-08-19 11:05:28 -06:00
35 changed files with 7016 additions and 210 deletions

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://dd64j7xcfl6io"]
[gd_scene load_steps=6 format=3 uid="uid://cdm267rtmop75"]
[ext_resource type="PackedScene" uid="uid://csqyxbjumla33" path="res://player.tscn" id="1_jbc4n"]
[ext_resource type="PackedScene" uid="uid://cnnsy8h0dq5y1" path="res://villager.tscn" id="2_i3gws"]
[ext_resource type="PackedScene" uid="uid://rn1bmw0lf1lr" path="res://cultist.tscn" id="3_renxb"]
[ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="1_jbc4n"]
[ext_resource type="PackedScene" uid="uid://dl4g083w17qh1" path="res://villager.tscn" id="2_i3gws"]
[ext_resource type="PackedScene" uid="uid://e0s4phx2jiit" path="res://cultist.tscn" id="3_renxb"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_62oje"]
radius = 80.229

42
godot/Models/Barn.mtl Normal file
View File

@ -0,0 +1,42 @@
# Blender MTL File: 'Barn.blend'
# Material Count: 4
newmtl DarkRed
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.202353 0.042520 0.032067
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl LightRed
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.273903 0.056039 0.041967
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl RoofBlack
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.078802 0.078802 0.078802
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl White
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

3556
godot/Models/Barn.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cjhaw2h3mvhkk"
path="res://.godot/imported/Barn.obj-fde21b6feac1c5c0b3e5db375b44e1fa.mesh"
[deps]
files=["res://.godot/imported/Barn.obj-fde21b6feac1c5c0b3e5db375b44e1fa.mesh"]
source_file="res://Models/Barn.obj"
dest_files=["res://.godot/imported/Barn.obj-fde21b6feac1c5c0b3e5db375b44e1fa.mesh", "res://.godot/imported/Barn.obj-fde21b6feac1c5c0b3e5db375b44e1fa.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true

View File

@ -0,0 +1,72 @@
# Blender MTL File: 'Silo_House.blend'
# Material Count: 7
newmtl Black
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.031250 0.029233 0.031743
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Brown
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.224804 0.076709 0.037364
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl DarkGrey
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.176204 0.176204 0.176204
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl DarkRed
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.202353 0.042520 0.032067
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Grey
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.350832 0.350832 0.350832
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl LightRed
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.273903 0.056039 0.041967
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl White
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

3186
godot/Models/Silo_House.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cv1n88kp1gy2i"
path="res://.godot/imported/Silo_House.obj-c77ee50e31090452405f711d3ffdd658.mesh"
[deps]
files=["res://.godot/imported/Silo_House.obj-c77ee50e31090452405f711d3ffdd658.mesh"]
source_file="res://Models/Silo_House.obj"
dest_files=["res://.godot/imported/Silo_House.obj-c77ee50e31090452405f711d3ffdd658.mesh", "res://.godot/imported/Silo_House.obj-c77ee50e31090452405f711d3ffdd658.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true

View File

@ -4,6 +4,7 @@
[ext_resource type="Script" path="res://Models/grape_man.gd" id="2_ksje8"]
[node name="grape_man" instance=ExtResource("1_fh5yr")]
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"]

View File

@ -1,13 +1,13 @@
[gd_scene load_steps=4 format=3 uid="uid://difi2tur2j4dg"]
[ext_resource type="PackedScene" uid="uid://dfyt6kjw8yli" path="res://Models/island.glb" id="1_5vc8b"]
[ext_resource type="Material" uid="uid://yuhlhpwji3c4" path="res://Textures/sand.tres" id="2_bmkng"]
[ext_resource type="Material" uid="uid://b88xmds4mx7rd" path="res://Textures/grass.tres" id="2_knbpa"]
[ext_resource type="Material" uid="uid://yuhlhpwji3c4" path="res://Textures/dirt.tres" id="2_twsru"]
[node name="island" instance=ExtResource("1_5vc8b")]
[node name="Island" parent="." index="0"]
material_override = ExtResource("2_bmkng")
material_override = ExtResource("2_twsru")
[node name="Island_001" parent="." index="1"]
material_override = ExtResource("2_knbpa")

View File

@ -1,11 +1,11 @@
[gd_scene load_steps=5 format=3 uid="uid://d3ccrfjpg4hbv"]
[ext_resource type="PackedScene" uid="uid://b56skjdfurygh" path="res://Models/PalmCurved.glb" id="1_snqoj"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood1.png" id="2_yi8j6"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood.png" id="2_pwgeo"]
[ext_resource type="Material" uid="uid://dudwc12l32jc1" path="res://Textures/leaves.tres" id="4_1vrev"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_p2v08"]
albedo_texture = ExtResource("2_yi8j6")
albedo_texture = ExtResource("2_pwgeo")
[node name="PalmCurved" instance=ExtResource("1_snqoj")]

View File

@ -2,10 +2,10 @@
[ext_resource type="PackedScene" uid="uid://7c7deqr02ce6" path="res://Models/PalmDefault.glb" id="1_wlpps"]
[ext_resource type="Material" uid="uid://dudwc12l32jc1" path="res://Textures/leaves.tres" id="2_xkp4w"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood1.png" id="3_vowun"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood.png" id="3_a0k7p"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_81n3a"]
albedo_texture = ExtResource("3_vowun")
albedo_texture = ExtResource("3_a0k7p")
[node name="PalmDefault" instance=ExtResource("1_wlpps")]

View File

@ -2,10 +2,10 @@
[ext_resource type="PackedScene" uid="uid://bx4qhi6ucs6g1" path="res://Models/PalmYoung.glb" id="1_aeax5"]
[ext_resource type="Material" uid="uid://dudwc12l32jc1" path="res://Textures/leaves.tres" id="2_6pvnm"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood1.png" id="3_ynktd"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood.png" id="3_u0erk"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tug8p"]
albedo_texture = ExtResource("3_ynktd")
albedo_texture = ExtResource("3_u0erk")
[node name="PalmYoung" instance=ExtResource("1_aeax5")]

View File

@ -26,17 +26,17 @@ states/Walk/position = Vector2(329, 155)
transitions = ["Walk", "Idle", SubResource("AnimationNodeStateMachineTransition_n3s05"), "Idle", "Walk", SubResource("AnimationNodeStateMachineTransition_fbi2x"), "Start", "Idle", SubResource("AnimationNodeStateMachineTransition_srcja")]
[node name="slime" instance=ExtResource("1_jttw0")]
transform = Transform3D(0.035, 0, 0, 0, 0.035, 0, 0, 0, 0.035, 0, 0, 0)
script = ExtResource("2_xo27e")
[node name="Skeleton3D" parent="Armature" index="0"]
bones/1/position = Vector3(0, 0.264857, 0)
bones/2/position = Vector3(0.028393, 0.513056, 0.0124737)
bones/2/rotation = Quaternion(-0.178538, 0.0193832, -0.211014, 0.960844)
bones/3/rotation = Quaternion(0.109512, -0.695192, 0.00400734, 0.710422)
bones/7/rotation = Quaternion(-0.347763, 2.02718e-09, 2.9685e-09, 0.937583)
bones/8/rotation = Quaternion(-0.091967, -7.45328e-10, -7.10578e-10, 0.995762)
bones/10/rotation = Quaternion(0.0144373, -4.10082e-08, -1.82391e-09, 0.999896)
bones/11/rotation = Quaternion(-0.373719, 8.36829e-08, 6.89615e-08, 0.927542)
bones/1/position = Vector3(0, 0.408076, 0)
bones/2/rotation = Quaternion(-0.0627444, 0.00212883, -0.213248, 0.974979)
bones/3/rotation = Quaternion(0.100834, -0.698956, 0.0125015, 0.707911)
bones/7/rotation = Quaternion(-0.275892, 2.28845e-09, 2.79242e-09, 0.961189)
bones/8/rotation = Quaternion(0.131738, -8.57356e-10, -5.26868e-10, 0.991285)
bones/10/rotation = Quaternion(0.275768, -5.73458e-08, -4.54648e-08, 0.961224)
bones/11/rotation = Quaternion(-0.131755, 8.86793e-08, 4.46748e-08, 0.991282)
[node name="AnimationTree" type="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeStateMachine_prt7l")

View File

@ -1,6 +1,5 @@
extends CharacterBody3D
const SPEED = 5.0
const JUMP_VELOCITY = 4.5
@export var horiz_sens = 0.25
@ -13,9 +12,6 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
playerCam = get_node("CameraMount") as Node3D
playerVisuals = get_node("grape_man") as Node3D
func _process(delta):
# Brings your mouse out of the window if you press escape. Add pause screen function here?
@ -28,19 +24,17 @@ func _input(event):
if event is InputEventMouseMotion:
# Side to side, first player object then player visuals.
rotate_y(deg_to_rad(-event.relative.x * horiz_sens))
playerVisuals.rotate_y(deg_to_rad(event.relative.x * horiz_sens))
$grape_man.rotate_y(deg_to_rad(event.relative.x * horiz_sens))
# Vertical camera rotation.
playerCam.rotate_x(deg_to_rad(-event.relative.y * vert_sens))
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11))
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
# Handle Jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.

BIN
godot/Textures/Elements_15-128x128.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cg4en6vvbibj3"
path.s3tc="res://.godot/imported/grass2.png-937551ccce52f42d9f9c12c7cf49916c.s3tc.ctex"
uid="uid://d0onbp1v5c7s3"
path.s3tc="res://.godot/imported/Elements_15-128x128.png-39888977615198f49985dd432e248679.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://Textures/grass2.png"
dest_files=["res://.godot/imported/grass2.png-937551ccce52f42d9f9c12c7cf49916c.s3tc.ctex"]
source_file="res://Textures/Elements_15-128x128.png"
dest_files=["res://.godot/imported/Elements_15-128x128.png-39888977615198f49985dd432e248679.s3tc.ctex"]
[params]

BIN
godot/Textures/grass2.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,6 +1,6 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://dudwc12l32jc1"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood1.png" id="1_5s240"]
[ext_resource type="Texture2D" uid="uid://cqdi13k4hs5vb" path="res://Textures/wood.png" id="1_5s240"]
[ext_resource type="Texture2D" uid="uid://d0pddcjy8uhp" path="res://Textures/leaves3.png" id="2_blarx"]
[resource]

View File

@ -1,7 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://c3u8uoiywkd2n"]
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://c3u8uoiywkd2n"]
[ext_resource type="Texture2D" uid="uid://d0onbp1v5c7s3" path="res://Textures/Elements_15-128x128.png" id="1_02nrx"]
[ext_resource type="Texture2D" uid="uid://d0pddcjy8uhp" path="res://Textures/leaves3.png" id="1_x366e"]
[resource]
albedo_color = Color(0.101961, 0.517647, 0.729412, 1)
albedo_color = Color(0.219608, 0.772549, 0.67451, 1)
albedo_texture = ExtResource("1_02nrx")
normal_texture = ExtResource("1_x366e")
uv1_scale = Vector3(15, 15, 15)

BIN
godot/Textures/weirding2.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cwhif8yubo7pv"
path.s3tc="res://.godot/imported/weirding2.png-0ec272148c017c4eeacae4dee370838c.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Textures/weirding2.png"
dest_files=["res://.godot/imported/weirding2.png-0ec272148c017c4eeacae4dee370838c.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cqdi13k4hs5vb"
path.s3tc="res://.godot/imported/wood1.png-e14cdc49f9065a35c75e56b56e461231.s3tc.ctex"
path.s3tc="res://.godot/imported/wood.png-e9bea9d81f4e9a138b221cec4feecdec.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://Textures/wood1.png"
dest_files=["res://.godot/imported/wood1.png-e14cdc49f9065a35c75e56b56e461231.s3tc.ctex"]
source_file="res://Textures/wood.png"
dest_files=["res://.godot/imported/wood.png-e9bea9d81f4e9a138b221cec4feecdec.s3tc.ctex"]
[params]

BIN
godot/Textures/wood2.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://m6mopkkotfjc"
path.s3tc="res://.godot/imported/wood2.png-f0fb4b8150e6ddd08d41375fa35b14a7.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Textures/wood2.png"
dest_files=["res://.godot/imported/wood2.png-f0fb4b8150e6ddd08d41375fa35b14a7.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

BIN
godot/Textures/wood5.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xtmihxoot0c5"
path.s3tc="res://.godot/imported/wood5.png-00769a26e54f211b2d40fde27ccee07b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Textures/wood5.png"
dest_files=["res://.godot/imported/wood5.png-00769a26e54f211b2d40fde27ccee07b.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@ -1,67 +1,82 @@
extends Node3D
extends CharacterBody3D
var rng = RandomNumberGenerator.new()
var spin_amount = 0
var spinning = false
var wait_time = 0
var walking = false
var walk_dist = 0
@export var target_location_xz = global_transform.origin * Vector3(1, 0, 1)
@export var location_xz = global_transform.origin * Vector3(1, 0, 1)
@export var target_direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized()
@export var direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized()
var task = "idle"
# Percentage chances of the character performing certain actions while idle.
@export var walk_chance = 0.1
@export var spin_chance = 0.2
@export var walk_speed = 0.5
# Rate at which character corrects their direction after going off course (percentage).
@export var dir_correction_rate = 0.95
# Margin of accuracy to which the character will correct their direction when off course (radians).
@export var dir_accuracy = deg_to_rad(0.1)
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var task = "idle"
location_xz = global_transform.origin * Vector3(1, 0, 1)
direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized()
match task:
"idle":
task = rng.randi_range(0, 100)
task = rng.randf_range(0, 100)
if task <= 33:
# 3% chance to walk somewhere.
if task <= walk_chance:
task = "walk"
elif task > 33 and task <= 50:
target_location_xz = global_transform.origin * Vector3(1, 0, 1) + (direction_xz * 16)
# 6% chance to rotate.
elif task > walk_chance and task <= (walk_chance + spin_chance):
task = "spin"
elif task > 50:
task = "wait"
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
# 90% chance to idle.
elif task > (spin_chance + walk_chance):
task = "idle"
"walk":
if !walking:
walk_dist = rng.randi_range(0, 20)
walking = true
if walk_dist > 0:
# Small change to turn a little while walking.
var spin_chance = rng.randi_range(0, 10)
if spin_chance <= 1:
rotate_y(5)
# Get the direction to the target in z-x plane.
target_direction_xz = (location_xz.direction_to(target_location_xz) * Vector3(1, 0, 1)).normalized()
# Continue to correct direction to within a margin of dir_accuracy degrees.
if direction_xz.angle_to(target_direction_xz) >= dir_accuracy:
# Rotate towards destination at specified percentage rate.
rotate_y(direction_xz.angle_to(target_direction_xz) * dir_correction_rate)
if location_xz.distance_to(target_location_xz) <= (Vector2(direction_xz.x, direction_xz.z) * walk_speed).length():
target_direction_xz = direction_xz
target_location_xz = location_xz
task = "idle"
"spin":
if !spinning:
var spin_amount = rng.randi_range(-360, 360)
spinning = true
if spin_amount > 0:
rotate_y(5)
spin_amount -= 5
elif spin_amount < 0:
rotate_y(-5)
spin_amount += 5
else:
task = "idle"
spinning = false
"wait":
# Idle Animation goes here!
wait_time += 1
if wait_time == 100:
task = "idle"
wait_time = 0
task = "idle"
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
# Walk to target location.
if location_xz.distance_to(target_location_xz) > (Vector2(direction_xz.x, direction_xz.z) * walk_speed).length():
velocity.x = direction_xz.x * walk_speed
velocity.z = direction_xz.z * walk_speed
move_and_slide()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://rn1bmw0lf1lr"]
[gd_scene load_steps=5 format=3 uid="uid://e0s4phx2jiit"]
[ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"]

View File

@ -21,5 +21,5 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0,
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.45879, 0)
[node name="PlayerCam" type="Camera3D" parent="CameraMount"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 7)
fov = 105.5
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 11.9417)
fov = 50.0

View File

@ -15,6 +15,14 @@ run/main_scene="res://cameraTest.tscn"
config/features=PackedStringArray("4.1", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=512
window/size/viewport_height=512
window/size/mode=3
window/stretch/mode="viewport"
window/stretch/aspect="expand"
[dotnet]
project/assembly_name="abgj23"

View File

@ -11,3 +11,6 @@ func _on_idle_pressed():
func _on_walk_pressed():
$grape_man.walk()
func _on_hold_pressed():
$grape_man.hold()

View File

@ -51,7 +51,7 @@ layout_mode = 2
text = "Walk"
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.551151, 0, 0.834406, 0, 1, 0, -0.834406, 0, 0.551151, 10.2206, 6.04514, 5.32455)
transform = Transform3D(0.551151, 0, 0.834406, 0, 1, 0, -0.834406, 0, 0.551151, 1.041, 0.45, 0.03)
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Pickup" to="." method="_on_pickup_pressed"]
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Hold" to="." method="_on_hold_pressed"]

View File

@ -39,7 +39,7 @@ layout_mode = 2
text = "Walk"
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.999682, 0, -0.0251998, 0, 1, 0, 0.0251998, 0, 0.999682, 0.262823, 2.33598, 7.32455)
transform = Transform3D(0.999682, 0, -0.0251998, 0, 1, 0, 0.0251998, 0, 0.999682, 0, 0.138, 0.315)
current = true
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Idle" to="." method="_on_idle_pressed"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://cnnsy8h0dq5y1"]
[gd_scene load_steps=4 format=3 uid="uid://dl4g083w17qh1"]
[ext_resource type="Script" path="res://Villager.gd" id="1_ardgw"]
@ -6,13 +6,11 @@
[sub_resource type="CapsuleMesh" id="CapsuleMesh_b3srs"]
[node name="Node3D" type="Node3D"]
[node name="Villager" type="CharacterBody3D"]
script = ExtResource("1_ardgw")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_s4x8n")
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D/CollisionShape3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CapsuleMesh_b3srs")