Godot v. 4.0 Beta 1 animaion not playing

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

Hey all,

So this is my first time playing around with Godot or game engines in general. I followed along with the tutorial documentation for the 2D and 3D game and was able to update it accordingly for the changes for the version 4 beta.

After following the 3D game tutorial I decided to make a handful of changes to make the game a little better. One of those things is adding a squish animation to the little creeps when you jump on their heads. I figured this would be an easy change since the tutorial showed us working with animations. For some reason though, this animation I created doesn’t seem to play when I call play(), or is the animation_finished signal triggering to get the creep to disappear.

Here is the code for the mob:

extends CharacterBody3D

signal squashed

@export var min_speed = 10
@export var max_speed = 18

var velo = Vector3.ZERO

func _physics_process(delta):
velocity = velo

func initialize(start_position, player_position):
look_at_from_position(start_position, player_position, Vector3.UP)
rotate_y(randf_range(-PI / 4, PI / 4))

var random_speed = randi_range(min_speed, max_speed)
velo = Vector3.FORWARD * random_speed

velo = velo.rotated(Vector3.UP, rotation.y)

if $MoveAnimation.is_active():
	$MoveAnimation.playback_speed = random_speed / min_speed
func _on_visible_on_screen_notifier_3d_screen_exited():

func squash():
velo = Vector3.ZERO
$CollisionShape3d.disabled = true


func _on_squash_animation_animation_finished(anim_name):

Its a really short like .3 second animation that just scales the creep down flat. If the code for the other parts of the game are needed I can post them here.

I think you should provide the name of the animation to be played to play() function.

magicalogic | 2022-11-17 04:05

Oh sheesh. what a simple fix. Thank you!

PlayerSixtyfour | 2022-11-17 13:08