Animation freeze in pre update with super pre update

import Phaser from 'phaser'


export default class Gob extends Phaser.Physics.Arcade.Sprite 
{
    
    private target: Phaser.Physics.Arcade.Sprite  


    moveItems(object: this, speed: number): void
    {
        object.y += speed;
        if (object.y >= 595){
            object.destroy()
        }
        
    }

    constructor(scene: Phaser.Scene, x: number, y: number, target: Phaser.Physics.Arcade.Sprite )
    {
        
        super(scene, x, y, 'gob')

        this.target = target

        scene.add.existing(this)
        scene.physics.add.existing(this)
        this.setScale(2)
        this.play("gobRun")
        

        const body = this.body as Phaser.Physics.Arcade.Body
        body.setSize(this.width*0.45, this.height*0.7)
        body.setOffset(9, 6)
        body.setBounce(1,1)
        
        
    }

    preUpdate(time, delta) 
    {   
        super.preUpdate(time, delta)

        if(this.y < 300)
        {
            this.moveItems(this, 2.5)
            
        }else if(this.y > 300 && this.y < 550)
        {
            this.moveItems(this, 4)
            this.play("gobBlitz")

        }else if(this.y > 550 && this.y < 589)
        {
            this.moveItems(this, 2)
            this.play("gobBack")
        }else
        {
            this.play("gobRun")
            this.moveItems(this, 2)
        }
        
        

        if(this.x > this.target.x + 3 && this.y < this.target.y && this.y > 0){
            //this.setRotation(-63);
            
            this.x -= 2;
        }
        if(this.x < this.target.x - 3 && this.y < this.target.y && this.y > 0){
            //this.setRotation(63);
            
            this.x += 2;
        }
        
        
    }
    
}

Hello Mates
I have a sprite, member of a group for which i just cant make rolling the animations…
I use the pre update with super pre update …

This technic had worked for the player sprite but not for the ennemies…

Someone knows why?

Thx for your time and advices!

After a good night, i feel i have some clues!

The animation is reload from start each time so it looks freezing… I have to find a way to avoid that !

Dont hesitate to help me aniway. :]

Cheers

import Phaser from 'phaser'

import GobState from '~/consts/GobState';


export default class Gob extends Phaser.Physics.Arcade.Sprite 
{
    
    private target: Phaser.Physics.Arcade.Sprite  

    private gobState = GobState.Running


    moveItems(object: this, speed: number): void
    {
        object.y += speed;
        if (object.y >= 595){
            object.destroy()
        }
    }

    private testGobStates()
    {
        if(this.y > 300 && this.y < 540 && this.gobState === GobState.Running )
        {
            this.gobState = GobState.Blitzing
            this.play('gobBlitz')
        }
        if(this.y > 540 && this.gobState === GobState.Blitzing )
        {
            this.gobState = GobState.Back
            this.play('gobRun')
        }
    }

    constructor(scene: Phaser.Scene, x: number, y: number, target: Phaser.Physics.Arcade.Sprite )
    {
        
        super(scene, x, y, 'gob')

        this.target = target

        scene.add.existing(this)
        scene.physics.add.existing(this)
        this.setScale(2)
        this.play("gobRun")
        
        const body = this.body as Phaser.Physics.Arcade.Body
        body.setSize(this.width*0.45, this.height*0.7)
        body.setOffset(9, 6)
        body.setBounce(1,1)
    }

    preUpdate(time, delta) 
    {   
        super.preUpdate(time, delta)

        this.testGobStates()
        
        switch(this.gobState){

            case GobState.Running:
            {
                this.moveItems(this, 3)
            }
            break
            case GobState.Blitzing:
            {
                this.moveItems(this, 5)
            }
            break
            case GobState.Back:
            {
                this.moveItems(this, 3)
            }
        }   
        

        if(this.x > this.target.x + 3 && this.y < this.target.y && this.y > 0){
            //this.setRotation(-63);
            
            this.x -= 2;
        }
        if(this.x < this.target.x - 3 && this.y < this.target.y && this.y > 0){
            //this.setRotation(63);
            
            this.x += 2;
        }
        
        
    }


    
}

Got it like that! :]