Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
Phaser Game Keyboard .addKey Enter or Mobile Touch

How to add both options like Enter or Mobile touch to start

this.enter = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ENTER); 

Or

this.enter = this.input.on('pointerdown', this);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Depending on what you want the result to be, you could:

create one function, that handles both events:

function doAction(){
   alert('action')
}

and then reference the same function in the event listeners, of both actions:

this.enter = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ENTER); 
this.enter.on('down', doAction);

// ... AND

this.input.on('pointerdown', doAction);

Update: If you want to, check what device type the app is being run, you could use the information of this.sys.game.device.os (link to documenation )

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!