2018-10-09 16:58:51 +02:00
|
|
|
using Godot;
|
|
|
|
|
2024-04-12 09:56:02 +02:00
|
|
|
public partial class Mob : RigidBody2D
|
2018-10-09 16:58:51 +02:00
|
|
|
{
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
2024-04-12 09:56:02 +02:00
|
|
|
var animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
|
|
|
string[] mobTypes = animatedSprite.SpriteFrames.GetAnimationNames();
|
|
|
|
animatedSprite.Play(mobTypes[GD.Randi() % mobTypes.Length]);
|
2018-10-09 16:58:51 +02:00
|
|
|
}
|
|
|
|
|
2024-04-12 09:56:02 +02:00
|
|
|
public void OnVisibleOnScreenNotifier2DScreenExited()
|
2018-10-09 16:58:51 +02:00
|
|
|
{
|
|
|
|
QueueFree();
|
|
|
|
}
|
|
|
|
}
|