
-----------------------------------
schwarp
Tue Jan 23, 2007 12:44 pm

My Paddle Ball Game
-----------------------------------
/************************************************************
 *                      Paddle Ball Game                     *
 *                                                           *
 *   This game will allow the user to move the paddle on     *
 *there own, and to try and keep the ball from going beyond. *
 *It will also keep score of how many times the ball bounced *
 *off the paddle,and will later ask the user if they would   *
 *like to play again.                                        *
 *                                                           *
 *                    By: Brandon Stacey                     *
 *                         12/01/06                          *
 ************************************************************/

loop
    %Key variables
    var key : string (1)
    var num : int
    num := 0
    %Paddle Variables
    var y1, y2 : int
    y1 := 1
    y2 := 100
    %Ball Variables
    var ran1, ran2, randdirx, randdiry : int
    var again : string


    randint (ran1, 1, 339)
    randint (ran2, 1, 639)
    randdiry := 3
    randdirx := 3
    %Title page variables
    var title1 : int
    title1 := 20
    var count : int := 0
    %Level Select
    var level : int

    loop
        loop
            drawfill (1, 1, 124, 124)
            %Name
            var font1 : int
            font1 := Font.New ("Stencil:20")
            assert font1 > 0
            Font.Draw ("X-TREME PADDLEBALL!!!", 160, 325, font1, red)
            Font.Free (font1)

            %Rules
            var font2, font3, font4, font5 : int
            font2 := Font.New ("AYTMystical:18:bold")
            font3 := Font.New ("sarif:12")
            font4 := Font.New ("sarif:12")
            font5 := Font.New ("sarif:12")
            assert font2 > 0
            assert font3 > 0
            assert font4 > 0
            assert font5 > 0
            Font.Draw ("Rules", 10, 190, font2, red)
            Font.Draw ("1.Arrow Keys are used. Left moves your paddle left, and right moves your paddle right.", 1, 160, font3, yellow)
            Font.Draw ("2.If the ball goes by the paddle, the game will end.", 1, 140, font4, yellow)
            Font.Draw ("3.Just have FUN!!!", 1, 120, font5, yellow)
            Font.Free (font2)
            Font.Free (font3)
            Font.Free (font4)
            Font.Free (font5)

            loop
                %Title wiper
                drawfilloval (title1, 335, 20, 20, 12)
                exit when title1 = 600
                delay (100)
                drawfilloval (title1, 335, 20, 20, 124)
                title1 := title1 + 10
            end loop

            cls
            %Level Select
            drawfill (1, 399, 12, 12)
            colorback (12)
            put "Which Difficulty would you like? Please press a NUMBER"
            put "1. X-Tremely Easy"
            put "2. Easy"
            put "3. Medium"
            put "4. Hard"
            put "5. X-Tremely HARD"
            get level
            if level = 1 then
                y1 := 1
                y2 := 300
                count := 0
            elsif level = 2 then
                y1 := 1
                y2 := 200
                count := 0
            elsif level = 3 then
                y1 := 1
                y2 := 100
                count := 0
            elsif level = 4 then
                y1 := 1
                y2 := 50
                count := 0
            elsif level = 5 then
                y1 := 1
                y2 := 15
                count := 0
            end if
            exit when level = 1
            exit when level = 2
            exit when level = 3
            exit when level = 4
            exit when level = 5
        end loop
        cls

        %Background
        drawfill (1, 399, 29, 29)
        loop
            %Paddle
            drawfillbox (y1, 1, y2, 20, 4)
            %Ball
            drawfilloval (ran2, ran1, 10, 10, 12)
            delay (10)
            %Paddle Erase
            drawfillbox (y1, 1, y2, 20, 29)
            %Ball Erase
            drawfilloval (ran2, ran1, 10, 10, 29)
            %Get Key
            if hasch then
                getch (key)
                num := ord (key)
            end if

            %Paddle
            if num = 203 and y1 >= 0 then
                y1 := y1 - 10
                y2 := y2 - 10
            elsif num = 205 and y2 = 399 then
                randdiry := -2
            end if
            if ran2 >= 639 then
                randdirx := -2
            end if
            if ran2 = y1 and ran2 