9 years ago by ComitOne
I'm trying to move a cursor tile like a pointer using ig.input.accel x/y info i'm getting back from Siri remote's accelerometer. I can successfully get the cursor to move smoothly in the direction I'm pointing the remote in, but movement is slow an not 1:1 between my hand movement and cursor position on screen. Here's what I have so far:
Can anyone help?
cursor: null, cursorX: 0.0, cursorY: 0.0, init: function( ) { this.cursor = new tpf.HudTile( this.cursorImage, 0, 128, 128 ); // Start with cursor centered this.cursorX = ig.system.width / 2 this.cursorY = ig.system.height / 2 }, draw: function( ) { this.cursor.draw() if( ig.input.accel ) { this.cursorX += (ig.input.accel.x); this.cursorY += (ig.input.accel.y); this.crosshair.setPosition( this.crosshairX, this.crosshairY); } }
Can anyone help?