Jump to content

Touch position troubles


Naylo
 Share

Recommended Posts

Hello,

 

I'm new to Phaser and I really enjoy it.

I made a game which uses keyboard and it works well.

 

I now have some troubles trying to use the touch events on my smartphone.

I want to get my finger's position and tried in the create() function :

 

pointer = game.input.addPointer();

 

Then in the update() function :

 

game.input.onDown.add(doSomething, this);

 

function doSomething(pointer){

debugText.text = game.input.pointer1.clientX;
}

 

But it constantly gives me -1. How can in get my finger's position ?

Link to comment
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...
 Share

  • Recently Browsing   0 members

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