#include "mob.hpp" #include #include void Mob::_ready() { godot::Ref random = godot::RandomNumberGenerator::_new(); random->randomize(); _animated_sprite = get_node("AnimatedSprite"); _animated_sprite->_set_playing(true); godot::PoolStringArray mob_types = _animated_sprite->get_sprite_frames()->get_animation_names(); _animated_sprite->set_animation(mob_types[random->randi() % mob_types.size()]); } void Mob::_on_VisibilityNotifier2D_screen_exited() { queue_free(); } void Mob::_register_methods() { godot::register_method("_ready", &Mob::_ready); godot::register_method("_on_VisibilityNotifier2D_screen_exited", &Mob::_on_VisibilityNotifier2D_screen_exited); }