Dodge the Creeps - no animation for MOB

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gattsama

Hello all, just started learning Godot. Completed the dodge the creeps tutorial (twice in fact) but both times can not get the Mob animation to work?? Not sure what the problem is, the player animation works no problem. Any ideas or suggestions for what I should check??

Thanks in advance

:bust_in_silhouette: Reply From: kidscancode

You missed the part in the Node setup section where it says:

Set the Playing property in the Inspector to “On”

I was running into the same issue and after looking at and comparing the Player and Mob codes I saw this line: $AnimatedSprite2D.play()

I ended up adding it here in the Mobs script and now my Mobs are animated:
func _ready() → void:
pass # Replace with function body.
var mob_types = Array($AnimatedSprite2D.sprite_frames.get_animation_names())
$AnimatedSprite2D.animation = mob_types.pick_random()
$AnimatedSprite2D.play()

I am using Godot v4.4.1