randomize timer()
sync on
hide mouse
make camera 1
position camera 1, 0, 450, 0
xrotate camera 1, 90
make object sphere 1, 20
yrotate object 1, rnd(360)
move object 1, 200
set object collision on 1
set object radius 1, 1
global distance as integer : distance = 2500
global speed as integer : speed=2
global block as integer : block=90
global score as integer : score=0
global times as integer : times=5000
global stage as integer
global degree as integer
global level$ as string
global direction$ as string : direction$="l"
global time as integer : time = timer()
global counter as integer
global everten as integer
global start as integer
global angle as integer
global once as integer
global circ as integer : circ=15
dim check(999) as integer
data "random1","level1", "random2", "level2"
read level$
`read level$
r=rnd(255)
g=rnd(255)
b=rnd(255)
do
if col=25
c=rnd(1)
if c=1 and r<=248 then inc r, 7 else if r>= 7 then dec r, 7
c=rnd(1)
if c=1 and g<=248 then inc g, 7 else if g>= 7 then dec g, 7
c=rnd(1)
if c=1 and b<=248 then inc b, 7 else if b>= 7 then dec b, 7
color backdrop 1, rgb(r,g,b)
col=0
else
inc col
endif
player_input()
move()
select level$
case "level1"
level1()
endcase
case "level2"
level2()
endcase
case "random1"
random1()
endcase
case "random2"
random2()
endcase
endselect
delete()
`speed()
stats()
hit=object collision(1,0)
if hit>0
if check(hit)=2
score()
else
if check(hit)=1
delete object hit
check(hit)=0
inc score, 10000
endif
endif
endif
`wait 100
loop
function random2()
if counter > 500 and counter < 5000
if rnd(block)=1
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
`make object sphere num, 50
make object box num, 100, 50, 50
yrotate object num, rnd(360)
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
col=rnd(1)
if col=1
color object num, rgb(0,255,0)
check(num)=1
else
color object num, rgb(255,0,0)
check(num)=2
endif
endif
endif
if counter = 5500
read level$
counter=0
everten=0
endif
endfunction
function random1()
if counter > 500 and counter < 5000
if rnd(block)=1
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
make object sphere num, 50
` make object box num, 100, 50, 50
yrotate object num, rnd(360)
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
col=rnd(1)
if col=1
color object num, rgb(0,255,0)
check(num)=1
else
color object num, rgb(255,0,0)
check(num)=2
endif
endif
endif
if counter = 5500
read level$
counter=0
everten=0
endif
endfunction
function level1()
if counter < 700
if everten=50
if once=0
start=rnd(360)
once=1
endif
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
make object box num, 50, 100, 50
yrotate object num, start+angle
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
color object num, rgb(0,0,255)
check(num)=2
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
make object box num, 50, 100, 50
yrotate object num, start-angle
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
color object num, rgb(0,0,255)
check(num)=2
inc angle, 10
everten=0
endif
else
if everten=50
everten=0
for q = 0 to 120 step 120
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
make object box num, 50, 100+(speed*8), 50
yrotate object num, degree+q+angle+start
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
color object num, rgb(0,0,255)
check(num)=2
change=rnd(7+speed)
if change=1
if direction$="l" then direction$="r" else direction$="l"
endif
if direction$="l" then inc degree, 5 else dec degree, 5
next q
endif
endif
if counter = 10000
read level$
counter=0
degree=0
angle=0
everten=0
once=0
endif
endfunction
function level2()
if everten = 600 and counter<4500
everten=0
rand=rnd(360)
for q = 0 to 360 step 20
for x = 2 to 999
if object exist(x)=0
num=x
exit
endif
next x
make object cube num, 50
`make object box num, 60, 20, 100
yrotate object num, rand+q
move object num, 200
move object down num,distance
set object collision on num
set object collision to spheres num
set object radius 1, 1
color object num, rgb(255,0,0)
col=rnd(circ)
dec circ
if circ<1 then circ=1
if col=1
color object num, rgb(0,255,0)
check(num)=1
else
color object num, rgb(255,0,0)
check(num)=2
endif
next q
endif
if counter = 5000
restore
read level$
counter=0
everten=0
circ=15
inc speed
dec block, 10
endif
endfunction
function player_input()
if leftkey()=1
move object 1, -200
yrotate object 1, object angle y(1)+0.3+(speed/10)
move object 1, 200
endif
if rightkey()=1
move object 1, -200
yrotate object 1, object angle y(1)-0.3+(speed/10)
move object 1, 200
endif
endfunction
function move()
move object down 1,speed
move camera 1,speed
inc distance, speed
inc score, 10
inc counter
inc everten
endfunction
function delete()
count=0
for r = 2 to 999
if object exist(r)
if object position y(r)-400>object position y(1)
delete object r
check(r)=0
endif
else
inc count
if count=10 then exit
endif
next r
endfunction
function speed()
if times = 5000
read level$
times=0
endif
if stage=20000
stage=0
restore
endif
inc times
inc stage
endfunction
function stats()
text 10, 10, "score: "+str$(score)
text 10, 40, "speed: "+str$(speed-1)
`text 10, 60, "count: "+str$(counter)
`text 10, 90, "everten: "+str$(everten)
`text 10, 120, "start :"+str$(start)
`text 10, 150, "level: "+level$
sync
endfunction
function score()
if file exist("high.dat")
open to read 1, "high.dat"
else
open to write 1, "high.dat"
for x=1 to 10
write string 1, "0000000"
next x
close file 1
open to read 1, "high.dat"
endif
for x = 1 to 10
read string 1, score$
if val(score$)<score
pos=x
exit
endif
next x
close file 1
open to read 1, "high.dat"
open to write 2, "temp.dat"
for x=1 to 10
if x <> pos
read string 1, score$
write string 2, score$
else
write string 2, str$(score)
endif
next x
close file 1 : close file 2
delete file "high.dat"
rename file "temp.dat", "high.dat"
open to read 1, "high.dat"
for x = 1 to 10
read string 1, score$
text 10, x*20,score$
next x
text 100, 100, str$(score)
sync
wait 100
wait key
end
endfunction
heres a finished cop of mi game, hers um repeated code i need to sort out, i got lazy at the end.
use the left and right to move, red kills u, green gives points
let me kno what u think plz
[url=www.freewebs.com/tyhrfg][img]bruce.bmp[/img][/url]