Dim Throttle As Long
Dim Steering As Long
Dim Flip As Boolean
Dim LastFlipState As Boolean
'false = up true = down
If (LastFlipState = False) And (JoystickState.buttons(0) = 128) Then
End If
If (JoystickState.buttons(0) = 128) And (debounce = False) Then
shapeFlipInput.FillColor = &HFF00&
chkFlip.Value = vbChecked
debounce = True
Else
shapeFlipInput.FillColor = 0
End If
If (JoystickState.buttons(0) = 0) And (debounce = False) Then
shapeFlipInput.FillColor = &H0&
chkFlip.Value = False
debounce = True
Else
shapeFlipInput.FillColor = 0
End If
Throttle = StickX
Steering = StickY
If chkReverseSteering Then Steering = Steering * -1
If chkRevThrottle Then Throttle = Throttle * -1
If chkSROT And Throttle < 0 Then Steering = Steering - 1
Dim Diflection As Double
Dim Slowdown As Double
If JoystickState.buttons(11) = 128 Then
Shape1.FillColor = 255
Steering = Steering / 4
Else
Shape1.FillColor = 0
End If
Diflection = (Throttle / 32767) * 2
Slowdown = Diflection * Steering
If chkFlip Then
Steering = Steering * -1
Throttle = Throttle * -1
End If
'both = full forward
'StickX = StickX
'StickY = StickX
Select Case Steering
Case Is < 0 'left
StickX = Throttle
StickY = Throttle + Slowdown
Case Is > 0 ' right
StickY = Throttle
StickX = Throttle - Slowdown
Case Is = 0 ' straight
StickX = Throttle
StickY = Throttle
End Select
End If
There are no comments on this page. [Add comment]