REM OB Sports: Shepard 2008 DIM player#(5,3) : `six players pa=0 : px=1 : py=2 : ps=3 `AIs start for p = 1 to 5 player#(p,px)= rnd(600)+20 player#(p,py)= rnd(440)+20 player#(p,pa)= rnd(359) player#(p,ps)= p*0.5 next p `user start player#(0,px)= 320 player#(0,py)=240 player#(0,pa)=0 player#(0,ps)=3 it=0 : `user starts as "it" white= 65536*255 + 256*255 + 255 yellow=65536*255 + 256*220 dgreen=256*128 hide mouse sync on DO `control if leftkey()= 1 then player#(0,pa)= wrapvalue(player#(0,pa)+6) if rightkey()= 1 then player#(0,pa)= wrapvalue(player#(0,pa)-6) if upkey()= 1 then move_player(0) `calculate for p= 0 to 5 if p>0 then pp= 10 else pp=0 if player#(p,px)< 20+pp then player#(p,px)= 20+pp if player#(p,py)< 20+pp then player#(p,py)= 20+pp if player#(p,px)> 620-pp then player#(p,px)= 620-pp if player#(p,py)> 460-pp then player#(p,py)= 460-pp if p> 0 if p<>it rem they chase you player#(p,pa)= ATANFULL(player#(it,px)-player#(p,px), player#(it,py)-player#(p,py)) if dist(p,it)< 80 player#(p,pa)= ATANFULL(player#(p,px)-player#(it,px), player#(p,py)-player#(it,py)) else c= rnd(359) player#(p,pa)= ATANFULL(320+sin(c)*30-player#(p,px), 240+cos(c)*30-player#(p,py)) endif if ABS(dist(p,it)-80) > 5 then move_player(p) : `if AI is either side of distance boundary then move endif endif next p `display for p= 0 to 5 if it= p then ink yellow,0 else ink white,0 px1= player#(p,px) : py1= player#(p,py) px2= px1+sin(player#(p,pa))*12 : py2= py1+cos(player#(p,pa))*12 circle px1,py1,8 line px1,py1,px2,py2 next p sync cls dgreen LOOP FUNCTION move_player(p) pa=0 : px=1 : py=2 : ps=3 player#(p,px)= player#(p,px)+sin(player#(p,pa))*player#(p,ps) : player#(p,py)= player#(p,py)+cos(player#(p,pa))*player#(p,ps) ENDFUNCTION FUNCTION dist(p1,p2) pa=0 : px=1 : py=2 : ps=3 p1x= player#(p1,px) : p1y= player#(p1,py) p2x= player#(p2,px) : p2y= player#(p2,py) dx= p1x-p2x dy= p1y-p2y d= SQRT( (dx*dx)+(dy*dy) ) ENDFUNCTION d