Jump to content

anchor point when play a different size animation


Recommended Posts

I have a sprite sheet , which one has a sequenced animation 
with different size , and i have set the anchor point to .5,.5
when i create the sprite , however since there are frames with different

size , the default anchor point do not belongs to the center position.

how do you treat about this  issue ? any advice are welcome.


Thanks in advance.


some code for instance:

 this.wb = g.add.sprite(w, h, "wb"); this.wb.anchor.setTo(.5, .7); // TODO this.wb.body.collideWorldBounds = true; this.wb.body.bounce.setTo(0, 0); this.wb.animations.add( 'stay' , framesNamesGene(symWindBladeSpr, 0, 10, "", 4), 16 , true); this.wb.animations.add( 'move', framesNamesGene(symWindBladeSpr, 11, 14, "", 4), 25, true ); this.wb.animations.add('wind_slash', framesNamesGene(symWindBladeSpr, 15, 35, "", 4), 10 , true); this.wb.animations.add('wind_blade', framesNamesGene(symWindBladeSpr, 36, 44, "", 4), 24 , true ); g.camera.follow(this.wb); this.wb.animations.play("wind_slash");
Link to comment
Share on other sites

  • 2 years 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.

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.


  • Recently Browsing   0 members

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