[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 _process(delta): pass 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. var input_dir = Input.get_vector(\"ui_left\", \"ui_right\", \"ui_up\", \"ui_down\") var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: velocity.x = direction.x * SPEED velocity.z = direction.z * SPEED else: velocity.x = move_toward(velocity.x, 0, SPEED) velocity.z = move_toward(velocity.z, 0, SPEED) move_and_slide() 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.count()) " [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"]