SlimeoosOdyssey/godot/cultist.gd

19 lines
380 B
GDScript

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, villagers.size())