
-----------------------------------
gamedude213
Sat Jun 13, 2009 5:44 pm

Frogger Timer Issues
-----------------------------------
Create a frogger-like game 



As You May See, I have tried to make a timer go up every time frogger reahes the other side of the game and i cannot make it go up after the first time it reahes the other side.


var xmo, ymo, buttonnumber, buttonupdown, winid : int
var x2, x3 : int
var y, x : int
var key : string (1) %Move
var num : int
var y2 : int %road variable
var x4, y4 : int %third car
var x5, y5 : int %fourth car
var x6, y6 : int %fith car
var x7, y7 : int %sixth car
var x8, y8 : int %seventh car
var flyx, flyy : int %y coordinates for fly
var flyy2, flyx2 : int %random coordinates for fly
var lives : int %lives for frog
var points : int %score
var timer, timer2 : int %timer
var level : int
var font2 : int




process leap
    play ("g")
end leap


font2 := Font.New ("sans serif:18:bold")
assert font2 > 0
level := 1
timer2 := 0
timer := 120
points := 0
flyx := -300
lives := 3
x8 := 9
y8 := 220
x7 := -400
y7 := 160
y6 := 160
x6 := -300
x5 := -100
y5 := 160
x4 := 0
y4 := -20
x3 := 0
x2 := 0
y2 := 0
y := 0
x := 0
num := 0
View.Set ("offscreenonly")















loop


    drawfillbox (0, 0, 639, 399, 14)

    drawfillbox (260, 230, 360, 180, 10)
    locate (12, 38)
    put "Play" ..


    drawfillbox (60, 230, 160, 180, 10)
    locate (12, 12)
    put "Exit" ..

    drawfillbox (460, 230, 580, 180, 10)
    locate (12, 60)
    put "Instructions" ..


    Font.Draw ("Frogger Returns", 50, 80, font2, brightblue)
    View.Update
    buttonwait ("down", xmo, ymo, buttonnumber, buttonupdown)




    if xmo > 260 and xmo < 360 and ymo > 180 and ymo < 230 then %game


        loop
            x8 := 9
            y8 := 220
            x7 := -400
            y7 := 160
            y6 := 160
            x6 := -300
            x5 := -100
            y5 := 160
            x4 := 0
            y4 := -20
            x3 := 0
            x2 := 0
            y2 := 0
            y := 0
            x := 0
            num := 0
            x2 := 0
            y2 := 0
            timer := 120
            timer2 := 0

            if timer2 >= 120 then
                exit
            end if

            loop



                randint (flyy2, 0, 6)
                if flyy2 = 0 then
                    flyy := -180
                elsif flyy2 = 1 then
                    flyy := -120
                elsif flyy2 = 2 then
                    flyy := -45
                elsif flyy2 = 3 then
                    flyy := 0
                elsif flyy2 = 4 then
                    flyy := 50
                elsif flyy2 = 5 then
                    flyy := 120
                elsif flyy2 = 6 then
                    flyy := 160

                end if




                randint (flyx2, 1, 13)

                if flyx2 = 1 then
                    flyx := -300
                elsif flyx2 = 2 then
                    flyx := -250
                elsif flyx2 = 3 then
                    flyx := -200
                elsif flyx2 = 4 then
                    flyx := -150
                elsif flyx2 = 5 then
                    flyx := -100
                elsif flyx2 = 6 then
                    flyx := -50
                elsif flyx2 = 7 then
                    flyx := 0
                elsif flyx2 = 8 then
                    flyx := 50
                elsif flyx2 = 9 then
                    flyx := 100
                elsif flyx2 = 10 then
                    flyx := 150
                elsif flyx2 = 11 then
                    flyx := 200
                elsif flyx2 = 12 then
                    flyx := 250
                elsif flyx2 = 13 then
                    flyx := 300
                end if











                if timer2 >= 120 then

                    exit
                end if







                loop

                    if level > 1 then
                        timer := timer + 10

                    end if
                    exit
                end loop







                loop


                    if timer2 >= 120 then

                        exit
                    end if

                    timer2 := round (Time.Elapsed / 1000)





                    if x = 320 then
                        x := 300
                    end if

                    if x > flyx - 10 and x < flyx + 10 and y2 = flyy2 then
                        points := points + 1
                    end if



                    delay (10)

                    drawfillbox (0, 0, 639, 399, 2)

                    %bottom Road

                    drawfillbox (0, 40, 639, 180, 15)
                    drawfillbox (0, 110, 639, 120, 14)

                    %TOP ROAD
                    drawfillbox (0, 220, 639, 340, 15)
                    drawfillbox (0, 285, 639, 290, 14)


                    %fly
                    drawfilloval (flyx + 320, flyy + 200, 5, 10, 7) %body


                    drawoval (flyx + 317, flyy + 195, 5, 7, 7) %wings
                    drawoval (flyx + 323, flyy + 195, 5, 7, 7)

                    %LEFT LEGS
                    drawline (flyx + 320, flyy + 205, flyx + 310, flyy + 210, 7)
                    drawline (flyx + 320, flyy + 200, flyx + 305, flyy + 200, 7)
                    drawline (flyx + 320, flyy + 195, flyx + 310, flyy + 190, 7)

                    %right legs
                    drawline (flyx + 320, flyy + 205, flyx + 330, flyy + 210, 7)
                    drawline (flyx + 320, flyy + 200, flyx + 335, flyy + 200, 7)
                    drawline (flyx + 320, flyy + 195, flyx + 330, flyy + 190, 7)


                    locate (1, 1)





                    %frog
                    %eyes
                    drawfilloval (x + 311, y + 13, 3, 3, 7)
                    drawfilloval (x + 328, y + 13, 3, 3, 7)

                    %body
                    drawfilloval (x + 320, y, 10, 15, 10)


                    %right leg
                    drawfilloval (x + 330, y - 10, 5, 7, 10)
                    drawline (x + 330, y + 193 - 200, x + 335, y + 200 - 200, 10)
                    drawline (x + 330, y + 193 - 200, x + 332, y + 200 - 200, 10)
                    drawline (x + 330, y + 190 - 200, x + 338, y + 200 - 200, 10)

                    %left leg
                    drawfilloval (x + 310, y + -10, 5, 7, 10)
                    drawline (x + 310, y + 193 - 200, x + 305, y + 200 - 200, 10)
                    drawline (x + 310, y + 193 - 200, x + 308, y + 200 - 200, 10)
                    drawline (x + 310, y + 190 - 200, x + 302, y + 200 - 200, 10)





                    %car/frog if statement

                    if x < x2 + 90 and x > x2 - 20 and y2 = 2 then
                        exit
                    elsif x < x3 - 110 and x > x3 - 230 and y2 = 2 then
                        exit
                    elsif x < x4 + 90 and x > x4 - 20 and y2 = 1 then
                        exit
                    elsif x < x5 + 90 and x > x5 - 20 and y2 = 4 then
                        exit
                    elsif x < x6 + 90 and x > x6 - 20 and y2 = 4 then
                        exit
                    elsif x < x7 + 90 and x > x7 - 20 and y2 = 4 then
                        exit
                    elsif x < x8 + 90 and x > x8 - 20 and y2 = 5 then
                        exit
                    end if


                    %frog move statement

                    if hasch then
                        getch (key)
                        num := ord (key)
                    end if
                    if num = 203 then
                        fork leap
                        x := x - 50

                    elsif num = 205
                            then
                        fork leap
                        x := x + 50
                    elsif num = 200 then
                        fork leap
                        y2 := y2 + 1

                    elsif num = 208 then
                        fork leap
                        y2 := y2 - 1
                    end if




                    % frog placement


                    num := 0
                    View.Update
                    if y2 < 0 then
                        y2 := 0
                    end if
                    if y2 = 1 then
                        y := 80
                    elsif y2 = 2 then
                        y := 165
                    elsif y2 = 3 then
                        y := 200
                    elsif y2 = 4 then
                        y := 260
                    elsif y2 = 0 then
                        y := 20
                    elsif y2 = 5 then
                        y := 320
                    elsif y2 = 6 then
                        y := 365
                    elsif y2 = 7 then
                        y := 410
                    elsif y2 = 7 then
                        exit
                    end if



                    %first Car

                    %bottom road, top lane

                    drawfillbox (x2 + 320, 140, x2 + 380, 180, 1)

                    %front of car
                    drawline (x2 + 380, 180, x2 + 400, 150, 1)
                    drawline (x2 + 400, 210 - 60, x2 + 400, 200 - 60, 1)
                    drawline (x2 + 400, 200 - 60, x2 + 380, 200 - 60, 1)
                    drawfill (x2 + 390, 205 - 60, 1, 1)


                    %back  of car
                    drawline (x2 + 320, 180, x2 + 300, 150, 1)
                    drawline (x2 + 300, 150, x2 + 300, 140, 1)
                    drawline (x2 + 300, 140, x2 + 320, 140, 1)
                    drawfill (x2 + 310, 145, 1, 1)


                    %left tire
                    drawfilloval (x2 + 320, 145, 10, 10, 7)
                    drawfilloval (x2 + 320, 145, 5, 5, 15)


                    %right tire
                    drawfilloval (x2 + 380, 145, 10, 10, 7)
                    drawfilloval (x2 + 380, 145, 5, 5, 15)

                    %right window

                    drawline (x2 + 380, 180, x2 + 390, 165, 7)
                    drawline (x2 + 390, 165, x2 + 380, 165, 7)
                    drawline (x2 + 380, 165, x2 + 380, 180, 7)
                    drawfill (x2 + 384, 173, 7, 7)
                    %left window
                    drawline (x2 + 320, 180, x2 + 310, 165, 7)
                    drawline (x2 + 310, 165, x2 + 320, 165, 7)
                    drawline (x2 + 320, 165, x2 + 320, 180, 7)
                    drawfill (x2 + 316, 173, 7, 7)








                    %second car

                    drawfillbox (x3 + 120, 200 - 60, x3 + 180, 240 - 60, 12)

                    %front of car
                    drawline (x3 + 180, 180, x3 + 200, 150, 12)
                    drawline (x3 + 200, 210 - 60, x3 + 200, 200 - 60, 12)
                    drawline (x3 + 200, 200 - 60, x3 + 180, 200 - 60, 12)
                    drawfill (x3 + 190, 205 - 60, 12, 12)


                    %back  of car
                    drawline (x3 + 120, 180, x3 + 100, 150, 12)
                    drawline (x3 + 100, 150, x3 + 100, 140, 12)
                    drawline (x3 + 100, 140, x3 + 120, 140, 12)
                    drawfill (x3 + 110, 145, 12, 12)


                    %left tire
                    drawfilloval (x3 + 120, 145, 10, 10, 7)
                    drawfilloval (x3 + 120, 145, 5, 5, 15)


                    %right tire
                    drawfilloval (x3 + 180, 145, 10, 10, 7)
                    drawfilloval (x3 + 180, 145, 5, 5, 15)

                    %right window

                    drawline (x3 + 180, 180, x3 + 190, 165, 7)
                    drawline (x3 + 190, 165, x3 + 180, 165, 7)
                    drawline (x3 + 180, 165, x3 + 180, 180, 7)
                    drawfill (x3 + 184, 173, 7, 7)
                    %left window
                    drawline (x3 + 120, 180, x3 + 110, 165, 7)
                    drawline (x3 + 110, 165, x3 + 120, 165, 7)
                    drawline (x3 + 120, 165, x3 + 120, 180, 7)
                    drawfill (x3 + 116, 173, 7, 7)








                    %bottom road, bottom lane


                    %third car
                    drawfillbox (x4 + 320, 80 + y4, x4 + 380, 120 + y4, 2)

                    %front of car
                    drawline (x4 + 380, 120 + y4, x4 + 400, 90 + y4, 2)
                    drawline (x4 + 400, 90 + y4, x4 + 400, 80 + y4, 2)
                    drawline (x4 + 400, 80 + y4, x4 + 380, 80 + y4, 2)
                    drawfill (x4 + 390, 85 + y4, 2, 2)


                    %back  of car
                    drawline (x4 + 320, 120 + y4, x4 + 300, 90 + y4, 2)
                    drawline (x4 + 300, 90 + y4, x4 + 300, 80 + y4, 2)
                    drawline (x4 + 300, 80 + y4, x4 + 320, 80 + y4, 2)
                    drawfill (x4 + 310, 85 + y4, 2, 2)


                    %left tire
                    drawfilloval (x4 + 320, 85 + y4, 10, 10, 7)
                    drawfilloval (x4 + 320, 85 + y4, 5, 5, 15)


                    %right tire
                    drawfilloval (x4 + 380, 85 + y4, 10, 10, 7)
                    drawfilloval (x4 + 380, 85 + y4, 5, 5, 15)

                    %right window

                    drawline (x4 + 380, 120 + y4, x4 + 390, 105 + y4, 7)
                    drawline (x4 + 390, 105 + y4, x4 + 380, 105 + y4, 7)
                    drawline (x4 + 380, 105 + y4, x4 + 380, 120 + y4, 7)
                    drawfill (x4 + 384, 113 + y4, 7, 7)
                    %left window
                    drawline (x4 + 320, 120 + y4, x4 + 310, 105 + y4, 7)
                    drawline (x4 + 310, 105 + y4, x4 + 320, 105 + y4, 7)
                    drawline (x4 + 320, 105 + y4, x4 + 320, 120 + y4, 7)
                    drawfill (x4 + 316, 113 + y4, 7, 7)











                    %top road, bottom lane
                    %Car Four
                    drawfillbox (x5 + 320, 80 + y5, x5 + 380, 120 + y5, 3)

                    %front of car
                    drawline (x5 + 380, 120 + y5, x5 + 400, 90 + y5, 3)
                    drawline (x5 + 400, 90 + y5, x5 + 400, 80 + y5, 3)
                    drawline (x5 + 400, 80 + y5, x5 + 380, 80 + y5, 3)
                    drawfill (x5 + 390, 85 + y5, 3, 3)


                    %back  of car
                    drawline (x5 + 320, 120 + y5, x5 + 300, 90 + y5, 3)
                    drawline (x5 + 300, 90 + y5, x5 + 300, 80 + y5, 3)
                    drawline (x5 + 300, 80 + y5, x5 + 320, 80 + y5, 3)
                    drawfill (x5 + 310, 85 + y5, 3, 3)


                    %left tire
                    drawfilloval (x5 + 320, 85 + y5, 10, 10, 7)
                    drawfilloval (x5 + 320, 85 + y5, 5, 5, 15)


                    %right tire
                    drawfilloval (x5 + 380, 85 + y5, 10, 10, 7)
                    drawfilloval (x5 + 380, 85 + y5, 5, 5, 15)

                    %right window

                    drawline (x5 + 380, 120 + y5, x5 + 390, 105 + y5, 7)
                    drawline (x5 + 390, 105 + y5, x5 + 380, 105 + y5, 7)
                    drawline (x5 + 380, 105 + y5, x5 + 380, 120 + y5, 7)
                    drawfill (x5 + 384, 113 + y5, 7, 7)
                    %left window
                    drawline (x5 + 320, 120 + y5, x5 + 310, 105 + y5, 7)
                    drawline (x5 + 310, 105 + y5, x5 + 320, 105 + y5, 7)
                    drawline (x5 + 320, 105 + y5, x5 + 320, 120 + y5, 7)
                    drawfill (x5 + 316, 113 + y5, 7, 7)













                    %fith car
                    drawfillbox (x6 + 320, 80 + y6, x6 + 380, 120 + y6, 4)

                    %front of car
                    drawline (x6 + 380, 120 + y6, x6 + 400, 90 + y6, 4)
                    drawline (x6 + 400, 90 + y6, x6 + 400, 80 + y6, 4)
                    drawline (x6 + 400, 80 + y6, x6 + 380, 80 + y6, 4)
                    drawfill (x6 + 390, 85 + y6, 4, 4)


                    %back  of car
                    drawline (x6 + 320, 120 + y6, x6 + 300, 90 + y6, 4)
                    drawline (x6 + 300, 90 + y6, x6 + 300, 80 + y6, 4)
                    drawline (x6 + 300, 80 + y6, x6 + 320, 80 + y6, 4)
                    drawfill (x6 + 310, 85 + y6, 4, 4)


                    %left tire
                    drawfilloval (x6 + 320, 85 + y6, 10, 10, 7)
                    drawfilloval (x6 + 320, 85 + y6, 5, 5, 15)


                    %right tire
                    drawfilloval (x6 + 380, 85 + y6, 10, 10, 7)
                    drawfilloval (x6 + 380, 85 + y6, 5, 5, 15)

                    %right window

                    drawline (x6 + 380, 120 + y6, x6 + 390, 105 + y6, 7)
                    drawline (x6 + 390, 105 + y6, x6 + 380, 105 + y6, 7)
                    drawline (x6 + 380, 105 + y6, x6 + 380, 120 + y6, 7)
                    drawfill (x6 + 384, 113 + y6, 7, 7)
                    %left window
                    drawline (x6 + 320, 120 + y6, x6 + 310, 105 + y6, 7)
                    drawline (x6 + 310, 105 + y6, x6 + 320, 105 + y6, 7)
                    drawline (x6 + 320, 105 + y6, x6 + 320, 120 + y6, 7)
                    drawfill (x6 + 316, 113 + y6, 7, 7)










                    %top road, bottom lane
                    %sixth car

                    drawfillbox (x7 + 320, 80 + y7, x7 + 380, 120 + y7, 5)

                    %front of car
                    drawline (x7 + 380, 120 + y7, x7 + 400, 90 + y7, 5)
                    drawline (x7 + 400, 90 + y7, x7 + 400, 80 + y7, 5)
                    drawline (x7 + 400, 80 + y7, x7 + 380, 80 + y7, 5)
                    drawfill (x7 + 390, 85 + y7, 5, 5)


                    %back  of car
                    drawline (x7 + 320, 120 + y7, x7 + 300, 90 + y7, 5)
                    drawline (x7 + 300, 90 + y7, x7 + 300, 80 + y7, 5)
                    drawline (x7 + 300, 80 + y7, x7 + 320, 80 + y7, 5)
                    drawfill (x7 + 310, 85 + y7, 5, 5)


                    %left tire
                    drawfilloval (x7 + 320, 85 + y7, 10, 10, 7)
                    drawfilloval (x7 + 320, 85 + y7, 5, 5, 15)


                    %right tire
                    drawfilloval (x7 + 380, 85 + y7, 10, 10, 7)
                    drawfilloval (x7 + 380, 85 + y7, 5, 5, 15)

                    %right window

                    drawline (x7 + 380, 120 + y7, x7 + 390, 105 + y7, 7)
                    drawline (x7 + 390, 105 + y7, x7 + 380, 105 + y7, 7)
                    drawline (x7 + 380, 105 + y7, x7 + 380, 120 + y7, 7)
                    drawfill (x7 + 384, 113 + y7, 7, 7)
                    %left window
                    drawline (x7 + 320, 120 + y7, x7 + 310, 105 + y7, 7)
                    drawline (x7 + 310, 105 + y7, x7 + 320, 105 + y7, 7)
                    drawline (x7 + 320, 105 + y7, x7 + 320, 120 + y7, 7)
                    drawfill (x7 + 316, 113 + y7, 7, 7)













                    %seventh Car


                    %top road, top lane

                    drawfillbox (x8 + 320, 80 + y8, x8 + 380, 120 + y8, 12)

                    %front of car
                    drawline (x8 + 380, 120 + y8, x8 + 400, 90 + y8, 12)
                    drawline (x8 + 400, 90 + y8, x8 + 400, 80 + y8, 12)
                    drawline (x8 + 400, 80 + y8, x8 + 380, 80 + y8, 12)
                    drawfill (x8 + 390, 85 + y8, 12, 12)


                    %back  of car
                    drawline (x8 + 320, 120 + y8, x8 + 300, 90 + y8, 12)
                    drawline (x8 + 300, 90 + y8, x8 + 300, 80 + y8, 12)
                    drawline (x8 + 300, 80 + y8, x8 + 320, 80 + y8, 12)
                    drawfill (x8 + 310, 85 + y8, 12, 12)


                    %left tire
                    drawfilloval (x8 + 320, 85 + y8, 10, 10, 7)
                    drawfilloval (x8 + 320, 85 + y8, 5, 5, 15)


                    %right tire
                    drawfilloval (x8 + 380, 85 + y8, 10, 10, 7)
                    drawfilloval (x8 + 380, 85 + y8, 5, 5, 15)

                    %right window

                    drawline (x8 + 380, 120 + y8, x8 + 390, 105 + y8, 7)
                    drawline (x8 + 390, 105 + y8, x8 + 380, 105 + y8, 7)
                    drawline (x8 + 380, 105 + y8, x8 + 380, 120 + y8, 7)
                    drawfill (x8 + 384, 113 + y8, 7, 7)
                    %left window
                    drawline (x8 + 320, 120 + y8, x8 + 310, 105 + y8, 7)
                    drawline (x8 + 310, 105 + y8, x8 + 320, 105 + y8, 7)
                    drawline (x8 + 320, 105 + y8, x8 + 320, 120 + y8, 7)
                    drawfill (x8 + 316, 113 + y8, 7, 7)


















                    %car moving

                    x2 := x2 + 8
                    x3 := x3 + 8
                    x4 := x4 + 10
                    x5 := x5 - 9
                    x6 := x6 - 9
                    x7 := x7 - 8
                    x8 := x8 - 10


                    % if cars going right to far off

                    if x2 = 600 or x2 > 700 or x3 = 600 or x3 > 700 or x4 > 800 then
                        x2 := -400
                        x3 := -350
                        x4 := -400

                    end if


                    %if cars going left go off
                    if x6  x2 - 20 and y2 = 2 then
                    lives := lives - 1
                    exit
                elsif x < x3 - 110 and x > x3 - 230 and y2 = 2 then
                    lives := lives - 1
                    exit
                elsif x < x4 + 90 and x > x4 - 20 and y2 = 1 then
                    lives := lives - 1
                    exit
                elsif x < x5 + 90 and x > x5 - 20 and y2 = 4 then
                    lives := lives - 1
                    exit
                elsif x < x6 + 90 and x > x6 - 20 and y2 = 4 then
                    lives := lives - 1
                    exit
                elsif x < x7 + 90 and x > x7 - 20 and y2 = 4 then
                    lives := lives - 1
                    exit
                elsif x < x8 + 90 and x > x8 - 20 and y2 = 5 then
                    lives := lives - 1
                    exit
                end if

                if lives = 0 then
                    exit
                end if
                if y2 = 7 then


                    exit
                end if

                locate (1, 1)
                put "Score            ", points, " ", "Lives ", lives, " Time:", timer - timer2, " Level:", level ..

                View.Update




                if timer2 >= 120 then

                    exit
                end if







            end loop









            if timer2 >= 120 then

                exit
            end if


            if lives  60 and xmo < 160 and ymo > 180 and y < 230 then     %exit
        exit

    elsif xmo > 460 and xmo < 580 and ymo > 180 and ymo < 230 then     %instructions
        cls



        put "Welocome to Frogger Returns!"
        put "Here you are again, ready to help old frogger get across the road without becoming creamed :)"
        put "to help him use the arrow keys to make him jump, and try to stay on the fly as long as you can, youll get more points,"
        put "but make sure you watch your time, you will get 10 secounds extra on your start time for every time you go on to the next level "




        drawfillbox (20, 20, 120, 120, 10)
        locate (21, 8)
        put "Exit" ..
        View.Update

        loop
            buttonwait ("down", xmo, ymo, buttonnumber, buttonupdown)
            if xmo > 20 and xmo < 120 and ymo > 20 and ymo < 120 then
                exit
            end if
        end loop



    end if





end loop

winid := Window.GetActive
Window.Hide (winid)





I am using 4.1.1 i think, though i made this at school and am not sure what version that is

-----------------------------------
Nai
Sat Jun 13, 2009 6:15 pm

RE:Frogger Timer Issues
-----------------------------------
Next time, why don't you just post the uploaded file gamedude? It makes it a lot easier for anyone trying to help you.

-----------------------------------
gamedude213
Sat Jun 13, 2009 7:13 pm

Re: Frogger Timer Issues
-----------------------------------
heres the uploaded file

-----------------------------------
gamedude213
Sun Jun 14, 2009 8:34 am

RE:Frogger Timer Issues
-----------------------------------
bump for help

-----------------------------------
gamedude213
Sun Jun 14, 2009 6:55 pm

RE:Frogger Timer Issues
-----------------------------------
i need this for tomorow so any help would be appericiated

-----------------------------------
TheGuardian001
Sun Jun 14, 2009 8:18 pm

Re: Frogger Timer Issues
-----------------------------------
Wheee... late reply. Oh well.

First, I should probably say that your code is incredibly hard to read. use meaningful variable names. I have no idea what "x" is or how it differs from "x2". Names like "froggerX" or "carX" are much more helpful.

If the problem you are having is resetting the timer/changing the time on the timer, just look at when you are changing them. If you want the timer to change when frogger hits the top of the screen, then you should check if frogger has hit that spot, and change the timer. You currently seem to be changing it in several spots and using statements like "if level > 1". instead of over complicating it, just check if he's at the top of the screen.
