Still doing the same thing,heres the whole code if
that helps any:
It should run ive removed the graphic loading & drawing stuff.
The function shotangle draws the line & uses sin & cos
;***fielder testing*************
Graphics 640,480,16
SetBuffer BackBuffer()
Dim field1%(2),xfield%(15,11),yfield%(15,11)
Dim game%(19,1),history%(2,5),game_results(18,1)
;Global pitch_graphic = LoadImage("pitch2.png")
;Global fielder = LoadImage("fielder.png")
Global rnd1
Global x,y,angle,distance
;***READ FIELD POSITIONS***
;Gosub readfield
;***Draw pitch*************
m=0
While m<10
Cls
;DrawBlock pitch_graphic ,0,78
;** Destination in screen coordinates**
Text 10,10,"X="+x
Text 10,20,"y="+y
For i%=1 To 11
Color 202,20,20
;PCIRCLE xfield%(n%,i%),yfield%(n%,i%),1
;Oval 2*xfield%(n%,i%),2*yfield%(n%,i%),10,10,1
;DrawImage fielder,2*xfield%(8,i%),(2*yfield%(8,i%))+26,0
Next
rand1(6)
r=rnd1
rand1(90)
shotangle(rnd1,r)
Flip
VWait
Delay 1000
m=m+1
Wend
WaitKey
End
;/***random numbers**/
Function rand1(n)
rnd1=Rand(0,n)
End Function
Function shotangle(angle%,distance%)
If distance>3 distance=distance*30
If distance<4 Then distance=distance*25
;;limit distance;;
If angle%>-1 And angle%<12 And distance%>105 Then distance%=105
If angle%>11 And angle%<18 And distance%>90 Then distance%=90
If angle%>17 And angle%<26 And distance%>82 Then distance%=82
If angle%>25 And angle%<33 And distance%>68 Then distance%=68
If angle%>32 And angle%<59 And distance%>60 Then distance%=60
If angle%>58 And angle%<63 And distance%>70 Then distance%=70
If angle%>62 And angle%<79 And distance%>92 Then distance%=92
If angle%>78 And angle%<91 And distance%>105 Then distance%=105
distance=distance*2
Color 255,255,255
Line 164,188,164+Sin(angle*4)*distance,188+Cos(angle*4)*distance
Color 200,200,200
x=164+(Sin(angle*4)*distance)
y=188+(Cos(angle*4)*distance)
End Function
;**FIELD POSITIONS**
.readfield
Restore positions
For a=1 To 15
For i=1 To 11
Read xfield(a,i),yfield(a,i)
Next
Next
.positions
;''normal 1''
Data 74,69,66,112,26,72,53,34,119,72,120,111
Data 47,144,102,142,57,60,6,113,100,42
;''normal 2''
Data 74,69,66,112,24,56,58,58,109,99,7,103
Data 126,69,90,35,116,140,35,126,77,159
;''normal 3''
Data 74,69,66,112,43,51,22,81,26,123,46,150
Data 93,36,101,93,128,59,121,144,86,139
;''normal 4''
Data 74,69,66,112,59,64,98,45,128,81,120,128,85,157
Data 101,96,38,150,45,106,23,75
;''normal 5''
Data 74,69,66,112,63,60,128,74,98,37,134,121,99,149
Data 18,119,53,97,51,147,110,99
;''attack 1''
Data 74,69,66,112,63,61,53,57,55,89,99,100
Data 97,45,119,76,45,131,111,148,31,73
;''attack 2''
Data 74,69,66,112,47,95,106,96,63,61,54,58
Data 121,71,27,71,43,135,102,134,94,52
;''attack 3''
Data 74,69,66,112,64,63,56,58,99,78,115,103
Data 101,129,37,74,57,91,24,113,51,139
;''attack 4''
Data 74,69,66,112,63,61,58,83,88,82,104,60
Data 26,70,25,103,44,133,119,104,96,144
;''attack 5''
Data 74,69,66,112,62,62,40,79,49,103,100,77
Data 88,97,129,121,51,138,100,142,98,52
;''defend 1''
Data 74,69,66,112,18,79,136,76,48,41,97,37
Data 14,114,30,139,126,110,100,124,64,153
;''defend 2''
Data 74,69,66,112,105,43,121,74,138,99,118,115
Data 108,152,56,138,31,118,35,74,50,48
;''defend 3''
Data 74,69,66,112,53,43,35,66,13,93,24,129
Data 55,147,118,52,129,84,102,104,102,154
;''defend 4''
Data 74,69,66,112,10,77,124,75,52,33,106,40
Data 30,105,33,143,69,162,123,107,100,136
;''defend 5''
Data 74,69,66,112,101,36,130,73,121,101,124,141
Data 88,153,38,150,16,114,23,73,51,53
Return