Posted: 28th Feb 2014 05:52
BatVink, thanks for the comments (I'm not comfortable with knowing who won before the start of the race tho!). Will not explore collisions now. The finish lane is in fact moving backwards(left) as the horses are moving forwards (right).
I couldn't see how to attach the project file here so anyone who wanted too could run the program - but here is the code
set display mode 1280,720,16
set window size 1000,600
set image colorkey 00,00,00
red=0:yellow=0:blue=0:green=0:brown=0:pink=0
bkx1=0:bkx2=0:dsp=0:in=0:cnt=0:finflag=0
st= timer()
RANDOMIZE st
load image "11.bmp",11:load image "12.bmp",12:load image "13.bmp",13:load image "14.bmp",14
load image "15.bmp",15:load image "16.bmp",16:load image "17.bmp",17:load image "18.bmp",18
load image "21.bmp",21:load image "22.bmp",22:load image "23.bmp",23:load image "24.bmp",24
load image "25.bmp",25:load image "26.bmp",26:load image "27.bmp",27:load image "28.bmp",28
load image "31.bmp",31:load image "32.bmp",32:load image "33.bmp",33:load image "34.bmp",34
load image "35.bmp",35:load image "36.bmp",36:load image "37.bmp",37:load image "38.bmp",38
load image "41.bmp",41:load image "42.bmp",42:load image "43.bmp",43:load image "44.bmp",44
load image "45.bmp",45:load image "46.bmp",46:load image "47.bmp",47:load image "48.bmp",48
load image "51.bmp",51:load image "52.bmp",52:load image "53.bmp",53:load image "54.bmp",54
load image "55.bmp",55:load image "56.bmp",56:load image "57.bmp",57:load image "58.bmp",58
load image "61.bmp",61:load image "62.bmp",62:load image "63.bmp",63:load image "64.bmp",64
load image "65.bmp",65:load image "66.bmp",66:load image "67.bmp",67:load image "68.bmp",68
load image "back01.bmp",7:load image "fence.bmp",8:load image "finish.bmp",9
load image "furlong1.bmp",1:load image "furlong2.bmp",2:load image "furlong3.bmp",3
load image "furlong4.bmp",4:load image "furlong5.bmp",5:load image "finish.bmp",6
maximize window
sync
do
for horse= 1 to 8 rem selects sequentual images for animation of horses
for dsp= 1 to 30 rem adjusts animation speed + allows time slots for adjusting horses screen poition
if red>1000 then red =1000 rem prevents horses from running off screen
if yellow>1000 then yellow =1000 rem " " "
if blue>1000 then blue =1000 rem " " "
if green>1000 then green =1000 rem " " "
if brown>1000 then brown =1000 rem " " "
if pink>1000 then pink =1000 rem " " "
paste image 7,bkx1,0: paste image 7,bkx2,0 rem scrolls background left
paste image 8,bkx1,110,1:paste image 8,bkx2,110,1 rem scrolls rear fence
if cnt=12 then paste image 6,bkx2-39,16,1 rem displays finish line
if cnt=2 then paste image 5,bkx2-39,40,1 rem displays 5 furlong post
if cnt=4 then paste image 4,bkx2-39,40,1 rem displays 4 furlong post
if cnt=6 then paste image 3,bkx2-39,40,1 rem displays 3 furlong post
if cnt=8 then paste image 2,bkx2-39,40,1 rem displays 2 furlong post
if cnt=10 then paste image 1,bkx2-39,40,1 rem displays 1 furlong post
paste image 10+horse,red,90,1 rem draws individual animation horse frames
paste image 20+horse,yellow,170,1 rem " " "
paste image 30+horse,blue,250,1 rem " " "
paste image 40+horse,green,330,1 rem " " "
paste image 50+horse,brown,410,1 rem " " "
paste image 60+horse,pink,490,1 rem " " "
paste image 8,bkx1,570,1:paste image 8,bkx2,570,1 rem draws front fence
wait 1
dec bkx1: bkx2=bkx1+1280 rem decreases x axis
if bkx1=-1280 then bkx1=0:inc cnt rem resets x axis + counts screens
q=rnd(17)+1
if dsp>28 then gosub min rem adust poition of one horse
if dsp<4 then gosub posadj rem adjusts horse position of 2 horses
next dsp
if count =1 then col=18 + rnd(20)+1 rem selects which 2 horse(s) will be moved in posadj:
inc count:if count=25 then count=0 rem prevents col being changed too rapidly
gosub posadj rem adjusts horse position of 2 horses
next horse
n=rnd(5)+1 rem selects indivual horse for min:
loop
posadj:
q=rnd(1)
if cnt>11 then q=1
if col =19 then inc red
if col =20 then inc yellow
if col =21 then inc blue
if col =22 then inc green
if col =23 then inc brown
if col =24 then inc pink
if col= 25 and q=1 then inc red: inc yellow
if col= 26 and q=1 then inc red: inc blue
if col= 27 and q=1 then inc red:inc green
if col= 28 and q=1 then inc red:inc brown
if col= 29 and q=1 then inc red:inc pink
if col= 30 and q=1 then inc yellow:inc blue
if col= 31 and q=1 then inc yellow: inc green
if col= 32 and q=1 then inc yellow:inc brown
if col= 33 and q=1 then inc yellow:inc pink
if col= 34 and q=1 then inc blue:inc green
if col= 35 and q=1 then inc blue:inc brown
if col= 36 and q=1 then inc blue:inc pink
if col= 37 and q=1 then inc green:inc brown
if col= 38 and q=1 then inc green:inc pink
if col= 39 and q=1 then inc brown:inc pink
return
min:
if n=1 then inc red
if n=2 then inc yellow
if n=3 then inc blue
if n=4 then inc green
if n=5 then inc brown
if n=6 then inc pink
return
BatVink, thanks for the comments (I'm not comfortable with knowing who won before the start of the race tho!)