Jump to content

AnimSprite is remain after stop and delete


Durumyisking
 Share

Recommended Posts

// Bullet
if(this.CurrentAnim.name == "bullet_dead")
  this.CurrentAnim.Animsprite.onComplete = () => {
    this.IsDead = true;
  };    

// Animation (animation class have member pixijs.animsprite)
this.update = function() // update is game loop
{
  if(!this.loop)
  {
    this.Animsprite.onComplete = () => {
      this.stopAnim(); // stop anim
      delete this; // delete animation obj
    };    
  }
}

// GameScene
if(this.arrGameObj[i][j].IsDead) // every loop check dead obj and remove it
{                                    
  delete this.arrGameObj[i][j]; // to null, release in memory
  this.arrGameObj[i].splice(j); // pop in arrgameobj
  continue;
}

 

// Here's recorded video that help you understand my problem clearly

2022-12-12 16-07-27.mkv

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...