dodge-the-creeps/Scripts/Mob.gd

23 lines
610 B
GDScript3
Raw Normal View History

2024-02-20 18:56:39 +03:00
extends RigidBody2D
class_name Mob
var _sprite: AnimatedSprite2D
var _shape: CollisionShape2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
_sprite = $Sprite
_shape = $Shape
var mob_types := _sprite.sprite_frames.get_animation_names()
_sprite.play(
mob_types[randi() % mob_types.size()]
)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_visible_on_screen_enabler_2d_screen_exited() -> void:
queue_free()
pass # Replace with function body.