Game Timing

BlitzMax Forums/BlitzMax Programming/Game Timing

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Where do I apply the Delta Time multiplier:


'Calculate the length of the Speed Vector
		Local SpeedVectorLength# = sqr(m_fSpeedX*m_fSpeedX + m_fSpeedY*m_fSpeedY)
		
		If SpeedVectorLength > 0
			'Decrease Speed with Friction if we are moving
			m_fSpeedX:- (m_fSpeedX/SpeedVectorLength) * m_pTEngine.GetFriction() * TDelta.GetTime()
			m_fSpeedY:- (m_fSpeedY/SpeedVectorLength) * m_pTEngine.GetFriction() * TDelta.GetTime()
		Else
			m_fSpeedX=0
			m_fSpeedY=0
		EndIf
		
		Print TDelta.GetTime()
		
		If SpeedVectorLength > m_pTEngine.GetMaximumVelocity()
			'If we are going beyond the speed barrier then reduce our speed
			'with the amount in which it surpases TopSpeed
			m_fSpeedX:+ (m_fSpeedX/SpeedVectorLength)*(m_pTEngine.GetMaximumVelocity() - SpeedVectorLength) * TDelta.GetTime()
			m_fSpeedY:+ (m_fSpeedY/SpeedVectorLength)*(m_pTEngine.GetMaximumVelocity() - SpeedVectorLength) * TDelta.GetTime()
		EndIf
		
		If SpeedVectorLength > 0  
			m_fX:+ m_fSpeedX 
			m_fY:+ m_fSpeedY
		End If


	Method IncreaseVelocity()
		'Create a Acceleration Vector and
		'add it to the Speed Vector
		m_fSpeedX:+ Cos(m_fAngle) * m_pTEngine.GetAcceleration() * TDelta.GetTime()
		m_fSpeedY:+ Sin(m_fAngle) * m_pTEngine.GetAcceleration()  * TDelta.GetTime()			
	End Method