MisterMaSK Posted December 28, 2013 Share Posted December 28, 2013 so i am creating a player sprite and an enemy spriteand then i am adding a tween to the enemy like this - this.add.tween(this.enemy).to({ x: 300 }, 2000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);then i add a collision callback - this.physics.collide(this.enemy, this.player, this.player_die, null, this);the player_die function simply kills the player sprite. but when i test it, if the player simply goes in between the path of the tween and stays still, the player_die function is not called.the enemy just goes through the player and nothing happens.but if the player is moving while coming in contact with the enemy, then the player_die function is called can i make the check work everytime and not just when the player is moving? Link to comment Share on other sites More sharing options...
XekeDeath Posted December 28, 2013 Share Posted December 28, 2013 Collisions only work if you are using physics. Tweens do not use physics.For something to collide, one of the objects needs to have a velocity != 0; If you want to use tweens, try using overlap instead of collide. Link to comment Share on other sites More sharing options...
rich Posted December 29, 2013 Share Posted December 29, 2013 Yes true, a lot of people are asking for this though so it's something we plan on looking at soon (or just show examples of tweeting physics properties) Link to comment Share on other sites More sharing options...
MisterMaSK Posted December 29, 2013 Author Share Posted December 29, 2013 ok thanks a lot....ill try checking for overlap Link to comment Share on other sites More sharing options...
Recommended Posts