EyeKyu

input world coordinates

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.