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:
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.
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.