well,i been making frogger,and when it touches the lake,i is suppost to add 1 to the score,but it goes up 60 a sec.(because sync rate 60 )
here is the code,can you help.
Global frog = 1
global frogspeed = 2
global trafficspeed =10
global dim traffic(9)
global lives = 3
global dim pond(1)
global pondflag
global score
sync on
sync rate 60
backdrop on
color backdrop 0
make object box frog , 20,25,20
color object frog,RGB (0,255,0)
set object collision on frog
position object frog ,0,-500,0
position camera 0,0,-1000
point camera 0,0,0
autocam off
for x = 0 to 9
make object box x+2,100,55,20
color object x+2 , RGB(rnd (255),rnd (255),rnd (255))
set object collision on x+2
traffic(x) = x+2
next x
for x = 0 to 4
position object traffic(x),(250 * x)-500,100,0
next x
for x = 5 to 9
position object traffic(x),(250 * (x-4))-500,-100,0
next x
pond(0) = 12
pond(1) = 30
pondflag = 0
make object box pond(0) ,500,250,5
color object pond(0),RGB(0,0,255)
position object pond(0),0,500,0
set object collision on pond(0)
make object box pond(1) ,500,250,5
color object pond(1),RGB(0,0,255)
position object pond(1),0,-500,0
set object collision on pond(1)
do
hit = 0
control_frog()
move_traffic()
hit = collision_check()
if hit = 1
frog_death()
dec lives
endif
if hit = 2
score = hit_pond(pondflag,score)
endif
text 10,10,"lives: " + str$(lives)
text 10,20,"score: " + str$(score)
sync
loop
end
function control_frog()
if upkey() = 1 then position object frog, object position x(frog) , object position y(frog)+ frogspeed, object position z(frog)
if downkey() = 1 then position object frog,object position x(frog), object position y(frog)- frogspeed,object position z(frog)
if leftkey() = 1 then position object frog,object position x(frog) -frogspeed,object position y(frog),object position z(frog)
if rightkey() = 1 then position object frog,object position x(frog) +frogspeed,object position y(frog),object position z(frog)
endfunction
function move_traffic()
for x = 0 to 4
position object traffic(x),object position x(traffic(x)) + trafficspeed,100,0
next x
for x = 5 to 9
position object traffic(x), object position x(traffic(x)) - trafficspeed,-100,0
next x
if object position x(4) >1500
for x = 0 to 4
position object traffic(x),(250 * x)-2000,100,0
next x
endif
if object position x(9) < -1500
for x = 5 to 9
position object traffic(x) ,(250 * (x - 4))+2000,-100 ,0
next x
endif
endfunction
function collision_check()
for x = 0 to 9
if object collision(frog,traffic(x)) = 1 then hit = 1
next x
if object collision (frog,pond(0)) = 1 then hit = 2
if object collision(frog,pond(1)) = 1 then hit = 2
endfunction hit
function Frog_death()
position object frog,0,-500,0
endfunction
function hit_pond(pondflag,score)
if object collision (frog, pond(0)) = 1
if pondflag = 0
inc score
pondflag = 1
endif
endif
if object collision (frog,pond(1)) = 1
if pondflag = 1
inc score
pondflag = 0
endif
endif
endfunction score