kriket Posted August 4, 2015 Share Posted August 4, 2015 Basically, I have physics and collision enabled on my player and another sprite (log). In create(), this.log = this.game.add.sprite(750, 600, 'obstacles', 'log.png'); this.logTween = this.add.tween(this.log).to( { y: 100 }, 2000, "Linear", true, 0, -1, true); this.game.physics.arcade.enable(this.log); this.log.body.immovable = true; this.player = this.game.add.sprite(this.game.width/2, this.game.height/2, 'player', 'front.png'); this.player.scale.setTo(0.5, 0.5); this.game.physics.arcade.enable(this.player); this.player.body.gravity.y = 500;And in update function, this.physics.arcade.collide(this.player, this.log); I expected the player to stand on the moving log, but he passes right through. There's a little collision but he never stands on the log. Always passes through. Link to comment Share on other sites More sharing options...
AzraelTycka Posted August 4, 2015 Share Posted August 4, 2015 Hello, try to comment your tween and check whether the collision works. Tweens and physics are not the best friends. Link to comment Share on other sites More sharing options...
kriket Posted August 4, 2015 Author Share Posted August 4, 2015 Hello, try to comment your tween and check whether the collision works. Tweens and physics are not the best friends. yeah then it works. But I have to tween.yoyo this log. And other assets that are moving back-n-forth. If I try to move a physics-enabled Sprite and also set body.moves to false, will that take care of artefacts? Link to comment Share on other sites More sharing options...
AzraelTycka Posted August 4, 2015 Share Posted August 4, 2015 Well just try it don't ask ;-). Otherwise you'll have to solve it a different way. You can always set your set your own collision with phaser functions (check examples) or just your own. You can just use physics on your log too and let it move with velocity. kriket 1 Link to comment Share on other sites More sharing options...
Recommended Posts