jen Posted December 18, 2015 Share Posted December 18, 2015 In the example section there is something close to what I would likehttp://phaser.io/examples/v2/arcade-physics/sort-direction#gv You can move phaser man around with the keyboard and the veggies do not move due toc.body.immovableI would like this behavior but when dragging instead of by keyboard. When I change "player" to sprite.inputEnabled = true; sprite.input.enableDrag(true);The dragged player goes behind the veggies . I would like player to bump into the veggies as it works in the example just by dragging instead. Any thoughts? Link to comment Share on other sites More sharing options...
Tilde Posted December 19, 2015 Share Posted December 19, 2015 Do you have game.physics.arcade.collide(entity1, entity2) in the update loop? Link to comment Share on other sites More sharing options...
jen Posted December 21, 2015 Author Share Posted December 21, 2015 @WillTheSixth Yes I am just using the example http://phaser.io/exa...rt-direction#gv only adding the following code and hitting run: sprite.inputEnabled = true; sprite.input.enableDrag(true); What I want is the dragged player to hit the veggies like in the example above where this is achieved by keyboard input. Link to comment Share on other sites More sharing options...
drhayes Posted December 22, 2015 Share Posted December 22, 2015 Pretty sure if you're dragging directly then the position is getting set to the pointer's location instead of the sprite taking part in the physics world. Like, it's velocity is 0 even though the position is changing. You might try dragging an invisible sprite sitting on top of your player and setting the player's velocity so that it moves towards what you're dragging, see if that works and gives a good experience? Tilde and jen 2 Link to comment Share on other sites More sharing options...
Recommended Posts