Jump to content

input world coordinates


EyeKyu
 Share

Recommended Posts

Hi, so I'm new to Phaser and I've been trying to make a little game, I want the movement of the player something like the tank game, with the camera following except instead of using the arrows I'd like to use the touch/mouse input.

The input coordinates I'm getting back are relative to the canvas is there anyway to get this relative to the world instead.

 

Any help would be brilliant, I've tried a few different things but I can't seem to find a way around or any examples or existing games that do this. 

 

Also, what is the purpose of the game.camera.deadzone in the tank game?

Link to comment
Share on other sites

You probably want:

game.input.worldXgame.input.worldY

The deadzone is a rectangle inside of which the sprite doesn't cause the camera to scroll. When it hits the edge of the rectangle the camera will scroll, so you can resize this to create different sorts of effects, for example in a scrolling platform game you almost certainly don't want to only scroll the camera when the player hits the edge of the screen, so you'd make the deadzone smaller to accommodate.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...