mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Co-authored-by: Ivan Shakhov <van800@gmail.com> Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
17 lines
417 B
C#
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();
|
|
}
|
|
}
|