Files
godot-demo-projects/mono/dodge_the_creeps/Mob.cs
captain-redbeard fbef18f58b Updated Dodge the Creeps C# to Godot mono 4.2 (#1000)
Co-authored-by: Ivan Shakhov <van800@gmail.com>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2024-04-12 00:56:02 -07:00

17 lines
417 B
C#

using Godot;
public partial class Mob : RigidBody2D
{
public override void _Ready()
{
var animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
string[] mobTypes = animatedSprite.SpriteFrames.GetAnimationNames();
animatedSprite.Play(mobTypes[GD.Randi() % mobTypes.Length]);
}
public void OnVisibleOnScreenNotifier2DScreenExited()
{
QueueFree();
}
}