Jump to content

spirte bounds position wrong


wusiquan
 Share

Recommended Posts

// ...
{
  // GameScene
  preload: function() {
    this.load.spritesheet('bird', 'bird.png', { frameWidth: 34, frameHeight: 24, endFrame: 3 })
    this.load.spritesheet('pipe', 'pipes.png', { frameWidth: 54, frameHeight: 320, endFrame: 2})
  },

  create: function() {
    let topPipe = this.pipes.create(200, -80, 'pipe', 0).setOrigin(0)
    let bototomPipe = this.pipes.create(200, 300, 'pipe', 1).setOrigin(0)
  }
}

let config = {
  type: Phaser.AUTO,
  parent: 'flappy-container',
  width: 320,
  height: 505,
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 100 },
      debug: true
    }
  },
  scene: [GameScene]
}

let game = new Phaser.Game(config)


I found there is some offset from the sprite to its bounds。。。It seems need call setSize() by hand ?

3F7666BC-F9EE-4C09-ADEB-89E928930634.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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