From WiiLi
//EDmouse Nunchuk Rawforces [by marsuten]
//Variables
var.topx = 9 //Maximum speed X <->
var.topy = 13 //Maximum speed Y /\-\/
var.death = 0,1 //Death zone where mouse works
var.rumble = true //Wiimote rumbles when reaches the end
var.freezetime = 400 ms
pie.FrameRate = 100 Hz //Leave between 60 and 100 Hz
//Buttons
mouse.LeftButton = nunchuk.ZButton
mouse.RightButton = nunchuk.CButton
//Freeze
var.freeze = KeepDown(Pressed(nunchuk.CButton or nunchuk.ZButton),var.freezetime)
//Mouse
//Movement and death zone
if var.active and not var.freeze
mouse.x=smooth((1/(screen.Width/var.x)), 1)
mouse.y=smooth((1/(screen.Height/var.y)), 1)
else
var.x = MapRange(Mouse.x, 0, 1, 1, screen.Width)
var.y = MapRange(Mouse.y, 0, 1, 1, screen.Height)
endif
var.active=not(var.rx>-var.death and var.rx<var.death and var.ry>-var.death and var.ry<var.death)
//Starts where is the pointer
if starting then var.x = MapRange(Mouse.x, 0, 1, 1, screen.Width)
if starting then var.y = MapRange(Mouse.y, 0, 1, 1, screen.Height)
//Rawforces to 1,-1
var.rx=(maprange( Nunchuk.smoothroll, 90, -90, 1 , -1))
var.ry=(maprange( Nunchuk.smoothpitch, 90, -90, -1 , 1))
//Multiply rawforces
var.x=var.x+smooth(var.rx*var.topx)
var.y=var.y+smooth(var.ry*var.topy)
//Rumble
if var.rumble and var.active then wiimote.Rumble = KeepDown(Pressed(var.x<0 or var.y<0 or var.x>screen.Width or var.y>screen.Height),80 ms)
//Limits
if var.x> screen.Width then var.x=screen.Width
if var.y> screen.Height then var.y=screen.Height
if var.x<0 then var.x=0
if var.y<0 then var.y=0