1 decade ago by Donzo
Hello good people:
I am coding a project that requires single touch inputs.
I have been using the following code, which I found here,
to handle input.
It has been working well in the desktop and phone browser.
It doesn't seem to respond in Ejecta, however.
How may I best modify this code in order to work in Ejecta?
Am I doing something wrong?
Is it because I am using the simulator and I do not have touch screen?
Must I use the touchbutton plugin for all input detection?
I have the input bound in the main.js file as such:
In the Entity Update( ) {
In the Entity File
I am coding a project that requires single touch inputs.
I have been using the following code, which I found here,
to handle input.
It has been working well in the desktop and phone browser.
It doesn't seem to respond in Ejecta, however.
How may I best modify this code in order to work in Ejecta?
Am I doing something wrong?
Is it because I am using the simulator and I do not have touch screen?
Must I use the touchbutton plugin for all input detection?
I have the input bound in the main.js file as such:
ig.input.bind( ig.KEY.MOUSE1, 'leftButton' );
In the Entity Update( ) {
if (ig.input.pressed('leftButton') && this.inFocus()) { //actions go here }
In the Entity File
inFocus: function() { return ( (this.pos.x <= (ig.input.mouse.x + ig.game.screen.x)) && ((ig.input.mouse.x + ig.game.screen.x) <= this.pos.x + this.size.x) && (this.pos.y <= (ig.input.mouse.y + ig.game.screen.y)) && ((ig.input.mouse.y + ig.game.screen.y) <= this.pos.y + this.size.y) ); },