Sign in to follow this  
andrei.nicolae

Group set origin

Recommended Posts

Hi guys,

How can you change the anchor of a sprite inside a group?

For a sprite outside the group I use this.add.sprite(100,100, 'sprite').setOrigin(0,0);

I tried the next code but It didn't work            

leprosy = this.add.group([{
                    key: '001_leprosy',
                    setXY: {
                        x: 444,
                        y: 115
                    }, 

                    setOrigin {x:0, y:0}
                }
            ]);

Any ideas?

Thanks.

Share this post


Link to post
Share on other sites
this.enemies = this.physics.add.group({
  key: 'tai_fighter1',
  createMultiple: 5,
  enableBody: true,
  physicsBodyType: Phaser.Physics.ARCADE,
  frame: 4,
  angle: 180,
  checkWorldBounds: true,
  outOfBoundsKill: true
})

Phaser.Actions.setOrigin(this.enemies.getChildren(), -0.7, -0.7)

could you change the origin the same way i scale each child of a group ?????

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.