Code: Select all
'some useful defines
Const Pi = 4 * Atn(1)
Dim Shared As Double TwoPi = 8 * Atn(1)
Dim Shared As Double RtoD = 180 / Pi ' radians * RtoD = degrees
Dim Shared As Double DtoR = Pi / 180 ' degrees * DtoR = radians
screenres 800,480,32
color rgb(0,0,0),rgb(255,255,255):cls
dim as integer x,y,d,f,dd,ss
ss = 50
dd = 10
d = 10 ' leg stretch
x = 20 ' x center of ant
y = 100 ' y center of ant
f = -1 ' swing direction back and forth
do
screenlock
cls
'draw lines to see position of end of legs
for i as integer = 0 to 600 step 10
line (i,0)-(i,480),rgb(200,200,0)
next i
'draw ant segments
circle (x-40,y),15,rgb(0,0,0),,,.6,f
circle (x-20,y),8,rgb(0,0,0),,,,f
circle (x,y),12,rgb(0,0,0),,,,f
circle (x+20,y),8,rgb(0,0,0),,,,f
circle (x+40,y),12,rgb(0,0,0),,,,f
' Draws nippers
Circle (x+63,y), 10, rgb(0,0,0),DtoR * 90, DtoR * 270,.6
Circle (x+63,y), 9, rgb(0,0,0),DtoR * 90, DtoR * 270,.6
'draw antennae
Circle (x+63,y), 29, rgb(0,0,0),DtoR * 90, DtoR * 270,.5
Circle (x+63,y), 28, rgb(0,0,0),DtoR * 90, DtoR * 270,.5
'draw eyes
circle (x+40,y-8),1,rgb(255,255,0),,,,f
circle (x+40,y+8),1,rgb(255,255,0),,,,f
' *** draw red tripod legs ***
'TOP center leg
line (x,y-8)-(x+d,y-ss),rgb(255,0,0)
circle (x+d,y-ss),3,rgb(255,0,0),,,,f
circle (x,y-8),3,rgb(255,0,0),,,,f
'bottom front leg
line (x+20,y+8)-(x+d+20+dd,y+ss),rgb(255,0,0)
circle (x+d+20+dd,y+ss),3,rgb(255,0,0),,,,f
circle (x+20,y+8),3,rgb(255,0,0),,,,f
'bottom back leg
line (x-20,y+8)-(x+d-20-dd,y+ss),rgb(255,0,0)
circle (x+d-20-dd,y+ss),3,rgb(255,0,0),,,,f
circle (x-20,y+8),3,rgb(225,0,0),,,,f
' *** draw blue tripod legs ***
'BOTTOM CENTER leg
line (x,y+8)-(x-d,y+ss),rgb(0,0,255)
circle (x-d,y+ss),3,rgb(0,0,255),,,,f
circle (x,y+8),3,rgb(0,0,255),,,,f
'TOP BACK LEG
line (x-20,y-8)-(x-20-d-dd,y-ss),rgb(0,0,255)
circle (x-20-d-dd,y-ss),3,rgb(0,0,255),,,,f
circle (x-20,y-8),3,rgb(0,0,255),,,,f
'TOP FRONT LEG
line (x+20,y-8)-(x+20-d+dd,y-ss),rgb(0,0,255)
circle (x+20-d+dd,y-ss),3,rgb(0,0,255),,,,f
circle (x+20,y-8),3,rgb(0,0,255),,,,f
screenunlock
d = d + f
if d >= 10 or d <= -10 then
f = -f 'flip direction of legs
end if
'move ant one pixel right wrap around if > 480
x = x + 1
if x >= 480 then x = 20
sleep 20
loop until multikey(&H01)