watcha'
"far fetched football". a wip
randomize timer()
set display mode 800,600,16
set window on
set window size 800,600
set window position 100,100
set window title "Here we go!"
`
sync rate 120 : sync on
set text size 44
set text font "comic sans"
ink rgb(0,255,0),0
text 0,0,"BOLTON"
text 0,45,"WANDERERS"
get image 1,0,0,320,90
cls 0
text 0,0,"MANCHESTER"
text 0,45,"UNITED"
get image 2,0,0,320,90
cls 0
` load the bolton team
load object "b1.x",1
position object 1,-305,70,b1z#
load object "b1.x",2
b2z#=-15
position object 2,-235,70,b2z#
load object "b1.x",3
b3z#=75
position object 3,-235,70,b3z#
load object "b1.x",4
b4z#=-105
position object 4,-45,70,b4z#
load object "b1.x",5
b5z#=-5
position object 5,-45,70,b5z#
load object "b1.x",6
b6z#=100
position object 6,-45,70,b6z#
load object "b1.x",7
b7z#=-45
position object 7,155,70,b7z#
load object "b1.x",8
b8z#=45
position object 8,155,70,b8z#
` load the united team
load object "u1.x",11
position object 11,305,70,u1z#
load object "u1.x",12
u2z#=-15
position object 12,235,70,u2z#
load object "u1.x",13
u3z#=75
position object 13,235,70,u3z#
load object "u1.x",14
u4z#=-105
position object 14,45,70,u4z#
load object "u1.x",15
u5z#=-5
position object 15,45,70,u5z#
load object "u1.x",16
u6z#=100
position object 16,45,70,u6z#
load object "u1.x",17
u7z#=-45
position object 17,-155,70,u7z#
load object "u1.x",18
u8z#=45
position object 18,-155,70,u8z#
` load walls
load object "w1.x",31
ghost object on 31
load object "w2.x",32
ghost object on 32
load object "w3.x",33
ghost object on 33
load object "w4.x",34
ghost object on 34
` load nets
load object "net1.x",35
load object "net2.x",36
` load grass
load object "field.x",41
set object collision off 41
` load ball
load object "ball.x",51
` load bars
for t=61 to 64
load object "bar.x",t
next t
position object 61,-305,0,0
position object 62,-235,0,0
position object 63,-45,0,0
position object 64,155,0,0
for t=65 to 68
load object "bar.x",t
next t
position object 65,305,0,0
position object 66,235,0,0
position object 67,45,0,0
position object 68,-155,0,0
` position camera
rotate camera 52,0,0
position camera 0,470,-250
color backdrop 0
` few variables
bx = 0
bz = 0
speed=5+rnd(8)
bx_dir = rnd(1)
bz_dir = rnd(1)
`
do
if inkey$()="r" then start=0 : bgoal=0 : ugoal=0 : wait 300
paste image 1,10,10
paste image 2,410,10
if start=0
text tx+220,110,"this is far fetched football ... help bolton wanderers beat man united ... you can move the bolton players with the up and down arrows ... hit any key to start ... hit r to restart ..."
tx=tx-5
if tx<-2900 then tx=0
if scancode()>0 then a#=timer()*0.001 : start=1
endif
if start=1
` clock
b=(a#-(timer()*0.001))
c=b+120
if c<1 then ugoal=0 : bgoal=0 : a#=timer()*0.001
if go=1
` rotate bolton players when ball comes near
zrotate object 1,b1a#
if b1a#>30 then b1a#=0
if bx<-270 then b1a#=wrapvalue(b1a#+10):on1=1
`
zrotate object 2,b2a#
zrotate object 3,b2a#
if b2a#>60 then b2a#=0
if bx>-250 and bx<-160 then b2a#=wrapvalue(b2a#+10):on1=2
`
zrotate object 4,b3a#
zrotate object 5,b3a#
zrotate object 6,b3a#
if b3a#>60 then b3a#=0
if bx>-60 and bx<30 then b3a#=wrapvalue(b3a#+10):on1=3
`
zrotate object 7,b4a#
zrotate object 8,b4a#
if b4a#>60 then b4a#=0
if bx>140 and bx<210 then b4a#=wrapvalue(b4a#+10):on1=4
`
endif
`
` rotate united players when ball comes near
zrotate object 11,u1a#
if u1a#=330 then u1a#=0
if bx>270 then u1a#=wrapvalue(u1a#-10):on2=1
`
zrotate object 12,u2a#
zrotate object 13,u2a#
if u2a#=290 then u2a#=0
if bx>160 and bx<250 then u2a#=wrapvalue(u2a#-10):on2=2
`
zrotate object 14,u3a#
zrotate object 15,u3a#
zrotate object 16,u3a#
if u3a#=290 then u3a#=0
if bx>-30 and bx<60 then u3a#=wrapvalue(u3a#-10):on2=3
`
zrotate object 17,u4a#
zrotate object 18,u4a#
if u4a#=290 then u4a#=0
if bx>-210 and bx<-140 then u4a#=wrapvalue(u4a#-10):on2=4
`
` position ball
position object 51,bx,by,bz
` move ball
if bx_dir = 0 then dec bx, speed
if bx_dir = 1 then inc bx, speed
if bz_dir = 0 then dec bz, speed
if bz_dir = 1 then inc bz, speed
` ball collision stuff
hit1=object collision(51,0)
` ball hits wall
if hit1=32 then bx_dir = 0 : speed=5+rnd(8)
if hit1=34 then bx_dir = 1 : speed=5+rnd(8)
if hit1=31 then bz_dir = 0 : speed=5+rnd(8)
if hit1=33 then bz_dir = 1 : speed=5+rnd(8)
`
if go=1
` ball hits bolton player
if hit1>0 and hit1<9
if bx_dir=0 then bx_dir=1: speed=5+rnd(8)
if bx_dir=1 then bx_dir=1: speed=5+rnd(8)
if bz_dir=0 then bz_dir=rnd(1): speed=5+rnd(8)
if bz_dir=1 then bz_dir=rnd(1): speed=5+rnd(8)
endif
endif
` ball hits united player
if hit1>10 and hit1<19
if bx_dir=0 then bx_dir=0: speed=5+rnd(8)
if bx_dir=1 then bx_dir=0: speed=5+rnd(8)
if bz_dir=0 then bz_dir=rnd(1): speed=5+rnd(8)
if bz_dir=1 then bz_dir=rnd(1): speed=5+rnd(8)
endif
`
` goal score stuff
if hit1=35 then ugoal=ugoal+1 : bx=-300+rnd(600) : bz=-180+rnd(360)
if hit1=36 then bgoal=bgoal+1 :bx=-300+rnd(600) : bz=-180+rnd(360)
` +++++++++++++++++++++++++++++
if go=1
` position bolton players
position object 1,-305,70,b1z#
position object 2,-235,70,b2z#
position object 3,-235,70,b3z#
position object 4,-45,70,b4z#
position object 5,-45,70,b5z#
position object 6,-45,70,b6z#
position object 7,155,70,b7z#
position object 8,155,70,b8z#
`
endif
` position united players
position object 11,305,70,u1z#
position object 12,235,70,u2z#
position object 13,235,70,u3z#
position object 14,45,70,u4z#
position object 15,45,70,u5z#
position object 16,45,70,u6z#
position object 17,-155,70,u7z#
position object 18,-155,70,u8z#
` move active bolton players up
if upkey()=1
go=1
if on1=1
inc b1z#,5
endif
`
if on1=2
inc b2z#,5
inc b3z#,5
endif
`
if on1=3
inc b4z#,5
inc b5z#,5
inc b6z#,5
endif
`
if on1=4
inc b7z#,5
inc b8z#,5
endif
`
endif
`
` move active bolton players down
if downkey()=1
go=1
if on1=1
dec b1z#,5
endif
`
if on1=2
dec b2z#,5
dec b3z#,5
endif
`
if on1=3
dec b4z#,5
dec b5z#,5
dec b6z#,5
endif
`
if on1=4
dec b7z#,5
dec b8z#,5
endif
`
endif
` reposition bolton players
if b1z#<-50 then b1z#=-30 : on1=0
if b1z#>50 then b1z#=30 : on1=0
`
if b2z#<-170 then b2z#=-15 : b3z#=75 : on1=0
if b3z#>170 then b2z#=-15 : b3z#=75 : on1=0
`
if b4z#<-170 then b4z#=-105 :b5z#=-5 : b6z#=100 : on1=0
if b6z#>170 then b4z#=-105 :b5z#=-5 : b6z#=100 : on1=0
`
if b7z#<-170 then b7z#=-45 : b8z#=45 : on1=0
if b8z#>170 then b7z#=-45 : b8z#=45 : on1=0
`
` move united players
if on2=1
inc u1z#,-5+rnd(10)
endif
`
if on2=2
rn2=-5+rnd(10)
inc u2z#,rn2
inc u3z#,rn2
endif
`
if on2=3
rn3=-5+rnd(10)
inc u4z#,rn3
inc u5z#,rn3
inc u6z#,rn3
endif
`
if on2=4
rn4=-5+rnd(10)
inc u7z#,rn4
inc u8z#,rn4
endif
` reposition united players
if u1z#<-50 then u1z#=-30 : on2=0
if u1z#>50 then u1z#=30 : on2=0
`
if u2z#<-170 then u2z#=-15 : u3z#=75 : on2=0
if u3z#>170 then u2z#=-15 : u3z#=75 : on2=0
`
if u4z#<-170 then u4z#=-105 :u5z#=-5 : u6z#=100 : on2=0
if u6z#>170 then u4z#=-105 :u5z#=-5 : u6z#=100 : on2=0
`
if u7z#<-170 then u7z#=-45 : u8z#=45 : on2=0
if u8z#>170 then u7z#=-45 : u8z#=45 : on2=0
`
` ++++++++++++++++++++++++
` ball escape thing
if bz<-200 then bz=0
if bz>200 then bz=0
if bx<-350 then bx=0
if bx>350 then bx=0
`
endif
` onscreen text
text 310,55,str$(bgoal)
text 710,55,str$(ugoal)
if start=1 then center text 400,115,str$(c)
`
if scancode()<1 then go=0
`
sync
loop
http://www.madglue.com/stock/footy.zip
regards,
miki.
in the end