Wednesday, 19 June 2013

Yesterday and Today's work-Finally finished

I am posting this today as a compilation of yesterday's and today's work because I feel this last post will create a large impact. I have done all the aesthetically pleasing details and touches to make this game more visually pleasing to look at. Including Mouse.Where, a life score button,highscore button, a "3..2..1..GO" procedure and some other little things have made the game much more enjoyable to play. I am quite pleased with my work. I hope Mr.Van Rooyen looks at the story line and the story behind it so he can understand why I put certain things into my code and why I have excluded them. Putting in music had terrible slowed down my code so I excluded that; not really a big deal. But I PURPOSEFULLY did not put a Menu Button at the end of the game so it would stay true to the title and the context to which it was made. I HOPE Mr.Van Rooyen sees this because it is important for him to know that certain things were left out on purpose;I could have easily made a menu button by adding a boolean or an if statement in the beginning of the code for the menu, but I didn't because I know that a game has more than just some buttons that lead you to any places. Overall I am pleased with this game
My Code :var Name : string
put "Please enter your name (7 characters or less) : " ..
get Name
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font5, font3, font4, font6, font0, font10, font11 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4

var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font0 := Font.New ("Comic Sans :45:bold,underline")
font1 := Font.New ("Batang:30:bold,underline")
font2 := Font.New ("Comic Sans:10:bold,underline")
font10 := Font.New ("Bookman Old Style :12")
font3 := Font.New ("Comic Sans :30:bold")
font11 := Font.New ("Comic Sans :30:bold,underline")
font4 := Font.New ("Comic Sans:20:bold,underline")
font5 := Font.New ("Comic Sans:10:bold")
font6 := Font.New ("Iskoola Pota:15:bold,underline")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
var timeofaction : int := Time.Elapsed
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of int
var Ball2YV : array 1 .. 100 of int
Ball2XV (1) := -1
Ball2YV (1) := 1
var LifeCounter : int := 3
var CollisionCheck : real
var ColorBall : int := 31
var Box1c, Box2c, Box3c : int
Box1c := 12
Box2c := 12
Box3c := 12
var Box1c2, Box2c2, Box3c2 : int
Box1c2 := 12
Box2c2 := 12
Box3c2 := 12
var Box1c3, Box2c3, Box3c3 : int
Box1c3 := 12
Box2c3 := 12
Box3c3 := 12
var GameLost : boolean := true
var ColorText3 : int := 12
var ColorText1 : int := 12
var ColorText2 : int := 12
proc Controls
    loop
        var MouseX, MouseY, Click : int
        drawfillbox (0, 0, maxx, maxy, 79)
        Font.Draw ("Controls", maxx div 7, maxy div 1.13, font11, red)
        Font.Draw ("The controls are rather simple: Use the cursor keys to move.", 100, 401, font10, red)
        Font.Draw ("Avoid any bouncing balls as you will lose one of your 3 lives If you are hit, you will be placed in the middle of the screen.", 100, 351, font10, red)
        Font.Draw ("Reach The prescribed amount of time for each level and you will progress into harder levels.", 100, 301, font10, red)
        Font.Draw ("If you progress into the third level, you will gain the ability to shoot, at which point the 'S' will be the shoot button.", 100, 251, font10, red)
        Font.Draw ("After you lose, you must exit the game for the rules are as such.", 100, 201, font10, red)
        Font.Draw ("Hint : If you wish to cheat , press and hold 'G' for immunity.", 100, 151, font10, red)
        Font.Draw (" Start ", maxx div 2.3, maxy div 13, font10, ColorText3)
        Draw.Box (maxx div 2.3 - 10, maxy div 13 - 10, maxx div 2, maxy div 11 + 15, white)
        Mouse.Where (MouseX, MouseY, Click)
        if MouseY <= 51 and 37 <= MouseY and MouseX <= 471 and MouseX >= 438 then
            ColorText3 := blue
        else
            ColorText3 := 12
            View.Update
        end if
        if ColorText3 = blue and Click = 1
                then
            exit
        end if
        View.Update
        cls
    end loop
end Controls
procedure GameMenu     %Creates Game Menu
    loop
        var MouseX, MouseY, Click : int
        drawfillbox (0, 0, maxx, maxy, 99)
        Font.Draw ("One Chance to Survive.", maxx div 4.7, maxy div 2, font1, red)
        Draw.Box (maxx div 4.7 - 20, maxy div 2 - 20, maxx div 1.35 + 20, maxy div 1.75 + 20, white)
        Font.Draw ("Start ", maxx div 2, maxy div 4, font6, ColorText1)
        Draw.Box (maxx div 2 - 10, maxy div 4 - 10, maxx div 1.8, maxy div 3.6, white)
        Font.Draw ("To View Controls", maxx div 2, maxy div 6, font6, ColorText2)
        Draw.Box (maxx div 2 - 10, maxy div 6 - 10, maxx div 1.5, maxy div 4.5, white)
        Mouse.Where (MouseX, MouseY, Click)
        if MouseY <= 109 and 76 <= MouseY and MouseX <= 661 and MouseX >= 497 then
            ColorText2 := blue
        else
            ColorText2 := 12
        end if
        if Click = 1 and ColorText2 = 12
                then
            exit
        end if
        if MouseY <= 142 and 119 <= MouseY and MouseX <= 552 and MouseX >= 497 then
            ColorText1 := blue
        else
            ColorText1 := 12
        end if
        if Click = 1 and ColorText1 = 12 then

            Controls
            exit

        end if
        View.Update
        cls
    end loop
end GameMenu
var Bulletx, Bullety : int
Bulletx := maxx div 2.05
Bullety := maxy div 9
GameMenu
var reset : boolean := true
var LifeCounter3 : int := 3
%proc Background
%   drawfillbox (0, 0, maxx, maxy, 149)
%end Background
var Bulletshot : boolean := false
var Balldirx : flexible array 1 .. 1000 of int
var Balldiry : flexible array 1 .. 1000 of int
Balldirx (1) := -1
Balldiry (1) := 1
var Ballx : flexible array 1 .. 1000 of int
var Bally : flexible array 1 .. 1000 of int
randint (Ballx (NumBall2), 0, maxx)
randint (Bally (NumBall2), 0, maxy)
var NumBall3 : int := 1
var BeginCounter : int := 1
proc Starting
    drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    Font.Draw ("Score:  ", maxx div 1.17, maxy div 1.05, font6, 31)
    Font.Draw (" 0", maxx div 1.09, maxy div 1.05, font6, 31)
    Font.Draw ("Lives", 30, maxy div 1.05, font2, 31)
    Font.Draw ("           :", 30, maxy div 1.05, font5, 31)
    %  Font.Draw ("Player : ", 180, maxy div 1.1, font1, 31)
    Font.Draw (Name, maxx div 1.09, maxy div 1.1, font6, 31)
    Draw.Box (10, maxy div 1.12, 140, maxy, white)
    drawfillbox (85, 475, 95, 480, 12)         %1st
    drawfillbox (105, 475, 115, 480, 12)         %2nd
    drawfillbox (125, 475, 135, 480, 12)         %3rd
    Font.Draw ("3.. ", 200, maxy div 1.1, font3, white)
    View.Update
    delay (150)
    Font.Draw (".. 2..", 300, maxy div 1.1, font3, white)
    View.Update
    delay (150)
    Font.Draw (".. 1..", 400, maxy div 1.1, font3, white)
    View.Update
    delay (150)
    Font.Draw (".. Go! ", 500, maxy div 1.1, font3, white)
    View.Update
    delay (150)
    View.Update
    BeginCounter := BeginCounter + 1
end Starting
var LifeCounter2 : int := 3
proc Background1
    drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    Font.Draw ("Score:  ", maxx div 1.17, maxy div 1.05, font6, 31)
    Font.Draw ("Lives", 30, maxy div 1.05, font2, 31)
    Font.Draw ("           :", 30, maxy div 1.05, font5, 31)
    Font.Draw (Name, maxx div 1.09, maxy div 1.1, font6, 31)
    Draw.Box (10, maxy div 1.12, 140, maxy, white)
    drawfillbox (85, 475, 95, 480, Box1c)     %1st
    drawfillbox (105, 475, 115, 480, Box2c)     %2nd
    drawfillbox (125, 475, 135, 480, Box3c)     %3rd
end Background1
var HighScore : int
var MouseX, MouseY, Click : int
var Level1, Level2, Level3 : boolean
Level1 := true
Level2 := false
Level3 := false
var resetgame : boolean := true
var resetgame1 : boolean := true
loop
    Background1
    if BeginCounter = 1 then
        Starting
    end if
    timeofaction := Time.Elapsed
    Timme := intstr (timeofaction, 1)
    Font.Draw (Timme, maxx div 1.09, maxy div 1.05, font6, 31)
    %drawfilloval (BallPlayerX, BallPlayerY, BallPlayerRadius, BallPlayerRadius, Color)
    %First Level
    if timeofaction <= 35000 then
        for d : 1 .. NumBall
            drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, ColorBall)
            BallX (d) := BallX (d) + BallXV (d)
            if BallX (d) = maxx - BallRadius
                    then
                NumBall := NumBall + 1
                BallXV (NumBall) := -1
                randint (BallX (NumBall), 0, maxx)         %X Position
                randint (BallY (NumBall), 0, maxy)         %Y Position
                BallXV (d) := -1
            elsif
                    BallX (d) = BallRadius
                    then
                BallXV (d) := 1
            end if
            if NumBall = 35
                    then
                NumBall := 34
            end if
            if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                    then
                drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 12)
                BoxX1 := maxx div 2
                BoxX2 := maxx div 2.1
                BoxY1 := maxy div 10
                BoxY2 := maxy div 8
                delay (200)
                LifeCounter := LifeCounter - 1
                if LifeCounter = 2
                        then
                    Box3c := 149
                end if
                if LifeCounter = 1
                        then
                    Box2c := 149
                end if
                if LifeCounter = 0
                        then
                    Box1c := 149
                end if
            end if
        end for
        if LifeCounter <= 0
                then
            GameLost := false
            %  reset := false
            HighScore := timeofaction
        end if
    elsif timeofaction > 35000 and timeofaction <= 55000 and BeginCounter = 2
            then
        Starting
        Level2 := true
    elsif timeofaction > 35000 and timeofaction <= 55000
            then
        %NextLevel
        if Level2 = true then
            drawfillbox (85, 475, 95, 480, Box1c2)         %1st
            drawfillbox (105, 475, 115, 480, Box2c2)         %2nd
            drawfillbox (125, 475, 135, 480, Box3c2)         %3rd
            for j : 1 .. NumBall2
                drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
                drawfilloval (Ball2X (j), Ball2Y (j), BallRadius, BallRadius, ColorBall)
                Ball2X (j) := Ball2X (j) + Ball2XV (j)
                if Ball2X (j) - BallRadius = BallRadius
                        then
                    Ball2XV (j) := Ball2XV (j) * -1
                elsif Ball2X (j) + BallRadius >= maxx - BallRadius
                        then
                    Ball2XV (j) := Ball2XV (j) * -1
                    NumBall2 := NumBall2 + 1
                    randint (Ball2X (NumBall2), 0, maxx)         %X Position
                    randint (Ball2Y (NumBall2), 0, maxy)         %Y Position
                    Ball2YV (NumBall2) := 1
                    Ball2XV (NumBall2) := -1
                end if
                Ball2Y (j) := Ball2Y (j) + Ball2YV (j)
                if Ball2Y (j) = maxy - BallRadius
                        then
                    Ball2YV (j) := -1 * Ball2YV (j)
                elsif Ball2Y (j) <= BallRadius
                        then
                    Ball2YV (j) := 1
                end if
                if NumBall2 = 35
                        then
                    NumBall2 := 34
                end if
                if Color = brightred and BoxX2 <= Ball2X (j) + BallRadius and BoxX1 >= Ball2X (j) - BallRadius and BoxY1 <= Ball2Y (j) + BallRadius and BoxY2 >= Ball2Y (j) - BallRadius
                        then
                    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 12)
                    BoxX1 := maxx div 2
                    BoxX2 := maxx div 2.1
                    BoxY1 := maxy div 10
                    BoxY2 := maxy div 8
                    delay (200)
                    LifeCounter2 := LifeCounter2 - 1
                    if LifeCounter2 = 2
                            then
                        Box3c2 := 149
                        drawfillbox (125, 475, 135, 480, Box3c)
                    end if
                    if LifeCounter2 = 1
                            then
                        Box2c2 := 149
                        drawfillbox (105, 475, 115, 480, Box2c)
                    end if
                    if LifeCounter2 = 0
                            then
                        Box1c2 := 149
                        drawfillbox (85, 475, 95, 480, Box1c)
                    end if
                end if
            end for
            if LifeCounter2 <= 0
                    then
                GameLost := false
                reset := false
                HighScore := timeofaction
            end if
            %  View.Update
        end if
    elsif
        %Last level
            timeofaction > 55000
            then
        if BeginCounter = 3
                then
            Starting
        end if
        drawfillbox (85, 475, 95, 480, Box1c3)         %1st
        drawfillbox (105, 475, 115, 480, Box2c3)         %2nd
        drawfillbox (125, 475, 135, 480, Box3c3)         %3rd
        %NumBall2 := 1
        for e : 1 .. NumBall3
            drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
            drawfilloval (Ball2X (e), Ball2Y (e), BallRadius, BallRadius, ColorBall)
            Ball2X (e) := Ball2X (e) + Ball2XV (e)
            if Ball2X (e) - BallRadius = BallRadius
                    then
                Ball2XV (e) := Ball2XV (e) * -1
            elsif Ball2X (e) + BallRadius >= maxx - BallRadius
                    then
                Ball2XV (e) := Ball2XV (e) * -1
                NumBall3 := NumBall3 + 1
                randint (Ball2X (NumBall3), 0, maxx)         %X Position
                randint (Ball2Y (NumBall3), 0, maxy)         %Y Position
                Ball2YV (NumBall3) := 1
                Ball2XV (NumBall3) := -1
            end if
            Ball2Y (e) := Ball2Y (e) + Ball2YV (e)
            if Ball2Y (e) = maxy - BallRadius
                    then
                Ball2YV (e) := -1 * Ball2YV (e)
            elsif Ball2Y (e) <= BallRadius
                    then
                Ball2YV (e) := 1
            end if
            if NumBall3 = 35
                    then
                NumBall3 := 34
            end if

            if Color = brightred and BoxX2 <= Ball2X (e) + BallRadius and BoxX1 >= Ball2X (e) - BallRadius and BoxY1 <= Ball2Y (e) + BallRadius and BoxY2 >= Ball2Y (e) - BallRadius
                    then
                delay (20)
                drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 12)
                BoxX1 := maxx div 2
                BoxX2 := maxx div 2.1
                BoxY1 := maxy div 10
                BoxY2 := maxy div 8
                LifeCounter3 := LifeCounter3 - 1
                if LifeCounter3 = 2
                        then
                    Box3c3 := 149
                    drawfillbox (125, 475, 135, 480, Box3c3)         %3rd
                end if
                if LifeCounter3 = 1
                        then
                    Box2c3 := 149
                    drawfillbox (105, 475, 115, 480, Box2c3)         %2nd
                end if
                if LifeCounter3 = 0
                        then
                    Box1c3 := 149
                    drawfillbox (85, 475, 95, 480, Box1c3)         %1st
                end if
            end if
        end for
        if LifeCounter3 <= 0
                then
            GameLost := false
            % reset := false
            HighScore := timeofaction
        end if
        drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, brightred)
        drawfilloval ((BoxX1 + BoxX2) div 2, (BoxY1 + BoxY2) div 2, 4, 4, black)
        Bullety := (BoxY1 + BoxY2) div 2
        Bulletx := (BoxX1 + BoxX2) div 2
        View.Update
        %cls
    end if
    %  View.Update
    %  cls
    %CONTROLS
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) and BoxY2 <= maxy
            then
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
    elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
            then
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
            then
        BoxX1 := BoxX1 + 1
        BoxX2 := BoxX2 + 1
    elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
            then
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
            then
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
            then
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
            then
        %delay (2)
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
            then
        %delay (2)
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    end if
    if
            chars ('g')
            then
        drawarc ((BoxX1 + BoxX2) div 2, (BoxY1 + BoxY2) div 2, 16, 16, 0, 360, white)
        Color := black
        View.Update
    else
        Color := brightred
    end if
    if chars ('s')
            then
        %  Font.Draw (Timme, maxx div 1.09, maxy div 1.05, font6, 31)
        %  Background1
        View.Update
        loop
            %cls
            Background1
            if LifeCounter = 3 then
                drawfillbox (125, 475, 135, 480, 12)
                drawfillbox (105, 475, 115, 480, 12)
                drawfillbox (85, 475, 95, 480, 12)
            elsif LifeCounter = 2 then
                drawfillbox (105, 475, 115, 480, 12)
                drawfillbox (85, 475, 95, 480, 12)
            elsif LifeCounter = 1 then
                drawfillbox (85, 475, 95, 480, 12)
            end if
            Font.Draw (Timme, maxx div 1.09, maxy div 1.05, font6, 31)
            drawfilloval (Bulletx, Bullety, 4, 4, black)
            Bullety := Bullety + 1
            if Bullety = maxy - 4
                    then
                ColorBall := 31
                exit
            end if
            % View.Update
            drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 12)
            for e : 1 .. NumBall3
                drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, brightred)
                drawfilloval (Ball2X (e), Ball2Y (e), BallRadius, BallRadius, ColorBall)
                Ball2X (e) := Ball2X (e) + Ball2XV (e)
                if Ball2X (e) - BallRadius = BallRadius
                        then
                    Ball2XV (e) := Ball2XV (e) * -1
                elsif Ball2X (e) + BallRadius >= maxx - BallRadius
                        then
                    Ball2XV (e) := Ball2XV (e) * -1
                    NumBall3 := NumBall3 + 1
                    randint (Ball2X (NumBall3), 0, maxx)         %X Position
                    randint (Ball2Y (NumBall3), 0, maxy)         %Y Position
                    Ball2YV (NumBall3) := 1
                    Ball2XV (NumBall3) := -1
                end if
                Ball2Y (e) := Ball2Y (e) + Ball2YV (e)
                if Ball2Y (e) = maxy - BallRadius
                        then
                    Ball2YV (e) := -1 * Ball2YV (e)
                elsif Ball2Y (e) <= BallRadius
                        then
                    Ball2YV (e) := 1
                end if
                if NumBall3 = 35
                        then
                    NumBall3 := 34
                end if
                if Color = brightred and BoxX2 <= Ball2X (e) + BallRadius and BoxX1 >= Ball2X (e) - BallRadius and BoxY1 <= Ball2Y (e) + BallRadius and BoxY2 >= Ball2Y (e) - BallRadius
                        then
                    delay (20)
                    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, 12)
                    BoxX1 := maxx div 2
                    BoxX2 := maxx div 2.1
                    BoxY1 := maxy div 10
                    BoxY2 := maxy div 8
                    LifeCounter3 := LifeCounter3 - 1
                    if LifeCounter3 = 2
                            then
                        drawfillbox (125, 475, 135, 480, 149)
                    end if
                    if LifeCounter3 = 1
                            then
                        drawfillbox (105, 475, 115, 480, 149)
                    end if
                    if LifeCounter3 = 0
                            then
                        drawfillbox (85, 475, 95, 480, 149)
                    end if
                end if
                if Math.Distance (Ball2X (e), Ball2Y (e), Bulletx, Bullety) <= 2 * BallRadius - 8
                        then
                    delay (100)
                    ColorBall := 12
                end if
            end for
            if LifeCounter3 <= 0
                    then
                GameLost := false
                % reset := false
                HighScore := timeofaction
            end if
            %View.Update
            Input.KeyDown (chars)
            if chars (KEY_UP_ARROW) and BoxY2 <= maxy
                    then
                BoxY1 := BoxY1 + 1
                BoxY2 := BoxY2 + 1
            elsif chars (KEY_DOWN_ARROW) and BoxY1 >= 0
                    then
                BoxY1 := BoxY1 - 1
                BoxY2 := BoxY2 - 1
            elsif chars (KEY_RIGHT_ARROW) and BoxX1 <= maxx
                    then
                BoxX1 := BoxX1 + 1
                BoxX2 := BoxX2 + 1
            elsif chars (KEY_LEFT_ARROW) and BoxX2 >= 0
                    then
                BoxX2 := BoxX2 - 1
                BoxX1 := BoxX1 - 1
            end if
            if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BoxX2 >= 0 and BoxY2 <= maxy
                    then
                BoxX2 := BoxX2 - 1
                BoxX1 := BoxX1 - 1
                BoxY1 := BoxY1 + 1
                BoxY2 := BoxY2 + 1
            end if
            if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BoxY2 <= maxy and BoxX1 <= maxx
                    then
                BoxX2 := BoxX2 + 1
                BoxX1 := BoxX1 + 1
                BoxY1 := BoxY1 + 1
                BoxY2 := BoxY2 + 1
            end if
            if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BoxX1 <= maxx and BoxY1 >= 0
                    then
                BoxX2 := BoxX2 + 1
                BoxX1 := BoxX1 + 1
                BoxY1 := BoxY1 - 1
                BoxY2 := BoxY2 - 1

            end if
            if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BoxY1 >= 0 and BoxX2 >= 0
                    then
                BoxX2 := BoxX2 - 1
                BoxX1 := BoxX1 - 1
                BoxY1 := BoxY1 - 1
                BoxY2 := BoxY2 - 1

            end if
            if
                    chars ('g')
                    then
                Color := black
                drawarc ((maxx div 2 + maxx div 2.1) div 2, (maxy div 10 + maxy div 8) div 2, 12, 12, 0, 360, white)
            end if
            if chars ('r')
                    then
                Color := brightred
            end if
            View.Update
            cls
        end loop
        cls
    end if
    View.Update
    cls

    if GameLost = false
            then
        loop
            var HighScoreString := intstr (HighScore, 1)
            var colormenu : int := white
            drawfillbox (0, 0, maxx, maxy, 54)
            Font.Draw ("Your Score was : ", maxx div 3, maxy div 1.5, font11, white)
            Font.Draw (HighScoreString, maxx div 2.2, maxy div 2, font11, white)
            View.Update
            cls
        end loop
        View.Update
        cls
    end if
end loop

Tuesday, 18 June 2013

Yesterday's Work

Sorry I didn't post yesterday, I was really busy with physics and such, but I did work a lot on this code!
Yesterday I was working on the full game code with all levels incorporated; it works for the first two levels but not the third level. Next steps are to incorporate the last level successfully in, and add small details.
My code:View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
font4 := Font.New ("Arial :20:bold")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
var timeofaction : int := Time.Elapsed
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of int
var Ball2YV : array 1 .. 100 of int
Ball2XV (1) := -1
Ball2YV (1) := 1
var t : int := 1
var CollisionCheck : real
procedure GameMenu %Creates Game Menu
    loop
        drawfillbox (0, 0, maxx, maxy, 103)
        Font.Draw ("Welcome To The World's Hardest Game", maxx div 7, maxy div 2, font1, red)
        Font.Draw ("To Start, Press 'S' ", maxx div 2, maxy div 4, font2, red)
        Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
        get chars1
        if chars1 = ('S')
                then
            exit
        elsif chars1 = ('C')
                then
            drawfillbox (0, 0, maxx, maxy, 103)
            Font.Draw ("Controls", maxx div 7, maxy div 1.13, font3, red)
            Font.Draw ("The controls are rather simple: Use the cursor keys to move.", 100, 401, font2, red)
            Font.Draw ("Avoid any bouncing balls as you will lose one of your 3 lives.", 100, 351, font2, red)
            Font.Draw ("Reach The 'CheckPoint' and you will progress into harder levels.", 100, 301, font2, red)
            Font.Draw ("If you progress far enough, you will gain the ability to shoot, at which point the 'SPACEBAR' will be the shoot button.", 100, 251, font2, red)
            Font.Draw ("Good Luck and Have Fun!", 100, 201, font2, red)
            Font.Draw ("To Start Press, 'S' ", maxx div 2.3, maxy div 13, font2, red)
            View.Update
        end if
        get chars2
        if chars2 = ('S')
                then
            exit

        end if
    end loop
end GameMenu

var Bulletx, Bullety : int
Bulletx := maxx div 2.05
Bullety := maxy div 9
GameMenu
proc NextLevel

    Font.Draw ("NEXT LEVEL", maxx div 3, maxy div 2, font1, red)
    %delay (5)
end NextLevel
proc Background
    drawfillbox (0, 0, maxx, maxy, 149)
end Background
var Bulletshot : boolean := false
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
    %Background
    drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    timeofaction := Time.Elapsed
    Timme := intstr (timeofaction, 1)
    Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)
    %drawfilloval (BallPlayerX, BallPlayerY, BallPlayerRadius, BallPlayerRadius, Color)
    %First Level
    if timeofaction <= 35000 then
        for d : 1 .. NumBall
            drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
            BallX (d) := BallX (d) + BallXV (d)
            if BallX (d) = maxx - BallRadius
                    then
                NumBall := NumBall + 1
                BallXV (NumBall) := -1
                t := t + 1
                randint (BallX (NumBall), 0, maxx)      %X Position
                randint (BallY (NumBall), 0, maxy)     %Y Position
                BallXV (d) := -1
            elsif
                    BallX (d) = BallRadius
                    then
                BallXV (d) := 1
            end if
            if NumBall = 35
                    then
                NumBall := 34
            end if
            if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                    then
                % delay (200)
            end if
        end for
    elsif timeofaction > 35000 and timeofaction <= 55000


        %Timer


        %   NextLevel
        %      exit
        %%    end if
        %  end for
        % if Timer >= 35000
        %     then
        % Background

            then
        for j : 1 .. NumBall2
            drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
            drawfilloval (Ball2X (j), Ball2Y (j), BallRadius, BallRadius, 31)
            Ball2X (j) := Ball2X (j) + Ball2XV (j)
            if Ball2X (j) - BallRadius = BallRadius
                    then
                Ball2XV (j) := Ball2XV (j) * -1
            elsif Ball2X (j) + BallRadius >= maxx - BallRadius
                    then
                Ball2XV (j) := Ball2XV (j) * -1
                NumBall2 := NumBall2 + 1
                randint (Ball2X (NumBall2), 0, maxx)     %X Position
                randint (Ball2Y (NumBall2), 0, maxy)     %Y Position
                Ball2YV (NumBall2) := 1
                Ball2XV (NumBall2) := -1
            end if
            Ball2Y (j) := Ball2Y (j) + Ball2YV (j)
            if Ball2Y (j) = maxy - BallRadius
                    then
                Ball2YV (j) := -1 * Ball2YV (j)
            elsif Ball2Y (j) <= BallRadius
                    then
                Ball2YV (j) := 1
            end if
            if NumBall2 = 35
                    then
                NumBall2 := 34
            end if
            if Color = brightred and BoxX2 <= Ball2X (j) + BallRadius and BoxX1 >= Ball2X (j) - BallRadius and BoxY1 <= Ball2Y (j) + BallRadius and BoxY2 >= Ball2Y (j) - BallRadius
                    then
                %delay (200)
            end if
        end for
        Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)
        %  View.Update

    elsif
            timeofaction > 55000
            then
        Bulletshot := true
        if Bulletshot = true
                then
            drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
            drawfilloval ((BoxX1 + BoxX2) div 2, (BoxY1 + BoxY2) div 2, 4, 4, black)
            Bullety := (BoxY1 + BoxY2) div 2
            Bulletx := (BoxX1 + BoxX2) div 2
            Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)
        end if
        View.Update
        cls
        %CONTROLS
        Input.KeyDown (chars)
        if chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BoxY2 <= maxy
                then
            BoxY1 := BoxY1 + 1
            BoxY2 := BoxY2 + 1
            BallPlayerY := BallPlayerY + 1
        elsif chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BoxY1 >= 0
                then
            BallPlayerY := BallPlayerY - 1
            BoxY1 := BoxY1 - 1
            BoxY2 := BoxY2 - 1
        elsif chars (KEY_RIGHT_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BoxX1 <= maxx
                then
            BoxX1 := BoxX1 + 1
            BoxX2 := BoxX2 + 1
            BallPlayerX := BallPlayerX + 1
        elsif chars (KEY_LEFT_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BoxX2 >= 0
                then
            BallPlayerX := BallPlayerX - 1
            BoxX2 := BoxX2 - 1
            BoxX1 := BoxX1 - 1
        end if
        if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BallPlayerY + BallPlayerRadius <= maxy and BoxX2 >= 0 and BoxY2 <= maxy
                then
            BallPlayerX := BallPlayerX - 1
            BallPlayerY := BallPlayerY + 1
            BoxX2 := BoxX2 - 1
            BoxX1 := BoxX1 - 1
            BoxY1 := BoxY1 + 1
            BoxY2 := BoxY2 + 1
        end if
        if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BallPlayerX + BallPlayerRadius <= maxx and BoxY2 <= maxy and BoxX1 <= maxx
                then
            BallPlayerX := BallPlayerX + 1
            BallPlayerY := BallPlayerY + 1
            BoxX2 := BoxX2 + 1
            BoxX1 := BoxX1 + 1
            BoxY1 := BoxY1 + 1
            BoxY2 := BoxY2 + 1
        end if
        if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BallPlayerY - BallPlayerRadius >= 0 and BoxX1 <= maxx and BoxY1 >= 0
                then
            %delay (2)
            BallPlayerX := BallPlayerX + 1
            BallPlayerY := BallPlayerY - 1
            BoxX2 := BoxX2 + 1
            BoxX1 := BoxX1 + 1
            BoxY1 := BoxY1 - 1
            BoxY2 := BoxY2 - 1
        end if
        if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BallPlayerX - BallPlayerRadius >= 0 and BoxY1 >= 0 and BoxX2 >= 0
                then
            %delay (2)
            BallPlayerX := BallPlayerX - 1
            BallPlayerY := BallPlayerY - 1
            BoxX2 := BoxX2 - 1
            BoxX1 := BoxX1 - 1
            BoxY1 := BoxY1 - 1
            BoxY2 := BoxY2 - 1
        end if
        if
                chars ('g')
                then
            Color := black
        end if
        if chars ('r')
                then
            Color := brightred
        end if

    end loop

Friday, 14 June 2013

Third Level

Today, I worked on my third level. The third level incorporates a shoot button which allows you to actually destroy some of the balls that you are trying to avoid. So far, I have completed the basic bullet animation when activated and I have figured out how to involve procedures within the code for this to be more effective. Next steps are to finish the collision check for the bullet and bouncing ball and make it more aesthetically pleasing to look at.
My Code :View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
Color := brightred
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
NumBall2 := 1
var Ballx : array 1 .. 1000 of int
var Bally : array 1 .. 1000 of int
randint (Ballx (NumBall2), 0, maxx)
randint (Bally (NumBall2), 0, maxy)
var Balldirx : array 1 .. 1000 of int
var Balldiry : array 1 .. 1000 of int
Balldirx (1) := -1
Balldiry (1) := 1
var Bulletx, Bullety : int
Bulletx := maxx div 2.05
Bullety := maxy div 9
proc Shoot

end Shoot
loop
    View.Update
    cls
    for d : 1 .. NumBall2
        drawfilloval (Ballx (d), Bally (d), BallRadius, BallRadius, red)
        Ballx (d) := Ballx (d) + Balldirx (d)
        if Ballx (d) - 9 = 9 then
            Balldirx (d) := Balldirx (d) * -1
        elsif Ballx (d) + BallRadius >= maxx - BallRadius
                then
            Balldirx (d) := -1 * Balldirx (d)
            NumBall2 := NumBall2 + 1
            randint (Ballx (NumBall2), 0, maxx)
            randint (Bally (NumBall2), 0, maxy)
            Balldirx (NumBall2) := -1
            Balldiry (NumBall2) := 1
        end if
        Bally (d) := Bally (d) + Balldiry (d)
        if Bally (d) >= maxy - BallRadius
                then
            Balldiry (d) := -1 * Balldiry (d)
        elsif Bally (d) <= BallRadius
                then
            Balldiry (d) := 1
        end if
        if Color = brightred and BoxX2 <= Ballx (d) + BallRadius and BoxX1 >= Ballx (d) - BallRadius and BoxY1 <= Bally (d) + BallRadius and BoxY2 >= Bally (d) - BallRadius
                then
            delay (200)
        end if
    end for
    if Time.Elapsed > 20000
            then
        cls
        exit
    end if
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    drawfilloval (Bulletx, Bullety, 4, 4, blue)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BoxY2 <= maxy
            then
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
        BallPlayerY := BallPlayerY + 1
        Bullety := Bullety + 1
    elsif chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BoxY1 >= 0
            then
        BallPlayerY := BallPlayerY - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
        Bullety := Bullety - 1
    elsif chars (KEY_RIGHT_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BoxX1 <= maxx
            then
        BoxX1 := BoxX1 + 1
        BoxX2 := BoxX2 + 1
        BallPlayerX := BallPlayerX + 1
        Bulletx := Bulletx + 1
    elsif chars (KEY_LEFT_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BoxX2 >= 0
            then
        BallPlayerX := BallPlayerX - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        Bulletx := Bulletx - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BallPlayerY + BallPlayerRadius <= maxy and BoxX2 >= 0 and BoxY2 <= maxy
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY + 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
        Bulletx := Bulletx - 1
        Bullety := Bullety + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BallPlayerX + BallPlayerRadius <= maxx and BoxY2 <= maxy and BoxX1 <= maxx
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY + 1
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
        Bulletx := Bulletx + 1
        Bullety := Bullety + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BallPlayerY - BallPlayerRadius >= 0 and BoxX1 <= maxx and BoxY1 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY - 1
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
        Bulletx := Bulletx + 1
        Bullety := Bullety - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BallPlayerX - BallPlayerRadius >= 0 and BoxY1 >= 0 and BoxX2 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
        Bulletx := Bulletx - 1
        Bullety := Bullety - 1
    end if
    if
            chars ('g')
            then
        Color := black
    end if
    if chars ('r')
            then
        Color := brightred
    end if
    if chars ('s')
            then
        loop
        cls  
        drawfilloval (Bulletx, Bullety, 4, 4, blue)
            Bullety := Bullety + 1
         

            drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
            for d : 1 .. NumBall2
                drawfilloval (Ballx (d), Bally (d), BallRadius, BallRadius, red)
                Ballx (d) := Ballx (d) + Balldirx (d)
                if Ballx (d) - 9 = 9 then
                    Balldirx (d) := Balldirx (d) * -1
                elsif Ballx (d) + BallRadius >= maxx - BallRadius
                        then
                    Balldirx (d) := -1 * Balldirx (d)
                    NumBall2 := NumBall2 + 1
                    randint (Ballx (NumBall2), 0, maxx)
                    randint (Bally (NumBall2), 0, maxy)
                    Balldirx (NumBall2) := -1
                    Balldiry (NumBall2) := 1
                end if
                Bally (d) := Bally (d) + Balldiry (d)
                if Bally (d) >= maxy - BallRadius
                        then
                    Balldiry (d) := -1 * Balldiry (d)
                elsif Bally (d) <= BallRadius
                        then
                    Balldiry (d) := 1
                end if
                if Color = brightred and BoxX2 <= Ballx (d) + BallRadius and BoxX1 >= Ballx (d) - BallRadius and BoxY1 <= Bally (d) + BallRadius and BoxY2 >= Bally (d) - BallRadius
                        then
                    delay (200)
                end if
            end for

            View.Update
        end loop
    end if

end loop
put "Game has exited"

Thursday, 13 June 2013

Semi Productive

Today was only semi productive, I could not make both levels successfully in the loop but I had managed to incorporate the second level loop with the control loop, I just need to get the procedures and placements correctly, I also learned and developed my 3rd level and will work on this tomorrow.
My Code :View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
font4 := Font.New ("Arial :20:bold")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of real
var Ball2YV : array 1 .. 100 of real
Ball2XV (1) := -1
Ball2YV (1) := 1
var CollisionCheck : real
NumBall2 := 1
    var Ballx : array 1 .. 1000 of int
    var Bally : array 1 .. 1000 of int
    randint (Ballx (NumBall2), 0, maxx)
    randint (Bally (NumBall2), 0, maxy)
    var Balldirx : array 1 .. 1000 of int
    var Balldiry : array 1 .. 1000 of int
    Balldirx (1) := -1
    Balldiry (1) := 1
loop
   
     for d : 1 .. NumBall2
            drawfilloval (Ballx (d), Bally (d), BallRadius, BallRadius, 31)
            Ballx (d) := Ballx (d) + Balldirx (d)
            if Ballx (d) - 9 = 9 then
                Balldirx (d) := Balldirx (d) * -1
            elsif Ballx (d) + BallRadius >= maxx - BallRadius
                    then
                Balldirx (d) := -1 * Balldirx (d)
                NumBall2 := NumBall2 + 1
                randint (Ballx (NumBall2), 0, maxx)
                randint (Bally (NumBall2), 0, maxy)
                Balldirx (NumBall2) := -1
                Balldiry (NumBall2) := 1
            end if
            Bally (d) := Bally (d) + Balldiry (d)
            if Bally (d) >= maxy - BallRadius
                    then
                Balldiry (d) := -1 * Balldiry (d)
            elsif Bally (d) <= BallRadius
                    then
                Balldiry (d) := 1
            end if
        end for
        View.Update
        delay (5)
 
 View.Update
 cls
drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
  Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BoxY2 <= maxy
            then
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
        BallPlayerY := BallPlayerY + 1
    elsif chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BoxY1 >= 0
            then
        BallPlayerY := BallPlayerY - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    elsif chars (KEY_RIGHT_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BoxX1 <= maxx
            then
        BoxX1 := BoxX1 + 1
        BoxX2 := BoxX2 + 1
        BallPlayerX := BallPlayerX + 1
    elsif chars (KEY_LEFT_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BoxX2 >= 0
            then
        BallPlayerX := BallPlayerX - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BallPlayerY + BallPlayerRadius <= maxy and BoxX2 >= 0 and BoxY2 <= maxy
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY + 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BallPlayerX + BallPlayerRadius <= maxx and BoxY2 <= maxy and BoxX1 <= maxx
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY + 1
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 + 1
        BoxY2 := BoxY2 + 1
    end if
    if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BallPlayerY - BallPlayerRadius >= 0 and BoxX1 <= maxx and BoxY1 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX + 1
        BallPlayerY := BallPlayerY - 1
        BoxX2 := BoxX2 + 1
        BoxX1 := BoxX1 + 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    end if
    if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BallPlayerX - BallPlayerRadius >= 0 and BoxY1 >= 0 and BoxX2 >= 0
            then
        delay (2)
        BallPlayerX := BallPlayerX - 1
        BallPlayerY := BallPlayerY - 1
        BoxX2 := BoxX2 - 1
        BoxX1 := BoxX1 - 1
        BoxY1 := BoxY1 - 1
        BoxY2 := BoxY2 - 1
    end if
    if
            chars ('g')
            then
        Color := black
    end if
    if chars ('r')
            then
        Color := brightred
    end if
end loop

   

June 12-Success!

Today was very fruitful. I had fixed my second level code with the help with Mr. Van Rooyen.  I learned that  I need to change the vector of the ball that bounces first; the numball. After it bounces off the right wall, that ball as well as the new ball has different vectors so that it maintains its bouncing.
I need to now incorporate it into my overall game code.
I must think about making a boolean that will cover all levels and make the overall code more effecient.
Next Step is to make a 3rd level.
My Code View.Set ("graphics,offscreenonly")
var NumBall2 : int
NumBall2 := 1
var Ballx : array 1 .. 1000 of int
var Bally : array 1 .. 1000 of int
randint (Ballx (NumBall2), 0, maxx)
randint (Bally (NumBall2), 0, maxy)
var Balldirx : array 1 .. 1000 of int
var Balldiry : array 1 .. 1000 of int
Balldirx (1) := -1
Balldiry (1) := 1
loop
    cls
    for d : 1 .. NumBall2
        drawfilloval (Ballx (d), Bally (d), 9, 9, green)
        Ballx (d) := Ballx (d) + Balldirx (d)
        if Ballx (d) - 9 = 9 then
            Balldirx (d) := Balldirx (d) * -1
        elsif Ballx (d) + 9 >= maxx - 9
                then
            Balldirx (d) := -1 * Balldirx (d)
            NumBall2 := NumBall2 + 1
            randint (Ballx (NumBall2), 0, maxx)
            randint (Bally (NumBall2), 0, maxy)
            Balldirx (NumBall2) := -1
            Balldiry (NumBall2) := 1
   
             end if
        Bally (d) := Bally (d) + Balldiry (d)
        if Bally (d) >= maxy - 9
                then
            Balldiry (d) := -1 * Balldiry (d)
        elsif Bally (d) <= 9
                then
            Balldiry (d) := 1
        end if
    end for
    View.Update
  delay (5)
end loop

Tuesday, 11 June 2013

June 11th-Second Level

Today was very productive. Mr VanRooyen helped me fix my second level with two vectors. The problem was that the original ball would not change its direction after it hit the right wall so it would draw all 100 balls in a matter of seconds. This was fixed after we changed the vectors once the ball hits the right hand side.
Next steps are to incorporate it into the full game code and finish making the last level. My second level code:View.Set ("graphics,offscreenonly")
var NumBall : int
NumBall := 1
var Ballx : array 1 .. 100 of int
var Bally : array 1 .. 100 of int
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)
var Balldirx : array 1 .. 100 of int
var Balldiry : array 1 .. 100 of int
Balldirx (1) := -1
Balldiry (1) := 1
loop
    cls
    for d : 1 .. NumBall

        drawfilloval (Ballx (d), Bally (d), 9, 9, green)
        Ballx (d) := Ballx (d) + Balldirx (d)
        if Ballx (d) - 9 = 9 then
            Balldirx (d) := Balldirx (d) * -1
        elsif Ballx (d) + 9 >= maxx - 9
                then
            Balldirx (d) := -1 * Balldirx (d)
            NumBall := NumBall + 1
            randint (Ballx (NumBall), 0, maxx)
            randint (Bally (NumBall), 0, maxy)
            Balldirx (NumBall) := -1
            Balldiry (NumBall) := 1
   
             end if
        Bally (d) := Bally (d) + Balldiry (d)
        if Bally (d) >= maxy - 9
                then
            Balldiry (d) := -1 * Balldiry (d)
        elsif Bally (d) <= 9
                then
            Balldiry (d) := 1


        end if
    end for
    View.Update
  delay (5)


end loop

Monday, 10 June 2013

Sorry I've Been Away;Techinical Problems-Posts from June 4th -June 10th (explanation within)

Hello. It appears as though I have not been posting on this blog (which I have been) 

because it seems that my blog was not able to publish any of my posts; 

after I would write each post, it would say that it has been published but they were all just 

'drafts' that weren't actually published. I did not know that this was happening so when 

I went to read my blog on a different computer, it didn't not show any of the my posts since 

last week. I still have the drafts so I will post all drafts (June 4th-June10th ) now. Sorry for 

any inconvenience.

June 4th
Today, I have worked on getting my collisions intact, this is has taken me a very long time in perfecting but I have finally got the correct if statements in my code for the ball to recognize if it is hitting anything. So far, I have only created a delay when they interact because I am not sure what I should do; but since I have the collision, I can worry about that another day.Next steps are to create a timer and start thinking about new levels.
My code:
for d : 1 .. NumBall
        drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
        BallX (d) := BallX (d) + BallXV (d)
        if BallX (d) = maxx - BallRadius
                then
            NumBall := NumBall + 1
            BallXV (NumBall) := -1
            randint (BallX (NumBall), 0, maxx)         %X Position
            randint (BallY (NumBall), 0, maxy)         %Y Position
            BallXV (d) := -1
        elsif
                BallX (d) = BallRadius
                then
            BallXV (d) := 1
        end if
        if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                then
            delay (200)
        end if

June 5th
Today I have attempted to create a timer using a combination of intstring and also the the Time.Elapsed function. It appears that it the timer is not going steadily up and I've tried a number of ways. The one benefit is that it is drawing and being updated; the only problem is to understand if there is a correlation between the timer and the number of balls that is being drawn. I should have this solved by tomorrow and think about next steps and levels.
My code:
 for d : 1 .. NumBall
        drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
        BallX (d) := BallX (d) + BallXV (d)
        if BallX (d) = maxx - BallRadius
                then
            NumBall := NumBall + 1
            BallXV (NumBall) := -1
            randint (BallX (NumBall), 0, maxx)         %X Position
            randint (BallY (NumBall), 0, maxy)         %Y Position
            BallXV (d) := -1
        elsif
                BallX (d) = BallRadius
                then
            BallXV (d) := 1
        end if
        if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                then
            delay (200)
        end if
        %Timer
      %  var timeofaction : int := Time.Elapsed
        Timme := intstr (timeofaction, 1)
        Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)
        if timeofaction >= 35000
                then
            exit
        end if
    end for
June 6th
Today has been productive. I have completed my timer and have also thought of the level ahead; after 35 seconds of withstanding the first level, the balls will change in orientation moving up,down,left and right at different times. This should increase difficulty level by a lot so I have thought of giving the level only 25 seconds. This has been frutiful in terms of concepts and the actual code as well.
My code:
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
font4 := Font.New ("Arial :20:bold")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of real
var Ball2YV : array 1 .. 100 of real
Ball2XV (1) := -1
Ball2YV (1) := 1
var CollisionCheck : real
procedure GameMenu %Creates Game Menu
    loop
        drawfillbox (0, 0, maxx, maxy, 103)
        Font.Draw ("Welcome To The World's Hardest Game", maxx div 7, maxy div 2, font1, red)
        Font.Draw ("To Start, Press 'S' ", maxx div 2, maxy div 4, font2, red)
        Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
        get chars1
        if chars1 = ('S')
                then
            exit
        elsif chars1 = ('C')
                then
            drawfillbox (0, 0, maxx, maxy, 103)
            Font.Draw ("Controls", maxx div 7, maxy div 1.13, font3, red)
            Font.Draw ("The controls are rather simple: Use the cursor keys to move.", 100, 401, font2, red)
            Font.Draw ("Avoid any bouncing balls as you will lose one of your 3 lives.", 100, 351, font2, red)
            Font.Draw ("Reach The 'CheckPoint' and you will progress into harder levels.", 100, 301, font2, red)
            Font.Draw ("If you progress far enough, you will gain the ability to shoot, at which point the 'SPACEBAR' will be the shoot button.", 100, 251, font2, red)
            Font.Draw ("Good Luck and Have Fun!", 100, 201, font2, red)
            Font.Draw ("To Start Press, 'S' ", maxx div 2.3, maxy div 13, font2, red)
            View.Update
        end if
        get chars2
        if chars2 = ('S')
                then
            exit

        end if
    end loop
end GameMenu
GameMenu
proc NextLevel
    drawfillbox (0, 0, maxx, maxy, white)
    Font.Draw ("NEXT LEVEL", maxx div 3, maxy div 2, font1, red)
    delay (500)
end NextLevel
loop
    drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    %drawfilloval (BallPlayerX, BallPlayerY, BallPlayerRadius, BallPlayerRadius, Color)
    %First Level
    for d : 1 .. NumBall
        drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
        BallX (d) := BallX (d) + BallXV (d)
        if BallX (d) = maxx - BallRadius
                then
            NumBall := NumBall + 1
            BallXV (NumBall) := -1
            randint (BallX (NumBall), 0, maxx)         %X Position
            randint (BallY (NumBall), 0, maxy)         %Y Position
            BallXV (d) := -1
        elsif
                BallX (d) = BallRadius
                then
            BallXV (d) := 1
        end if
        if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                then
            delay (200)
        end if
        %Timer
        var timeofaction : int := Time.Elapsed
        Timme := intstr (timeofaction, 1)
        Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)
        if timeofaction >= 35000
                then
            exit
        end if
    end for
June 7th
Today has been a fun day. I heard Mr.Van Rooyen talk about coded glitches and I have thought of adding an option where the box that you control will turn black and will automatically dodge the balls so you don't have to do anything. I have also coded into my game an option that that will let you turn into a circle as opposed to a box and every time your circle goes through one of the oncoming balls, the ball that the user is controlling will change. It is a fun little 'hack' but I will have to think about how the user will get the chance to make that decision.
View.Set ("graphics:1000;500,buttonbar,offscreenonly")
var BoxX1, BoxX2, BoxY1, BoxY2, BallRadius, move, BallRand, Color, font1, font2, font3, font4 : int
var BallPlayerX, BallPlayerY, BallPlayerRadius : int
BallPlayerX := maxx div 2
BallPlayerY := maxy div 10
BallPlayerRadius := 4
var chars : array char of boolean
var Timme : string
var chars1, chars2 : char
var Timer : int := 35
var timee : int := 0
var StringTimer : string
BoxX1 := maxx div 2
BoxX2 := maxx div 2.1
BoxY1 := maxy div 10
BoxY2 := maxy div 8
BallRadius := 12
move := 1
BallRand := Rand.Int (10, 1000)
Color := brightred
font1 := Font.New ("Comic Sans:30:bold,underline")
font2 := Font.New ("Comic Sans:10:underline")
font3 := Font.New ("Comic Sans :30:bold")
font4 := Font.New ("Arial :20:bold")
BallRadius := 12
var BallX : array 1 .. 100 of int % Array of 10 Balls for x position
var BallY : array 1 .. 100 of int % Array of 10 Balls, for y position
var Ball2X : array 1 .. 100 of int
var Ball2Y : array 1 .. 100 of int
var NumBall : int := 1
var NumBall2 : int := 1
randint (BallX (NumBall), 0, maxx) %X Position
randint (BallY (NumBall), 0, maxy) %Y Position
randint (Ball2X (NumBall2), 0, maxx) %X Position for second level
randint (Ball2Y (NumBall2), 0, maxy) %Y Position for second level
var BallXV : array 1 .. 100 of int
BallXV (1) := -1
var Ball2XV : array 1 .. 100 of real
var Ball2YV : array 1 .. 100 of real
Ball2XV (1) := -1
Ball2YV (1) := 1
var CollisionCheck : real
procedure GameMenu %Creates Game Menu
    loop
        drawfillbox (0, 0, maxx, maxy, 103)
        Font.Draw ("Welcome To The World's Hardest Game", maxx div 7, maxy div 2, font1, red)
        Font.Draw ("To Start, Press 'S' ", maxx div 2, maxy div 4, font2, red)
        Font.Draw ("To View Controls, Press 'C' ", maxx div 2, maxy div 6, font2, red)
        get chars1
        if chars1 = ('S')
                then
            exit
        elsif chars1 = ('C')
                then
            drawfillbox (0, 0, maxx, maxy, 103)
            Font.Draw ("Controls", maxx div 7, maxy div 1.13, font3, red)
            Font.Draw ("The controls are rather simple: Use the cursor keys to move.", 100, 401, font2, red)
            Font.Draw ("Avoid any bouncing balls as you will lose one of your 3 lives.", 100, 351, font2, red)
            Font.Draw ("Reach The 'CheckPoint' and you will progress into harder levels.", 100, 301, font2, red)
            Font.Draw ("If you progress far enough, you will gain the ability to shoot, at which point the 'SPACEBAR' will be the shoot button.", 100, 251, font2, red)
            Font.Draw ("Good Luck and Have Fun!", 100, 201, font2, red)
            Font.Draw ("To Start Press, 'S' ", maxx div 2.3, maxy div 13, font2, red)
            View.Update
        end if
        get chars2
        if chars2 = ('S')
                then
            exit

        end if
    end loop
end GameMenu
GameMenu
proc NextLevel
    drawfillbox (0, 0, maxx, maxy, white)
    Font.Draw ("NEXT LEVEL", maxx div 3, maxy div 2, font1, red)
    delay (500)
end NextLevel
loop
    drawfillbox (0, 0, maxx, maxy, 149)
    drawfillbox (BoxX1, BoxY1, BoxX2, BoxY2, Color)
    %drawfilloval (BallPlayerX, BallPlayerY, BallPlayerRadius, BallPlayerRadius, Color)
    %First Level
    for d : 1 .. NumBall
        drawfilloval (BallX (d), BallY (d), BallRadius, BallRadius, 31)
        BallX (d) := BallX (d) + BallXV (d)
        if BallX (d) = maxx - BallRadius
                then
            NumBall := NumBall + 1
            BallXV (NumBall) := -1
            randint (BallX (NumBall), 0, maxx)         %X Position
            randint (BallY (NumBall), 0, maxy)         %Y Position
            BallXV (d) := -1
        elsif
                BallX (d) = BallRadius
                then
            BallXV (d) := 1
        end if
        if Color = brightred and BoxX2 <= BallX (d) + BallRadius and BoxX1 >= BallX (d) - BallRadius and BoxY1 <= BallY (d) + BallRadius and BoxY2 >= BallY (d) - BallRadius
                then
            delay (200)
        end if
        %Timer
        var timeofaction : int := Time.Elapsed
        Timme := intstr (timeofaction, 1)

        Font.Draw (Timme, maxx div 1.2, maxy div 1.1, font1, 31)

        if timeofaction >= 35000
                then
            exit
        end if
    end for
 View.Update
cls
%CONTROLS
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BoxY2 <= maxy
        then
    BoxY1 := BoxY1 + 1
    BoxY2 := BoxY2 + 1
    BallPlayerY := BallPlayerY + 1
elsif chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BoxY1 >= 0
        then
    BallPlayerY := BallPlayerY - 1
    BoxY1 := BoxY1 - 1
    BoxY2 := BoxY2 - 1

elsif chars (KEY_RIGHT_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BoxX1 <= maxx
        then
    BoxX1 := BoxX1 + 1
    BoxX2 := BoxX2 + 1

    BallPlayerX := BallPlayerX + 1
elsif chars (KEY_LEFT_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BoxX2 >= 0
        then
    BallPlayerX := BallPlayerX - 1
    BoxX2 := BoxX2 - 1
    BoxX1 := BoxX1 - 1

end if
if chars (KEY_LEFT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerX - BallPlayerRadius >= 0 and BallPlayerY + BallPlayerRadius <= maxy and BoxX2 >= 0 and BoxY2 <= maxy
        then
    delay (2)
    BallPlayerX := BallPlayerX - 1
    BallPlayerY := BallPlayerY + 1
    BoxX2 := BoxX2 - 1
    BoxX1 := BoxX1 - 1
    BoxY1 := BoxY1 + 1
    BoxY2 := BoxY2 + 1
end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_UP_ARROW) and BallPlayerY + BallPlayerRadius <= maxy and BallPlayerX + BallPlayerRadius <= maxx and BoxY2 <= maxy and BoxX1 <= maxx
        then

    delay (2)
    BallPlayerX := BallPlayerX + 1
    BallPlayerY := BallPlayerY + 1
    BoxX2 := BoxX2 + 1
    BoxX1 := BoxX1 + 1
    BoxY1 := BoxY1 + 1
    BoxY2 := BoxY2 + 1


end if
if chars (KEY_RIGHT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerX + BallPlayerRadius <= maxx and BallPlayerY - BallPlayerRadius >= 0 and BoxX1 <= maxx and BoxY1 >= 0
        then
    delay (2)
    BallPlayerX := BallPlayerX + 1
    BallPlayerY := BallPlayerY - 1
    BoxX2 := BoxX2 + 1
    BoxX1 := BoxX1 + 1
    BoxY1 := BoxY1 - 1
    BoxY2 := BoxY2 - 1



end if
if chars (KEY_LEFT_ARROW) and chars (KEY_DOWN_ARROW) and BallPlayerY - BallPlayerRadius >= 0 and BallPlayerX - BallPlayerRadius >= 0 and BoxY1 >= 0 and BoxX2 >= 0
        then
    delay (2)
    BallPlayerX := BallPlayerX - 1
    BallPlayerY := BallPlayerY - 1
    BoxX2 := BoxX2 - 1
    BoxX1 := BoxX1 - 1
    BoxY1 := BoxY1 - 1
    BoxY2 := BoxY2 - 1
end if
if
        chars ('g')
        then
    Color := black
end if

if chars ('r')
        then
    Color := brightred
end if
end loop
June 8th
Today was not very productive, I have tried to create the second level in my 3 level game but it is much harder than I thought. I am adding two vectors to the balls moving and it is very confusing. I am sure that it is similar to pong with the x and y vectors; but finding the boundries and values etc.. are very confusing. I will have to work on this at home :
var BallRadius, Balldirx, Balldiry, NumBall : int
BallRadius := 9
Balldirx := -1
Balldiry := 1
NumBall := 1
var Ballx : array 1 .. 100 of int
var Bally : array 1 .. 100 of int
var Ballxv : array 1 .. 100 of int
var Ballyv : array 1 .. 100 of int
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)
Ballxv (1) := -1
Ballyv (1) := 1
loop
    for d : 1 .. NumBall
        delay (5)
        drawfilloval (Ballx (d), Bally (d), BallRadius, BallRadius, green)
        Ballx (d) := Ballx (d) + Ballxv (d)
        if Ballx (d) - 9 = 9 then
            Ballxv (d) := Ballxv (d) * -1
            Ballyv (d) := 1
        elsif Ballx (d) + 9 >= maxx - BallRadius
                then
            Ballxv (NumBall) := 1
          
            Ballyv (NumBall) := -1 * Ballyv (d)
        end if
        Bally (d) := Bally (d) + Ballyv (d)
        if Bally (d) >= maxy - BallRadius
                then
            Ballyv (d) := -1 * Ballyv (d)
        elsif Bally (d) <= BallRadius
                then
            Ballyv (d) := -1*Ballyv(d)
        end if

        View.Update
    
        end for
end loop
June 9th
Today has only been satisfactory, I have solved how to make one ball move with the 2 vectors with all including the boundry of both sides. I have started working on how to do more than one ball but to no avail, I will work on this at home as well. 
My code:var Balldirx, Balldiry, NumBall : int
NumBall := 1
var Ballx : array 1 .. 100 of int
var Bally : array 1 .. 100 of int
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)


Balldirx := -1
Balldiry := 1
loop
    for d : 1 .. NumBall
        drawfilloval (Ballx (d), Bally (d), 9, 9, green)
        Ballx (d) := Ballx (d) + Balldirx
        if Ballx (d) - 9 = 9 then
            Balldirx := Balldirx * -1
        elsif Ballx (d) + 9 >= maxx - 9
                then
            Balldirx := Balldirx * -1
            
        end if
        Bally (d) := Bally (d) + Balldiry
        if Bally (d) >= maxy - 9
                then
            Balldiry := -1 * Balldiry
        elsif Bally (d) <= 9
                then
            Balldiry := 1
        end if
        delay (1)
    end for
    View.Update
    cls
end loop
June 10th
I have made a lot of progress on the second level, but I am not quite there. I realized that I would have to make an array for ALL of the speeds of the balls. The problem I am having is that only when the first ball hits the wall a new one is being created. I also noticed is that they all take the same path of motion as the first ball so I will have to ask for some help on that. I will work on this at home as well.
My code:var Balldirx, Balldiry, NumBall : int
NumBall := 1
var Ballx : array 1 .. 100 of int
var Bally : array 1 .. 100 of int
randint (Ballx (NumBall), 0, maxx)
randint (Bally (NumBall), 0, maxy)


Balldirx := -1
Balldiry := 1
loop
    for d : 1 .. NumBall
        drawfilloval (Ballx (d), Bally (d), 9, 9, green)
        Ballx (d) := Ballx (d) + Balldirx
        if Ballx (d) - 9 = 9 then
            Balldirx := Balldirx * -1
        elsif Ballx (d) + 9 >= maxx - 9
                then
            Balldirx := Balldirx * -1
            NumBall := NumBall + 1
            randint (Ballx (NumBall), 0, maxx)
            randint (Bally (NumBall), 0, maxy)
        end if
        Bally (d) := Bally (d) + Balldiry
        if Bally (d) >= maxy - 9
                then
            Balldiry := -1 * Balldiry
        elsif Bally (d) <= 9
                then
            Balldiry := 1
        end if
        delay (1)
    end for
    View.Update
    cls
end loop