made a rat and a ladder and the rat is *kind* of working

This commit is contained in:
Derek
2024-07-27 21:08:41 -05:00
parent 94ddefc7f5
commit 186aa89e3f
39 changed files with 5191 additions and 46 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3imms57ifxed"
path.s3tc="res://.godot/imported/ladder1.normal.png-9a7b240bc19e57c582a87c50827c899e.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/ladder1.normal.png"
dest_files=["res://.godot/imported/ladder1.normal.png-9a7b240bc19e57c582a87c50827c899e.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/Models/ladder1.normal.png"
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnmrpjmccqtxr"
path.s3tc="res://.godot/imported/ladder1.rough.png-40fb4584098a9daefd1452b7d15d19a3.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/ladder1.rough.png"
dest_files=["res://.godot/imported/ladder1.rough.png-40fb4584098a9daefd1452b7d15d19a3.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://y7skmb07dvc7"
path.s3tc="res://.godot/imported/latter1.albedo.png-462aff810f45d1eb053674e688d4a431.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/latter1.albedo.png"
dest_files=["res://.godot/imported/latter1.albedo.png-462aff810f45d1eb053674e688d4a431.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
assets/Models/rat.blend Normal file

Binary file not shown.

View File

@@ -0,0 +1,50 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://jophhsg2w21y"
path="res://.godot/imported/rat.blend-35c63ae49c966b7cae8f2b680a612168.scn"
[deps]
source_file="res://assets/Models/rat.blend"
dest_files=["res://.godot/imported/rat.blend-35c63ae49c966b7cae8f2b680a612168.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1
blender/nodes/visible=0
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

BIN
assets/Models/rat.blend1 Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cy4cwv7ppdclm"
path.s3tc="res://.godot/imported/rat1.albedo.png-c29325701546e2c63195a77a91603127.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.albedo.png"
dest_files=["res://.godot/imported/rat1.albedo.png-c29325701546e2c63195a77a91603127.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ch863c8gv6ec5"
path.s3tc="res://.godot/imported/rat1.normal.png-810ee2294b6534f4c525d82396abf2d1.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.normal.png"
dest_files=["res://.godot/imported/rat1.normal.png-810ee2294b6534f4c525d82396abf2d1.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/Models/rat1.normal.png"
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://caboww85wl3r3"
path.s3tc="res://.godot/imported/rat1.roughness.png-7ef4c9ed5c9e7822f363c78772f6efff.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.roughness.png"
dest_files=["res://.godot/imported/rat1.roughness.png-7ef4c9ed5c9e7822f363c78772f6efff.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://4hcotl7lxuph"
path.s3tc="res://.godot/imported/rat1.skin.albedo.png-d1fc6d9c18f7b953a9ea828af9c5e06a.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.skin.albedo.png"
dest_files=["res://.godot/imported/rat1.skin.albedo.png-d1fc6d9c18f7b953a9ea828af9c5e06a.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dou16gpndumbw"
path.s3tc="res://.godot/imported/rat1.viscera.albedo.png-fb92a11c9d25479674076bb2a79b75c4.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.viscera.albedo.png"
dest_files=["res://.godot/imported/rat1.viscera.albedo.png-fb92a11c9d25479674076bb2a79b75c4.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://vaym8hyreuyj"
path.s3tc="res://.godot/imported/rat1.viscera.rough.png-54c940e9dde2d807e7c407999e623d67.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Models/rat1.viscera.rough.png"
dest_files=["res://.godot/imported/rat1.viscera.rough.png-54c940e9dde2d807e7c407999e623d67.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
assets/Models/ratDEAD.blend Normal file

Binary file not shown.

View File

@@ -0,0 +1,50 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://djwtrtp1wan20"
path="res://.godot/imported/ratDEAD.blend-1a45fe56bc28e782bdf8ecd801bae145.scn"
[deps]
source_file="res://assets/Models/ratDEAD.blend"
dest_files=["res://.godot/imported/ratDEAD.blend-1a45fe56bc28e782bdf8ecd801bae145.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1
blender/nodes/visible=0
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

54
assets/ladder.tscn Normal file

File diff suppressed because one or more lines are too long

384
assets/rat.tscn Normal file

File diff suppressed because one or more lines are too long

2690
assets/rat_dead.tscn Normal file

File diff suppressed because one or more lines are too long

35
assets/rat_hole.tscn Normal file
View File

@@ -0,0 +1,35 @@
[gd_scene load_steps=6 format=3 uid="uid://6rhnl7vbvvr4"]
[ext_resource type="Script" path="res://scripts/rat_hole.gd" id="1_c22gk"]
[ext_resource type="PackedScene" uid="uid://0xs247hfvkml" path="res://assets/rat.tscn" id="2_dih3n"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_iujlh"]
albedo_color = Color(0.252116, 0.073109, 0.0541527, 1)
[sub_resource type="BoxMesh" id="BoxMesh_7h30q"]
material = SubResource("StandardMaterial3D_iujlh")
size = Vector3(0.7, 0.7, 0.1)
[sub_resource type="BoxShape3D" id="BoxShape3D_elkdi"]
size = Vector3(0.722656, 0.713135, 0.605469)
[node name="RatHole" type="Node3D"]
script = ExtResource("1_c22gk")
rat = ExtResource("2_dih3n")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_7h30q")
[node name="RayCast3D" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.0748563)
target_position = Vector3(0, 0, -1)
[node name="Area3D" type="Area3D" parent="."]
collision_layer = 7
collision_mask = 7
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0113525, -0.302734)
shape = SubResource("BoxShape3D_elkdi")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]

1483
scenes/tes1546.tmp Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=111 format=3 uid="uid://dyop6vk3rgkkb"]
[gd_scene load_steps=113 format=3 uid="uid://dyop6vk3rgkkb"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_orhgl"]
[ext_resource type="Texture2D" uid="uid://dqs06ic3vjtwk" path="res://assets/Models/asphalt1.albedo.jpg" id="1_w4rag"]
@@ -30,8 +30,10 @@
[ext_resource type="Texture2D" uid="uid://5i5urt5i8fjd" path="res://assets/Models/boxcar1.wheel.normal.png" id="28_tulwp"]
[ext_resource type="Texture2D" uid="uid://4lve7kqobqx2" path="res://assets/Models/boxcar1.coupler.albedo.png" id="29_1k31y"]
[ext_resource type="Texture2D" uid="uid://bxek6q1nxy1ks" path="res://assets/Models/boxcar1.coupler.normal.png" id="30_veuc5"]
[ext_resource type="Script" path="res://scripts/EnemyHivemind1.gd" id="31_vonxg"]
[ext_resource type="PackedScene" uid="uid://djr7vnr1hcx82" path="res://assets/spider2.tscn" id="32_yw30t"]
[ext_resource type="PackedScene" uid="uid://0xs247hfvkml" path="res://assets/rat.tscn" id="32_og4yo"]
[ext_resource type="PackedScene" uid="uid://cgo4qyul7ix5p" path="res://assets/ladder.tscn" id="33_0m4lq"]
[ext_resource type="Script" path="res://scripts/Rat_Control.gd" id="33_f7t8d"]
[ext_resource type="PackedScene" uid="uid://6rhnl7vbvvr4" path="res://assets/rat_hole.tscn" id="34_uuf6k"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_nb6x7"]
sky_top_color = Color(0.558421, 0.596557, 0.822424, 1)
@@ -1457,49 +1459,25 @@ transform = Transform3D(-0.215332, 0, -0.976541, 0, 1, 0, 0.976541, 0, -0.215332
[node name="Powerline3" parent="Decorations" instance=ExtResource("18_aq0pn")]
transform = Transform3D(-0.215332, 0, -0.976541, 0, 1, 0, 0.976541, 0, -0.215332, 10.105, 0, 35.9476)
[node name="Spider Hivemind" type="Node" parent="."]
script = ExtResource("31_vonxg")
[node name="Ladder" parent="." instance=ExtResource("33_0m4lq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -56.263, 0.0535244, 52.2153)
[node name="spider" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.2661, -0.228645, 27.3522)
player_path = NodePath("../../Player")
[node name="Ladder2" parent="." instance=ExtResource("33_0m4lq")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -56.263, 4.01174, 52.2153)
[node name="spider2" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -22.3072, -0.228645, 24.2875)
player_path = NodePath("../../Player")
[node name="rat" parent="." instance=ExtResource("32_og4yo")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.123, 0.168887, 32.6325)
[node name="spider3" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26.0762, -0.228643, 22.5939)
player_path = NodePath("../../Player")
[node name="RATS" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.06322, 0.386584, 38.0795)
script = ExtResource("33_f7t8d")
rat = ExtResource("32_og4yo")
[node name="spider4" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.3627, -0.228643, 21.5787)
player_path = NodePath("../../Player")
[node name="RatHole" parent="RATS" instance=ExtResource("34_uuf6k")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0417337, -0.133987)
[node name="spider5" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -34.8134, -0.228645, 23.642)
player_path = NodePath("../../Player")
[node name="RatHole2" parent="RATS" instance=ExtResource("34_uuf6k")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -25.9553, 0.0330879, -30.573)
[node name="spider6" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.8545, -0.228645, 20.5772)
player_path = NodePath("../../Player")
[node name="spider7" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -32.6235, -0.228643, 18.8837)
player_path = NodePath("../../Player")
[node name="spider8" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25.9101, -0.228643, 17.8685)
player_path = NodePath("../../Player")
[node name="spider9" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.67616, 7.32017, 40.4548)
player_path = NodePath("../../Player")
[node name="spider10" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.82865, 7.32017, 42.5586)
player_path = NodePath("../../Player")
[node name="spider11" parent="Spider Hivemind" instance=ExtResource("32_yw30t")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.10333, 7.32017, 42.5467)
player_path = NodePath("../../Player")
[node name="RatHole3" parent="RATS" instance=ExtResource("34_uuf6k")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -17.9345, -0.015456, -30.6857)

File diff suppressed because one or more lines are too long

36
scripts/Rat_Control.gd Normal file
View File

@@ -0,0 +1,36 @@
extends Node3D
@export var rat : Resource
@export var spawn_amount = 1 #max amount in level at any given time
var rng = RandomNumberGenerator.new()
var holes = []
var start_hole_id
var start_hole
var end_hole_id
var end_hole
var hole_length_id
var control_node = self
# Called when the node enters the scene tree for the first time.
func _ready():
holes = get_children()
hole_length_id = holes.size() - 1
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if spawn_amount > 0:
#assign holes
#start_hole_id = rng.randi_range(0,hole_length_id)
#end_hole_id = rng.randi_range(0,hole_length_id)
#make sure the end hole doesn't equal the start hole
#if end_hole_id != start_hole_id:
#assign objects
start_hole = holes[0]
end_hole = holes[1]
#spawn rat at first hole and pass position of next hole
start_hole.spawn_rat(end_hole,control_node)
spawn_amount -= 1

View File

@@ -23,6 +23,5 @@ func breaking(current_velocity):
spawn_broken.position = global_position
spawn_broken.transform.basis = global_transform.basis
spawn_broken.rotation = rotation
get_tree().get_root().add_child(spawn_broken)
queue_free()

27
scripts/rat.gd Normal file
View File

@@ -0,0 +1,27 @@
extends RigidBody3D
@onready var anim_player = $AnimationPlayer
@export var dead_rat : Resource
var end_hole
var control_node
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if end_hole != null:
var move_direction = end_hole.global_position - self.position
self.set_linear_velocity(move_direction * 1)
#self.look_at(end_hole.position,Vector3.UP)
func breaking(bullet_velocity):
var spawn_broken = dead_rat.instantiate()
spawn_broken.position = global_position
spawn_broken.transform.basis = global_transform.basis
spawn_broken.rotation = rotation
var pieces = spawn_broken.get_children()
get_tree().get_root().add_child(spawn_broken)
queue_free()

15
scripts/rat_dead.gd Normal file
View File

@@ -0,0 +1,15 @@
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_timer_timeout():
queue_free()

29
scripts/rat_hole.gd Normal file
View File

@@ -0,0 +1,29 @@
extends Node3D
@export var rat : Resource
@onready var ray = $RayCast3D
@onready var area_3d = $Area3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func spawn_rat(end_hole,control_node):
var spawn_rat = rat.instantiate()
spawn_rat.position = ray.global_position
spawn_rat.transform.basis = ray.global_transform.basis
spawn_rat.look_at(end_hole.position,Vector3.UP)
spawn_rat.end_hole = end_hole
get_tree().get_root().add_child(spawn_rat)
func _on_area_3d_body_entered(body):
if body.is_in_group("rat"):
if body.end_hole == self:
#body.control_node.spawn_amount += 1 #signal to control node that another rat can enter the scene
body.queue_free()