EDmouse Nunchuk Joys

From WiiLi

Jump to: navigation, search
//EDmouse Nunchuk Joys [by marsuten @gmail.com-any improvement is welcome]

//Variables
     var.minim = 0.08    //Joy sensibility
       var.top = 5       //Maximum speed( pixels/frame )
var.freezetime = 300 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
If var.active=True and var.freeze=false
Mouse.x=Smooth((1/(screen.Width/var.x)), 2)
Mouse.y=Smooth((1/(screen.Height/var.y)), 2)
Else
var.x = MapRange(Mouse.x, 0, 1, 1, screen.Width)
var.y = MapRange(Mouse.y, 0, 1, 1, screen.Height)
Endif

var.speedy=Smooth((abs(wiimote.Nunchuk.Joyy)*var.top))
var.speedx=Smooth((abs(wiimote.Nunchuk.Joyx)*var.top))
if (-var.minim<(wiimote.Nunchuk.Joyy or wiimote.Nunchuk.Joyx)<var.minim) then var.active=false else var.active=true

//Joys
If wiimote.Nunchuk.Joyy < -var.minim Then var.y=var.y-var.speedy
If wiimote.Nunchuk.Joyy > var.minim Then var.y=var.y+var.speedy
If wiimote.Nunchuk.Joyx < -var.minim Then var.x=var.x-var.speedx
If wiimote.Nunchuk.Joyx > var.minim Then var.x=var.x+var.speedx
Personal tools
Online Casino - best online casino reviews.
Facebook Developers - facebook applications, facebook developers, facebook development, social network application development and viral widget social media strategy