2018-10-09 16:58:51 +02:00
|
|
|
using Godot;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class Mob : RigidBody2D
|
|
|
|
{
|
|
|
|
[Export]
|
2020-10-06 11:28:27 +02:00
|
|
|
public int minSpeed;
|
2018-10-09 16:58:51 +02:00
|
|
|
|
|
|
|
[Export]
|
2020-10-06 11:28:27 +02:00
|
|
|
public int maxSpeed;
|
2018-10-09 16:58:51 +02:00
|
|
|
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
2020-10-06 11:28:27 +02:00
|
|
|
var animSprite = GetNode<AnimatedSprite>("AnimatedSprite");
|
|
|
|
animSprite.Playing = true;
|
|
|
|
string[] mobTypes = animSprite.Frames.GetAnimationNames();
|
|
|
|
animSprite.Animation = mobTypes[GD.Randi() % mobTypes.Length];
|
2018-10-09 16:58:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void OnVisibilityScreenExited()
|
|
|
|
{
|
|
|
|
QueueFree();
|
|
|
|
}
|
2020-06-17 20:53:10 +02:00
|
|
|
|
2020-04-03 18:35:35 +02:00
|
|
|
public void OnStartGame()
|
|
|
|
{
|
|
|
|
QueueFree();
|
|
|
|
}
|
2018-10-09 16:58:51 +02:00
|
|
|
}
|