Chtull Posted July 7, 2018 Share Posted July 7, 2018 (edited) Hello, I'm playing around with the phase3 tutorial. My intention is to have a moving object, that is not affected by gravity (or has a different gravity). I’m not that good with javascript, therefore it is most likely a stupid failure, but maybe someone can correct me? Here’s the code example: var config = { type: Phaser.AUTO, width: 800, height: 600, physics: { default: 'arcade', arcade: { gravity: { y: 300 }, debug: false } }, scene: { preload: preload, create: create, update: update } }; var star; var game = new Phaser.Game(config); function preload () { this.load.image('sky', 'assets/sky.png'); this.load.image('star', 'assets/star.png'); } function create () { this.add.image(400, 300, 'sky'); star = this.physics.add.sprite(100, 450, 'star'); star.setGravity(0,0); } function update () { } Why is the star still affected by gravity? Thank you so much for checking, Chtull Edited July 7, 2018 by samme format Link to comment Share on other sites More sharing options...
samme Posted July 7, 2018 Share Posted July 7, 2018 star.body.setAllowGravity(false) Link to comment Share on other sites More sharing options...
Recommended Posts