eguneys Posted June 15, 2014 Share Posted June 15, 2014 I am trying to build a similar game to gemmatch http://phaser.io/examples/_site/view_full.html?d=games&f=gemmatch.js&t=gemmatch In the example it creates tweens for each gem movement. Is it a good idea to do this every move, or should i use physics instead? Link to comment Share on other sites More sharing options...
lewster32 Posted June 15, 2014 Share Posted June 15, 2014 Use tweens when you want exact, precise control over movements. Use physics when you want realistic and potentially 'emergent' behaviour - i.e. things behaving unpredictably; not what you usually want in a puzzle game. Link to comment Share on other sites More sharing options...
eguneys Posted June 15, 2014 Author Share Posted June 15, 2014 Thanks for reply, i will use tweens. I have two quick questions. 1. Is it okay if i add onComplete event to a tween if autoStart is set to true. I mean tween wouldn't just finish before i add the onComplete event.2. Now i am using tweens is there a way to exclude physics from phaser. I tried phaser-no-lib.js in custom build folder but i guess it also includes physics. Link to comment Share on other sites More sharing options...
lewster32 Posted June 15, 2014 Share Posted June 15, 2014 1. Adding onComplete is fine if autoStart is true, as the complete event isn't called until the end of the tween.2. I'd probably suggest using phaser-arcade-physics.js in the build/custom folder, as you may still wish to use bodies with arcade overlap to do fast collision detection. Just make sure if you enable physics on an object that you immediately set body.moves = false so you take control of the sprite away from the physics velocity calculations. Link to comment Share on other sites More sharing options...
Recommended Posts