wusiquan Posted June 1, 2018 Share Posted June 1, 2018 // ... { // 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 ? Link to comment Share on other sites More sharing options...
wusiquan Posted June 1, 2018 Author Share Posted June 1, 2018 Link to comment Share on other sites More sharing options...
wusiquan Posted June 3, 2018 Author Share Posted June 3, 2018 this codepen reflect my problem https://codepen.io/wsqviva/pen/pKgJaR Link to comment Share on other sites More sharing options...
prob Posted June 4, 2018 Share Posted June 4, 2018 Can you just remove the setOrigin? Link to comment Share on other sites More sharing options...
RollinSafary Posted June 4, 2018 Share Posted June 4, 2018 by default, Phaser.GameObjects.GameObject, from which extends other game objects in Phaser 3, has origin set to 0.5, but the graphics hasn't origin, so in the same position you'll see different bounds Link to comment Share on other sites More sharing options...
wusiquan Posted June 5, 2018 Author Share Posted June 5, 2018 Thank you for your answer. I updated the pen, and found two way, one way, as prob said Quote just remove the setOrigin. the other, like the pen showed, add physics for GameObject later Link to comment Share on other sites More sharing options...
Recommended Posts