I have not examined your code, unfortunately, but here is an example I have just coded. I hope that it gives you some ideas.
Graphics 640,480,32,2
Dim ccos#(360),ssin#(360)
For a = 0 To 359
ccos#(a) = Cos(a)
ssin#(a) = Sin(a)
Next
angle = 0
scale# = 3.0
SetBuffer BackBuffer()
While Not KeyHit(1)
drawRotRect( 120,240, -20,-20, 20,-20, 10,20, -10,20, 3.0, angle, 255,0,0 )
drawRotRect( 320,240, -20,-20, 20,-20, 20,20, -20,20, scale#, angle2, 0,255,0 )
drawRotRect( 520,240, -10,-20, 10,-20, 20,20, -20,20, 3.0, angle, 0,0,255 )
If newpart + 15 <= MilliSecs() Then
angle = angle + 2
If angle > 359 Then angle = angle - 360
angle2 = angle2 - 2
If angle2 < 0 Then angle2 = angle2 + 360
scale# = 3.0 + Sin( angle ) * 1.5
newpart = MilliSecs()
End If
Flip
Cls
Wend
End
Function drawRotRect( x,y, x1,y1, x2,y2, x3,y3, x4,y4, scale#, rot, r,g,b )
xx1 = x + ((ccos#(rot) * x1) - (ssin#(rot) * y1)) * scale#
xx2 = x + ((ccos#(rot) * x2) - (ssin#(rot) * y2)) * scale#
xx3 = x + ((ccos#(rot) * x3) - (ssin#(rot) * y3)) * scale#
xx4 = x + ((ccos#(rot) * x4) - (ssin#(rot) * y4)) * scale#
yy1 = y + ((ssin#(rot) * x1) + (ccos#(rot) * y1)) * scale#
yy2 = y + ((ssin#(rot) * x2) + (ccos#(rot) * y2)) * scale#
yy3 = y + ((ssin#(rot) * x3) + (ccos#(rot) * y3)) * scale#
yy4 = y + ((ssin#(rot) * x4) + (ccos#(rot) * y4)) * scale#
Color r,g,b
Line xx1,yy1, xx2,yy2
Line xx2,yy2, xx3,yy3
Line xx3,yy3, xx4,yy4
Line xx4,yy4, xx1,yy1
End Function
I have used arrays for the sin and cos data, but you could also just use the sin() and cos() functions directly if you wanted to.