godot-demo-projects/mono/dodge_the_creeps/Mob.cs

18 lines
432 B
C#
Raw Normal View History

using Godot;
2022-03-28 02:05:07 +02:00
public partial class Mob : RigidDynamicBody2D
{
public override void _Ready()
{
var animSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
2020-10-06 11:28:27 +02:00
animSprite.Playing = true;
string[] mobTypes = animSprite.Frames.GetAnimationNames();
animSprite.Animation = mobTypes[GD.Randi() % mobTypes.Length];
}
public void OnVisibilityScreenExited()
{
QueueFree();
}
}