Function outside loop effecting rotation speed!! ?

BlitzMax Forums/BlitzMax Beginners Area/Function outside loop effecting rotation speed!! ?

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.

Type ball

	Field x:Float ' Xposition
	Field y:Float 'Yposition
			
	Global Bspeed:Int = 0 ' ball speed
	Global dirLR:Int = 0 ' direction moving
	Global dist:Float = 0 ' distance from center
	Global angle:Float = 0 'angle for sin/cosin
	Global BXpos:Int = 400 'ball XOffset
	Global BYpos:Int = 300 ' BallYOffset
	Global rot:Float = 0 'Ball Roatation
	Global Maxballs = 11 ' Max Number Of balls
	Global tempAngleINC = 32 ' angle increment
	Global tempAngle:Int = 0
	
	Function generateBalls()
		
		For Local x:Int = 0 To 3
		Local b:ball = New ball
		b.x = 0
		b.y = 0
		ListAddLast ballList,(b)
		dist = 100
		Next
				
	End Function
	
	Method rotateBalls()
	
		x = BXpos+Sin(angle)*dist
		y = BYpos+Cos(angle)*dist
		
		angle:+1
		
		If angle >= 360 Then angle = 0
		
				
	End Method
	
	Method drawBalls()
		
		DrawImage bk1,0,0,0
		SetRotation(ballAngle)
		ballAngle:+5
		If ballAngle >= 360 Then ballAngle = 0
		DrawImage balls,x,y,ballFrame
		SetRotation(0)
		
	End Method
	
End Type

ball.generateBalls()

Repeat

	Cls
		
		
		
		For Local b:ball = EachIn ballList
		b.rotateBalls()
		b.drawBalls
		Next
			
	FlushMem
	Flip
	
Until KeyHit(KEY_ESCAPE)


Hi, The generateBalls() function generates 4 balls. I call the function outside the loop yet it still effects the speed at which the balls rotate and spin.

Any Ideas why It would be doing that?

If i remove the loop that creates extra balls:
	Function generateBalls()
		
		
		Local b:ball = New ball
		b.x = 0
		b.y = 0
		ListAddLast ballList,(b)
		dist = 100
		
				
	End Function



the rotation and spin speed remains how i want it but when I put the code below in it speeds everything up. :/

	Function generateBalls()
		
		For Local x:Int = 0 To 3
		Local b:ball = New ball
		b.x = 0
		b.y = 0
		ListAddLast ballList,(b)
		dist = 100
		Next
				
	End Function