RoboWars Australia Wiki : PlannersCarMixer

RobowarsWikka1 :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
This is an old revision of PlannersCarMixer from 2006-02-06 22:43:06.
If chkMixing Then
	'stickx = steering
	' y = throttle
	' work out diflection from centre on steering as a percentage
	' multiply by throttle
	' add to correct side
	' cases 0 steering
	' left
	' right
	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]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.0145 seconds