AbdSab Posted December 16, 2014 Report Share Posted December 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
XekeDeath Posted December 16, 2014 Report Share Posted December 16, 2014 Where are you putting the second snippet you posted...? Also, [code] tags instead of [quote] tags for code... AbdSab 1 Quote Link to comment Share on other sites More sharing options...
ericjbasti Posted December 16, 2014 Report Share Posted December 16, 2014 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. AbdSab 1 Quote Link to comment Share on other sites More sharing options...
AbdSab Posted December 16, 2014 Author Report Share Posted December 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.