nduhu Posted June 5, 2014 Share Posted June 5, 2014 how i can make image bounce in center place? var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });function preload() {game.load.image('flyer', 'assets/sprites/phaser-dude.png');}var image;function create() {game.physics.startSystem(Phaser.Physics.ARCADE);image = game.add.sprite(0, 0, 'flyer');game.physics.enable(image, Phaser.Physics.ARCADE);image.body.velocity.setTo(200,200);image.body.collideWorldBounds = true;image.body.bounce.set(1);}function update () {}function render () {game.debug.spriteInfo(image,32,32);} Link to comment Share on other sites More sharing options...
jpdev Posted June 5, 2014 Share Posted June 5, 2014 If I understand you correctly, then you just need to change image.body.width, image.body.height to fit you needs. (Use game.debug.body(sprite); in the render() function to see the phsyics-body). Use image.body.offset.x and image.body.offset.y to adjust the position. Link to comment Share on other sites More sharing options...
Recommended Posts