gen10do Posted November 10, 2020 Share Posted November 10, 2020 Hello All, And thank you in advance for any assistance. I am trying to make a shoot em up for mobile where as players "slide" or "swipe their finger on their screen it moves the player character. There are several shooters that can be found on the Google Play Store. Mostly of the top down scroller space shooter variety. Currently I am able to make it so that the player character sprite will follow the players finger or thumb when they "slide" or "swipe" on their screen with the following code: if (!this.player.getData("isDead")) { this.input.on('pointermove', function (pointer) { this.player.x = pointer.x + 80; this.player.y = pointer.y; this.player.setData("isShooting", true); }, this); } This works pretty smoothly in the update function of the update function of the phase 3 game loop. However, I would like for players to be able to have the option of controlling their character a different way where the player character sprite does not track to the players finger or thumb, but rather to move the sprite from it's current position independent of where the player's finger starts and finishes it's "swipe" or "slide". Is there a simple way to do this? Any help would be greatly appreciated. Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.