Jump to content

Input probleme


AbdSab
 Share

Recommended Posts

Hi all i have another problem

 

I want to know how to do a function in loop while touching on the screen

 

i tried

 

 

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

 

and

 

 

 

if (this.game.input.isDown == true){this.fly();}

 

but the function is executed jump one time is there any solution ??

 

And thank's :)

Link to comment
Share on other sites

not sure why you want to fire a fly function over and over again based on an event being down. You should probably look at it this way. When the button is pressed set flying = true, when the press is done set flying = false. Your main loop will look for flying == true and make the character fly or whatever its suppose to do. Mouse and touch events can fire more or less times than the main loop because the browser is running them separately.

Link to comment
Share on other sites

 

Where are you putting the second snippet you posted...?

 

Also, [code] tags instead of [quote] tags for code...
 

I'm sorry i didn't pay attention to this i will fix, thank you :)

 

 

 

not sure why you want to fire a fly function over and over again based on an event being down. You should probably look at it this way. When the button is pressed set flying = true, when the press is done set flying = false. Your main loop will look for flying == true and make the character fly or whatever its suppose to do. Mouse and touch events can fire more or less times than the main loop because the browser is running them separately.

 

Thank you for very much it work fine now  :D

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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