
-----------------------------------
kyoshiro
Sun Jan 11, 2004 12:19 pm

animation + proc problem
-----------------------------------
I've created an intro page for a program and it needs a bit of tweaking. One of the first problems is the buttonwait procedure. When i run my program it executes by calling specific procedures in order, however, the last procedure is called b4 the procedure b4 it was finished.


% elevator intro page

setscreen ("graphics:640;480")
drawfill (1, 1, red, red)

%%%%%%%%%%%%%%%%%%%%%%%%
proc intro ()
    var FontID, FontID2 : int
    FontID := Font.New ("Arial:35:Italic,Bold,underline")
    FontID2 := Font.New ("Arial:35:Italic,Bold,underline")

    for decreasing x : 20 .. 15

        Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID, x)
        if x = 15 then
            Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID2, white)
        end if
        delay (150)
    end for

end intro
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc introfinal ()
    var FontID, FontID2 : int
    FontID := Font.New ("Arial:35:Italic,Bold,underline")
    FontID2 := Font.New ("Arial:35:Italic,Bold,underline")

    for decreasing x : 20 .. 15

        Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID, x)
        if x = 15 then
            Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID2, white)
        end if
    end for
end introfinal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc movingbox
    setscreen ("offscreenonly")
    View.Update

    for y : 1 .. 100 by 10
        introfinal ()
        drawfill (1, 1, red, red)
        % a counted loop that is stored in the variable y
        drawfillbox (240, 160 - y, 400, 320 - y, blue)
        drawline (400, 160 - y, 440, 200 - y, blue)
        drawline (400, 320 - y, 440, 360 - y, blue)
        drawline (440, 200 - y, 440, 360 - y, blue)
        drawline (240, 320 - y, 280, 360 - y, blue)
        drawfill (420, 200 - y, brightblue, blue)
        drawline (280, 360 - y, 440, 360 - y, blue)
        drawfill (300, 350 - y, brightcyan, blue)
        View.Update
        cls
        drawfill (1, 1, red, red)
        delay (300)
        %draws a box that look 3d and has different shades of blue
    end for
    introfinal ()
    drawfillbox (240, 60, 400, 220, blue)
    drawline (400, 60, 440, 100, blue)
    drawline (400, 220, 440, 260, blue)
    drawline (440, 100, 440, 260, blue)
    drawline (240, 220, 280, 260, blue)
    drawfill (420, 100, brightblue, blue)
    drawline (280, 260, 440, 260, blue)
    drawfill (300, 250, brightcyan, blue)

end movingbox

proc button1 ()
    var FontID : int
    FontID := Font.New ("Arial:25:Italic,Bold")
    drawbox (500, 50, 600, 100, black)

    Font.Draw ("Start", 512, 65, FontID, black)
    
    
    var x, y, bud, bnum, num1, num2 : int := 0
   
    buttonwait ("up", x, y, bud, bnum)

    if x >= 500 and x = 50 and y 