Rafaelx Posted August 18, 2016 Share Posted August 18, 2016 Hey guys so I have a sprite loaded by an atlas, I'm not able to make it move or applied physics to it, please see code bellow: Can anyone tell me what did I do wrong? Basically all I get is the sprite and not moving in the edge of the screen. //I load here: this.load.atlas('Monsters', 'images/monsters.png', 'images/monsters.json'); /////////timer to initiilize this.timerFiguras = this.time.events.loop(1000, this.makeFiguras, this); /////////// below that 2 functions makeOneFigura: function() { this.figurai = this.game.add.sprite(0, 450, 'Monsters', this.rnd.integerInRange(0,4)); this.figura = this.game.add.group(); this.figura.enableBody = true; this.game.physics.p2.enable(this.figura, false); this.figura.add(this.figurai); this.figura.setAll('anchor.x', 0.5); this.figura.setAll('anchor.y', 0.5); this.figura.setAll('outOfBoundsKill', true); this.figura.setAll('checkWorldBounds', true); }, makeFiguras: function(){ this.figuras = this.figura.getFirstExists(false); if (this.figuras) { this.figuras.reset(0, 450); this.figuras.body.velocity.x = 1000; } }, Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2016 Share Posted August 18, 2016 Did you call this line in your `create` function? `game.physics.startSystem(Phaser.Physics.P2JS);` Link to comment Share on other sites More sharing options...
Rafaelx Posted August 19, 2016 Author Share Posted August 19, 2016 Yes I did, I assume everything else looks correct then? Link to comment Share on other sites More sharing options...
Rafaelx Posted August 22, 2016 Author Share Posted August 22, 2016 Hello? Link to comment Share on other sites More sharing options...
Recommended Posts