Gods Posted February 26, 2015 Share Posted February 26, 2015 http://codepen.io/anon/pen/qEKONO?editors=001I am trying to add controls so if the mouse is anywhere on the left side of the character the character goes to the left and vise vera I am following this example http://examples.phaser.io/_site/view_full.html?d=input&f=follow+mouse.js&t=follow%20mouseThe reason I want this is so it works on mobile. I copied the example and my game crashes :/ http://codepen.io/anon/pen/qEKONO?editors=001Is this because follow mouse can't only make a character move vertical? Link to comment Share on other sites More sharing options...
Dread Knight Posted February 26, 2015 Share Posted February 26, 2015 Ancient phaser version. Code not directly compatible.There's a migration guide, but it did jack shirt for mehttps://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md Link to comment Share on other sites More sharing options...
Gods Posted February 26, 2015 Author Share Posted February 26, 2015 hmm how would I go about making follow mouse to work with a platformer? I changed my example and don't know how to make it a platformer Link to comment Share on other sites More sharing options...
MikeT Posted February 26, 2015 Share Posted February 26, 2015 if (game.input.activePointer.isDown && player.sprite.x > game.input.activePointer.x) { player.sprite.body.velocity.x = -100;} else if (game.input.activePointer.isDown && player.sprite.x < game.input.activePointer.x) { player.sprite.body.velocity.x = 100;}I'm a very novice programmer, but maybe something like this? Gods 1 Link to comment Share on other sites More sharing options...
Recommended Posts