Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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:

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)
    );
 },

1 decade ago by mimik

http://impactjs.com/ejecta/integrating-impact-games#touch-buttons

1 decade ago by Donzo

I would like to thank Graphikos for solving this problem for me.

If you are having a similar issue and found this thread on a search,
try one of the solutions posted here:

http://impactjs.com/forums/impact-engine/ig-ua-touchdevice-fails-on-ipad-built-with-ejecta
Page 1 of 1
« first « previous next › last »