SlimeoosOdyssey/godot/cul5E74.tmp

53 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-08-19 23:07:52 -06:00
[gd_scene load_steps=7 format=3 uid="uid://e0s4phx2jiit"]
[ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"]
[sub_resource type="GDScript" id="GDScript_bumf5"]
script/source = "extends SharedSlime
class_name Cultist
const SPEED = 5.0
const JUMP_VELOCITY = 4.
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, count(villagers))
"
[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")
[sub_resource type="SphereShape3D" id="SphereShape3D_sleix"]
radius = 20.0
[node name="Cultist" type="CharacterBody3D"]
script = SubResource("GDScript_bumf5")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_y0hcm")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CapsuleMesh_17ljq")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("SphereShape3D_sleix")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]