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 lazer

I've just quickly ported my Impact project to Ejecta, but am having a problem with ig.input.mouse.x and ig.input.mouse.y.

I have a pointer entity that does this in the update function:

        update: function() {
            this.pos.x = ig.input.mouse.x;
            this.pos.y = ig.input.mouse.y;
        },

It then checks against other entities when the user taps using a mouse bind:

##
ig.input.bind( ig.KEY.MOUSE1, 'tap' );
##

I've tested printing "ig.input.mouse.x" and "ig.input.mouse.y" to the console and UNTIL I tap anywhere, they are "0,0" as they should be (which is where the pointer entity spawns). But as soon as I tap anywhere on the screen, I start seeing "NaN" for both in the console.

I thought maybe it had something to do with the screen scaling, but disabling it and setting the dimensions manually had the same problem so I'm not sure what to try next. Any ideas? It's working fine in the browser on my Mac.

1 decade ago by paulh

wrong info, sorry

1 decade ago by dominic

Bug in Ejecta. The touch event&039;s #clientX and clientY wasn&039;t defined, only #pageX and pageY - which is the exact same if you're not running in a browser, but Impact requires it.

Please get the current version from github. It should be fixed:
https://github.com/phoboslab/Ejecta

1 decade ago by lazer

Thanks, Dominic! I'll upgrade to the current version within the next couple of days and try again :)
Page 1 of 1
« first « previous next › last »