Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Gr. 10 Game
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Parker




PostPosted: Tue Nov 25, 2008 9:33 am   Post subject: Gr. 10 Game

Hey, before I talk abou the game I will just let you know I recently joined. I have been using this site for 2-3 months but haven't registered an account until now. I have worked on a few games, and I will post them here for comments etc. First off a game I call "Circular Danger" (Yes I know gay name but I'm not good with names lol.) I don't know how to upload the game so you can dowload it so I will just post the code, even though it is over 1300 lines but could be reduced to about 400 If I was smarter.

Turing:
View.Set ("position:center;center,offscreenonly, nocursor, nobuttonbar,title: Avoid the Circles!!")
% variables
var circle_1_x, circle_1_y, circle_1_radius : int
var circle_2_x, circle_2_y, circle_2_radius : int
var circle3x, circle3y, circle3radius : int
var circle4x, circle4y, circle4radius : int
var circle5x, circle5y, circle5radius : int
var circle6x, circle6y, circle6radius : int
var circle7x, circle7y, circle7radius : int
var circle8y, circle8x, circle8radius : int
var circle9y, circle9x, circle9radius : int
var x : int % your circle
var y : int % your circle
var circle_radius : int % your circle
var chars : array char of boolean
var xdir : int := 2 % all stuff for boundaries
var ydir : int := 2 % " "
var xdir2 : int := 3
var ydir2 : int := 3
var xdir3 : int := 5
var ydir3 : int := 5
var xdir4 : int := 4
var ydir4 : int := 4
var xdir5 : int := 10
var ydir5 : int := 10
var xdir6 : int := 2
var xdir7 : int := 2
var ydir8 : int := 2
var ydir9 : int := 2
var distance_between_centres : real % stuff for collision
var distance_betweeen_centres : real
var distance_betweeeen_centres : real
var distance_betweeeeen_centres : real
var distance_betweeeeeen_centres : real
var distance_between_centres1 : real
var distance_between_centres2 : real
var distance_between_centres3 : real
var distance_between_centres4 : real
var counter : int % To end levels at certain times
var counter2 : int
var counter3 : int
var counter4 : int
var counter5 : int
var font1 : int
var gameover : int
var youwin : int
var key : string (1)
var level : int
var choice : string
var deadoralive : string := "alive"
var colourcount : int := 32
%%%%%%%%%%%%%%%%%%%%%%%Mouse%%%%%%%%%%%%%%%%
var mx, my, mb : int := 0

%values of circles
circle_1_x := 50
circle_1_y := 200
circle_1_radius := 50
circle_2_x := 200
circle_2_y := 200
circle_2_radius := 70
circle3x := 450
circle3y := 85
circle3radius := 22
circle4x := 500
circle4y := 310
circle4radius := 45
circle5x := 70
circle5y := 100
circle5radius := 3
circle6x := 29
circle6y := 25
circle6radius := 30
circle7x := 300
circle7y := 370
circle7radius := 30
circle8x := 20
circle8y := 25
circle8radius := 30
circle9x := 612
circle9y := 380
circle9radius := 30
x := 150
y := 91
circle_radius := 23

counter3 := 0
counter2 := 0
counter := 0
counter4 := 0
counter5 := 0

%Fonts
font1 := Font.New ("Vineta BT:21:underline")
assert font1 > 0

gameover := Font.New ("Wide Latin:30:bold")
assert gameover > 0

youwin := Font.New ("Wide Latin:19:bold")
assert youwin > 0

level := Font.New ("Castellar:11")
assert level > 0

/*****TITLE PAGE*******/
loop
    cls
    drawfill (maxx, maxy, 10, 14)
    Font.Draw ("Welcome to Circular Danger", 9, 300, font1, 255)
    locatexy (1, 100)
    colorback (103)
    put "                         Press any key to continue" : 1
    getch (key)
    View.Update
    cls
    %%%%%%%%%%Choice Screen%%%%%%%%%%%%%%%
    View.Update
    drawfill (maxx, maxy, 42, 42)
    colorback (94)
    locatexy (1, 300)
    put "1.  How to Play...?"
    locatexy (1, 250)
    put "2.  Start the Game!!! (Using keys)"
    locatexy (1,200)
    put "3.  Start the Game!!! (Using mouse)"
    locatexy (1, 150)
    put "Please choose an option or enter a cheat."
    View.Update
    get choice
    cls
    if choice = "1" then
        %%%%%%%%%%%%%How to Play screen%%%%%%%%%%
        drawfill (maxx, maxy, 88, 88)
        colourback (118)
        locatexy (1, 350)
        put "                                  OBJECTIVE"
        colourback (68)
        locatexy (1, 290)
        put "The objective of circular danger is quite simple, AVOID the CIRCLES."
        colourback (118)
        locatexy (1, 230)
        put "                                  CONTROLS"
        colourback (68)
        locatexy (1, 170)
        put "You control the circle that flashes different colours using the arrow keys."
        put "Up arrow moves you up, Down arrow moves you down, Left arrow moves you left and the Right arrow moves you right."
        colourback (61)
        locatexy (1, 80)
        put "                       Press any key to start the game"
        View.Update
        getch (key)
        exit
    elsif choice = "2" then
        exit
    elsif choice = "smallcircle" then
        circle_radius := 5
        locatexy (1, 400)
        put "Cheat smallcircle activated."
        View.Update
        getch (key)
        exit
    elsif choice = "bigdanger" then
        circle_1_radius := 65
        circle_2_radius := 80
        circle3radius := 30
        circle4radius := 46
        circle5radius := 7
        circle_radius := 19
        locatexy (1, 400)
        put "Cheat bigdanger activated."
        put "Good luck, you will need it!"
        View.Update
        getch (key)
        exit
    elsif choice = "speedy" then
        locatexy (1, 400)
        put "Cheat speedy activated."
        put "Fasten your seatbelt."
        View.Update
        getch (key)
        exit
    elsif choice = "3" then
        exit
    end if
end loop



%%%%%%%%%%%%%Level 1 loop%%%%%%%%%%%%%

loop
    counter := counter + 1
    put counter
    if colourcount > 55 then
        colourcount := 32
    end if
    colourcount := colourcount + 1
    exit when counter > 700
    %for i : 1 .. 45
    %draw our circles
    cls
    drawfill (maxx, maxy, 101, 101)
    Font.Draw ("Level 1", 285, 380, level, 255)
    drawfilloval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)     %big one you're avoiding
    drawfilloval (circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)     %big one you're avoiding
    delay (8)
    View.Update
    % Move your circle
    Input.KeyDown (chars)
    if choice = "1" or choice = "2" then
        drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
        if choice = "smallcircle" then

            if chars (KEY_UP_ARROW) and y < 385 then
                y := y + 4
            end if
            if chars (KEY_RIGHT_ARROW) and x < 625 then
                x := x + 4
            end if
            if chars (KEY_LEFT_ARROW) and x > 14 then
                x := x - 4
            end if
            if chars (KEY_DOWN_ARROW) and y > 12 then
                y := y - 4
            end if

        elsif choice = "speedy" then

            if chars (KEY_UP_ARROW) and y < 375 then
                y := y + 8
            end if
            if chars (KEY_RIGHT_ARROW) and x < 613 then
                x := x + 8
            end if
            if chars (KEY_LEFT_ARROW) and x > 27 then
                x := x - 8
            end if
            if chars (KEY_DOWN_ARROW) and y > 25 then
                y := y - 8
            end if

        else

            if chars (KEY_UP_ARROW) and y < 375 then
                y := y + 4
            end if
            if chars (KEY_RIGHT_ARROW) and x < 613 then
                x := x + 4
            end if
            if chars (KEY_LEFT_ARROW) and x > 23 then
                x := x - 4
            end if
            if chars (KEY_DOWN_ARROW) and y > 25 then
                y := y - 4

            end if
        end if

    elsif choice = "3" then

        mousewhere (mx, my, mb)

        if my > 375 then
            my := 375
        elsif my < 25 then
            my := 25
        end if

        if mx > 615 then
            mx := 615
        elsif mx < 25 then
            mx := 25
        end if

        drawfilloval (mx, my, circle_radius, circle_radius, colourcount)     %one that you move
        View.Update
        delay (8)
        cls
    end if
    %Move the other circles
    if choice = "bigdanger" then

        if circle_1_y > 330 then
            ydir := -2
        elsif circle_1_y < 68 then
            ydir := 2
        end if

        if circle_1_x > 571 then
            xdir := -2
        elsif circle_1_x < 73 then
            xdir := 2
        end if

        if circle_2_y > 316 then
            ydir2 := -3
        elsif circle_2_y < 80 then
            ydir2 := 3
        end if

        if circle_2_x > 555 then
            xdir2 := -3
        elsif circle_2_x < 82 then
            xdir2 := 3
        end if

    else

        if circle_1_y > 345 then
            ydir := -2
        elsif circle_1_y < 49 then
            ydir := 2
        end if

        if circle_1_x > 578 then
            xdir := -2
        elsif circle_1_x < 48 then
            xdir := 2
        end if

        if circle_2_y > 325 then
            ydir2 := -3
        elsif circle_2_y < 67 then
            ydir2 := 3
        end if

        if circle_2_x > 570 then
            xdir2 := -3
        elsif circle_2_x < 70 then
            xdir2 := 3
        end if
    end if


    circle_1_x := circle_1_x + xdir
    circle_1_y := circle_1_y + ydir
    circle_2_x := circle_2_x + xdir2
    circle_2_y := circle_2_y + ydir2

    %calculate the distance between the centres of the circles
    if choice = "3" then
        distance_between_centres := sqrt ((mx - circle_1_x) ** 2 + (my - circle_1_y) ** 2)
        distance_betweeen_centres := sqrt ((mx - circle_2_x) ** 2 + (my - circle_2_y) ** 2)
    else
        distance_between_centres := sqrt ((x - circle_1_x) ** 2 + (y - circle_1_y) ** 2)
        distance_betweeen_centres := sqrt ((x - circle_2_x) ** 2 + (y - circle_2_y) ** 2)
    end if
    % collision detection
    if distance_between_centres <= circle_1_radius + circle_radius
            or distance_betweeen_centres <= circle_2_radius + circle_radius then
        Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
        exit
    end if
end loop




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%LEVEL 2!!!!!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if deadoralive = "alive" then
        counter2 := counter2 + 1
        put counter2
        exit when counter2 > 600
        if colourcount > 55 then
            colourcount := 32
        end if
        colourcount := colourcount + 1
        cls
        drawfill (maxx, maxy, 84, 84)
        Font.Draw ("Level 2", 285, 380, level, 255)
        drawfilloval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)     %big one you're avoiding
        drawfilloval (circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)     %very big one you're avoiding
        drawfilloval (circle3x, circle3y, circle3radius, circle3radius, 45)     %small one you're avoiding
        delay (10)

        % Move your circle
        Input.KeyDown (chars)
        if choice = "1" or choice = "2" then
            drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
            if choice = "smallcircle" then


                if chars (KEY_UP_ARROW) and y < 385 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 625 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 14 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 12 then
                    y := y - 4
                end if

            elsif choice = "speedy" then

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 8
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 8
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 8
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 8
                end if

            else

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 4
                end if
            end if

        elsif choice = "3" then

            mousewhere (mx, my, mb)

            if my > 375 then
                my := 375
            elsif my < 20 then
                my := 25
            end if

            if mx > 615 then
                mx := 615
            elsif mx < 20 then
                mx := 25
            end if

            drawfilloval (mx, my, circle_radius, circle_radius, colourcount) %one that you move

        end if
        View.Update
        delay (7)
        cls
        %Move the other circles
        if choice = "bigdanger" then

            if circle_1_y > 330 then
                ydir := -2
            elsif circle_1_y < 68 then
                ydir := 2
            end if

            if circle_1_x > 571 then
                xdir := -2
            elsif circle_1_x < 73 then
                xdir := 2
            end if

            if circle_2_y > 316 then
                ydir2 := -3
            elsif circle_2_y < 80 then
                ydir2 := 3
            end if

            if circle_2_x > 555 then
                xdir2 := -3
            elsif circle_2_x < 82 then
                xdir2 := 3
            end if

            if circle3y > 365 then
                ydir3 := -5
            elsif circle3y < 32 then
                ydir3 := 5
            end if

            if circle3x > 598 then
                xdir3 := -5
            elsif circle3x < 34 then
                xdir3 := 5
            end if

        else
            if circle_1_y > 349 then
                ydir := -2
            elsif circle_1_y < 49 then
                ydir := 2
            end if

            if circle_1_x > 578 then
                xdir := -2
            elsif circle_1_x < 48 then
                xdir := 2
            end if

            if circle_2_y > 329 then
                ydir2 := -3
            elsif circle_2_y < 67 then
                ydir2 := 3
            end if

            if circle_2_x > 570 then
                xdir2 := -3
            elsif circle_2_x < 70 then
                xdir2 := 3
            end if

            if circle3y > 366 then
                ydir3 := -5
            elsif circle3y < 27 then
                ydir3 := 5
            end if

            if circle3x > 602 then
                xdir3 := -5
            elsif circle3x < 28 then
                xdir3 := 5
            end if
        end if



        circle_1_x := circle_1_x + xdir
        circle_1_y := circle_1_y + ydir
        circle_2_x := circle_2_x + xdir2
        circle_2_y := circle_2_y + ydir2
        circle3y := circle3y + ydir3
        circle3x := circle3x + xdir3

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres := sqrt ((mx - circle_1_x) ** 2 + (my - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((mx - circle_2_x) ** 2 + (my - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((mx - circle3x) ** 2 + (my - circle3y) ** 2)
        else
            distance_between_centres := sqrt ((x - circle_1_x) ** 2 + (y - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((x - circle_2_x) ** 2 + (y - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((x - circle3x) ** 2 + (y - circle3y) ** 2)
        end if
        % collision detection
        if distance_between_centres <= circle_1_radius + circle_radius
                or distance_betweeen_centres <= circle_2_radius + circle_radius
                or distance_betweeeen_centres <= circle3radius + circle_radius then
            deadoralive := "dead"
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
            exit
        end if
    elsif deadoralive = "dead" then
        exit
    end if
end loop




%****************************************************LEVEL 3!!!!!!*****************************************************%

loop
    if deadoralive = "alive" then
        if colourcount > 55 then
            colourcount := 32
        end if
        colourcount := colourcount + 1
        cls
        drawfill (maxx, maxy, 3, 3)
        Font.Draw ("Level 3", 285, 380, level, 255)
        drawfilloval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)     %big one you're avoiding
        drawfilloval (circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)     %very big one you're avoiding
        drawfilloval (circle3x, circle3y, circle3radius, circle3radius, 45)     %small one you're avoiding
        drawfilloval (circle4x, circle4y, circle4radius, circle4radius, 76)     %medium one you're avoiding
        delay (10)

        % Move your circle
        Input.KeyDown (chars)
        if choice = "1" or choice = "2" then
            drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
            if choice = "smallcircle" then

                if chars (KEY_UP_ARROW) and y < 385 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 625 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 14 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 12 then
                    y := y - 4
                end if

            elsif choice = "speedy" then

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 8
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 8
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 8
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 8
                end if

            else

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 4
                end if
            end if

        elsif choice = "3" then

            mousewhere (mx, my, mb)

            if my > 375 then
                my := 375
            elsif my < 25 then
                my := 25
            end if

            if mx > 615 then
                mx := 615
            elsif mx < 25 then
                mx := 25
            end if

            drawfilloval (mx, my, circle_radius, circle_radius, colourcount) %one that you move

        end if

        View.Update
        delay (7)
        cls
        %Move the other circles
        if choice = "bigdanger" then

            if circle_1_y > 330 then
                ydir := -2
            elsif circle_1_y < 68 then
                ydir := 2
            end if

            if circle_1_x > 571 then
                xdir := -2
            elsif circle_1_x < 73 then
                xdir := 2
            end if

            if circle_2_y > 316 then
                ydir2 := -3
            elsif circle_2_y < 80 then
                ydir2 := 3
            end if

            if circle_2_x > 555 then
                xdir2 := -3
            elsif circle_2_x < 82 then
                xdir2 := 3
            end if

            if circle3y > 349 then
                ydir3 := -5
            elsif circle3y < 38 then
                ydir3 := 5
            end if

            if circle3x > 580 then
                xdir3 := -5
            elsif circle3x < 41 then
                xdir3 := 5
            end if

            if circle4y > 334 then
                ydir4 := -4
            elsif circle4y < 65 then
                ydir4 := 4
            end if

            if circle4x > 569 then
                xdir4 := -4
            elsif circle4x < 54 then
                xdir4 := 4
            end if

        else

            if circle_1_y > 349 then
                ydir := -2
            elsif circle_1_y < 49 then
                ydir := 2
            end if

            if circle_1_x > 578 then
                xdir := -2
            elsif circle_1_x < 48 then
                xdir := 2
            end if

            if circle_2_y > 329 then
                ydir2 := -3
            elsif circle_2_y < 67 then
                ydir2 := 3
            end if

            if circle_2_x > 570 then
                xdir2 := -3
            elsif circle_2_x < 95 then
                xdir2 := 3
            end if

            if circle3y > 366 then
                ydir3 := -5
            elsif circle3y < 28 then
                ydir3 := 5
            end if

            if circle3x > 605 then
                xdir3 := -5
            elsif circle3x < 30 then
                xdir3 := 5
            end if

            if circle4y > 354 then
                ydir4 := -4
            elsif circle4y < 50 then
                ydir4 := 4
            end if

            if circle4x > 588 then
                xdir4 := -4
            elsif circle4x < 42 then
                xdir4 := 4
            end if
        end if


        circle_1_x := circle_1_x + xdir
        circle_1_y := circle_1_y + ydir
        circle_2_x := circle_2_x + xdir2
        circle_2_y := circle_2_y + ydir2
        circle3y := circle3y + ydir3
        circle3x := circle3x + xdir3
        circle4y := circle4y + ydir4
        circle4x := circle4x + xdir4

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres := sqrt ((mx - circle_1_x) ** 2 + (my - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((mx - circle_2_x) ** 2 + (my - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((mx - circle3x) ** 2 + (my - circle3y) ** 2)
            distance_betweeeeen_centres := sqrt ((mx - circle4x) ** 2 + (my - circle4y) ** 2)
        else
            distance_between_centres := sqrt ((x - circle_1_x) ** 2 + (y - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((x - circle_2_x) ** 2 + (y - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((x - circle3x) ** 2 + (y - circle3y) ** 2)
            distance_betweeeeen_centres := sqrt ((x - circle4x) ** 2 + (y - circle4y) ** 2)
        end if
        % collision detection
        if distance_between_centres <= circle_1_radius + circle_radius
                or distance_betweeen_centres <= circle_2_radius + circle_radius
                or distance_betweeeen_centres <= circle3radius + circle_radius
                or distance_betweeeeen_centres <= circle4radius + circle_radius then
            deadoralive := "dead"
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
            exit
        end if
        counter3 := counter3 + 1
        put counter3
        exit when counter3 > 500
    elsif deadoralive = "dead" then
        exit
    end if
end loop


%%%%%%%%%%%&*^#(*#&$%(#@#)@)@)@@%%%%%%%%%LEVEL~4%%%%%%%%%%%%%%%%@$(#!#($@#*&@(@()*$@#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if deadoralive = "alive" then
        if colourcount > 55 then
            colourcount := 32
        end if
        colourcount := colourcount + 1

        cls
        drawfill (maxx, maxy, 52, 52)
        Font.Draw ("Level 4", 285, 380, level, 255)
        drawfilloval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)     %big one you're avoiding
        drawfilloval (circle6x, circle6y, circle6radius, circle6radius, 255)
        drawfilloval (circle7x, circle7y, circle7radius, circle7radius, 255)
        drawfilloval (circle4x, circle4y, circle4radius, circle4radius, 86)     %medium one you're avoiding
        drawfilloval (circle8x, circle8y, circle8radius, circle8radius, 255)
        drawfilloval (circle9x, circle9y, circle9radius, circle9radius, 255)
        delay (10)

        % Move your circle
        Input.KeyDown (chars)
        if choice = "1" or choice = "2" then
            drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
            if choice = "smallcircle" then

                if chars (KEY_UP_ARROW) and y < 385 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 625 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 14 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 12 then
                    y := y - 4
                end if

            elsif choice = "speedy" then

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 8
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 8
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 8
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 8
                end if

            else

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 4
                end if
            end if

        elsif choice = "3" then

            mousewhere (mx, my, mb)

            if my > 375 then
                my := 375
            elsif my < 25 then
                my := 25
            end if

            if mx > 615 then
                mx := 615
            elsif mx < 25 then
                mx := 25
            end if

            drawfilloval (mx, my, circle_radius, circle_radius, colourcount) %one that you move

        end if

        View.Update
        delay (7)
        cls
        %Move the other circles
        if choice = "bigdanger" then

            if circle_1_y > 330 then
                ydir := -2
            elsif circle_1_y < 68 then
                ydir := 2
            end if

            if circle_1_x > 571 then
                xdir := -2
            elsif circle_1_x < 73 then
                xdir := 2
            end if

            if circle4y > 334 then
                ydir4 := -4
            elsif circle4y < 65 then
                ydir4 := 4
            end if

            if circle4x > 569 then
                xdir4 := -4
            elsif circle4x < 54 then
                xdir4 := 4
            end if

            if circle6x > 630 then
                xdir6 := -2
            elsif circle6x < 30 then
                xdir6 := 2
            end if

            if circle7x > 630 then
                xdir7 := -2
            elsif circle7x < 30 then
                xdir7 := 2
            end if

            if circle8y > 382 then
                ydir8 := -2
            elsif circle8y < 22 then
                ydir8 := 2
            end if

            if circle9y > 382 then
                ydir9 := -2
            elsif circle9y < 22 then
                ydir9 := 2
            end if

        else

            if circle_1_y > 349 then
                ydir := -2
            elsif circle_1_y < 49 then
                ydir := 2
            end if

            if circle_1_x > 578 then
                xdir := -2
            elsif circle_1_x < 48 then
                xdir := 2
            end if

            if circle4y > 354 then
                ydir4 := -4
            elsif circle4y < 50 then
                ydir4 := 4
            end if

            if circle4x > 588 then
                xdir4 := -4
            elsif circle4x < 42 then
                xdir4 := 4
            end if

            if circle6x > 630 then
                xdir6 := -2
            elsif circle6x < 30 then
                xdir6 := 2
            end if

            if circle7x > 625 then
                xdir7 := -2
            elsif circle7x < 20 then
                xdir7 := 2
            end if

            if circle8y > 382 then
                ydir8 := -2
            elsif circle8y < 22 then
                ydir8 := 2
            end if

            if circle9y > 382 then
                ydir9 := -2
            elsif circle9y < 22 then
                ydir9 := 2
            end if
        end if


        circle_1_x := circle_1_x + xdir
        circle_1_y := circle_1_y + ydir
        circle4y := circle4y + ydir4
        circle4x := circle4x + xdir4
        circle6x := circle6x + xdir6
        circle7x := circle7x + xdir7
        circle9y := circle9y + ydir9
        circle8y := circle8y + ydir8

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres := sqrt ((mx - circle_1_x) ** 2 + (my - circle_1_y) ** 2)
            distance_betweeeeen_centres := sqrt ((mx - circle4x) ** 2 + (my - circle4y) ** 2)
            distance_between_centres1 := sqrt ((mx - circle6x) ** 2 + (my - circle6y) ** 2)
            distance_between_centres2 := sqrt ((mx - circle7x) ** 2 + (my - circle7y) ** 2)
            distance_between_centres3 := sqrt ((mx - circle8x) ** 2 + (my - circle8y) ** 2)
            distance_between_centres4 := sqrt ((mx - circle9x) ** 2 + (my - circle9y) ** 2)
        else
            distance_between_centres := sqrt ((x - circle_1_x) ** 2 + (y - circle_1_y) ** 2)
            distance_betweeeeen_centres := sqrt ((x - circle4x) ** 2 + (y - circle4y) ** 2)
            distance_between_centres1 := sqrt ((x - circle6x) ** 2 + (y - circle6y) ** 2)
            distance_between_centres2 := sqrt ((x - circle7x) ** 2 + (y - circle7y) ** 2)
            distance_between_centres3 := sqrt ((x - circle8x) ** 2 + (y - circle8y) ** 2)
            distance_between_centres4 := sqrt ((x - circle9x) ** 2 + (y - circle9y) ** 2)
        end if
        % collision detection
        if distance_between_centres <= circle_1_radius + circle_radius
                or distance_between_centres1 <= circle6radius + circle_radius
                or distance_between_centres2 <= circle7radius + circle_radius
                or distance_betweeeeen_centres <= circle4radius + circle_radius
                or distance_between_centres4 <= circle9radius + circle_radius
                or distance_between_centres3 <= circle8radius + circle_radius then
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)         %gameover screen
            deadoralive := "dead"
            exit
        end if
        counter5 := counter5 + 1
        exit when counter5 > 730
    elsif deadoralive = "dead" then
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%~~~~~~LEVEL 5~~~~~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if colourcount > 55 then
        colourcount := 32
    end if
    colourcount := colourcount + 1
    if deadoralive = "alive" then
        cls
        drawfill (maxx, maxy, 12, 12)
        Font.Draw ("Level 5", 285, 380, level, 255)
        drawfilloval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)     %big one you're avoiding
        drawfilloval (circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)     %very big one you're avoiding
        drawfilloval (circle3x, circle3y, circle3radius, circle3radius, 45)     %small one you're avoiding
        drawfilloval (circle4x, circle4y, circle4radius, circle4radius, 76)     %medium one you're avoiding
        drawfilloval (circle5x, circle5y, circle5radius, circle5radius, 57)     %very small and fast one you're avoiding
        delay (10)

        % Move your circle
        Input.KeyDown (chars)
        if choice = "1" or choice = "2" then
            drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
            if choice = "smallcircle" then

                if chars (KEY_UP_ARROW) and y < 385 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 625 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 14 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 12 then
                    y := y - 4
                end if

            elsif choice = "speedy" then

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 8
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 8
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 8
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 8
                end if

            else

                if chars (KEY_UP_ARROW) and y < 375 then
                    y := y + 4
                end if
                if chars (KEY_RIGHT_ARROW) and x < 613 then
                    x := x + 4
                end if
                if chars (KEY_LEFT_ARROW) and x > 27 then
                    x := x - 4
                end if
                if chars (KEY_DOWN_ARROW) and y > 25 then
                    y := y - 4
                end if
            end if

        elsif choice = "3" then

            mousewhere (mx, my, mb)

            if my > 375 then
                my := 375
            elsif my < 25 then
                my := 25
            end if

            if mx > 615 then
                mx := 615
            elsif mx < 25 then
                mx := 25
            end if

            drawfilloval (mx, my, circle_radius, circle_radius, colourcount) %one that you move

        end if

        View.Update
        delay (7)
        cls
        %Move the other circles
        if choice = "bigdanger" then

            if circle_1_y > 330 then
                ydir := -2
            elsif circle_1_y < 68 then
                ydir := 2
            end if

            if circle_1_x > 571 then
                xdir := -2
            elsif circle_1_x < 73 then
                xdir := 2
            end if

            if circle_2_y > 316 then
                ydir2 := -3
            elsif circle_2_y < 80 then
                ydir2 := 3
            end if

            if circle_2_x > 555 then
                xdir2 := -3
            elsif circle_2_x < 82 then
                xdir2 := 3
            end if

            if circle3y > 349 then
                ydir3 := -5
            elsif circle3y < 38 then
                ydir3 := 5
            end if

            if circle3x > 580 then
                xdir3 := -5
            elsif circle3x < 41 then
                xdir3 := 5
            end if

            if circle4y > 334 then
                ydir4 := -4
            elsif circle4y < 65 then
                ydir4 := 4
            end if

            if circle4x > 569 then
                xdir4 := -4
            elsif circle4x < 54 then
                xdir4 := 4
            end if

            if circle5y > 360 then
                ydir5 := -10
            elsif circle5y < 40 then
                ydir5 := 10
            end if

            if circle5x > 590 then
                xdir5 := -10
            elsif circle5x < 40 then
                xdir5 := 10
            end if

        else

            if circle_1_y > 349 then
                ydir := -2
            elsif circle_1_y < 49 then
                ydir := 2
            end if

            if circle_1_x > 578 then
                xdir := -2
            elsif circle_1_x < 48 then
                xdir := 2
            end if

            if circle_2_y > 329 then
                ydir2 := -3
            elsif circle_2_y < 67 then
                ydir2 := 3
            end if

            if circle_2_x > 570 then
                xdir2 := -3
            elsif circle_2_x < 70 then
                xdir2 := 3
            end if

            if circle3y > 366 then
                ydir3 := -5
            elsif circle3y < 28 then
                ydir3 := 5
            end if

            if circle3x > 605 then
                xdir3 := -5
            elsif circle3x < 30 then
                xdir3 := 5
            end if

            if circle4y > 354 then
                ydir4 := -4
            elsif circle4y < 50 then
                ydir4 := 4
            end if

            if circle4x > 588 then
                xdir4 := -4
            elsif circle4x < 42 then
                xdir4 := 4
            end if

            if circle5y > 380 then
                ydir5 := -10
            elsif circle5y < 20 then
                ydir5 := 10
            end if

            if circle5x > 605 then
                xdir5 := -10
            elsif circle5x < 25 then
                xdir5 := 10
            end if
        end if


        circle_1_x := circle_1_x + xdir
        circle_1_y := circle_1_y + ydir
        circle_2_x := circle_2_x + xdir2
        circle_2_y := circle_2_y + ydir2
        circle3y := circle3y + ydir3
        circle3x := circle3x + xdir3
        circle4y := circle4y + ydir4
        circle4x := circle4x + xdir4
        circle5y := circle5y + ydir5
        circle5x := circle5x + xdir5

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres := sqrt ((mx - circle_1_x) ** 2 + (my - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((mx - circle_2_x) ** 2 + (my - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((mx - circle3x) ** 2 + (my - circle3y) ** 2)
            distance_betweeeeen_centres := sqrt ((mx - circle4x) ** 2 + (my - circle4y) ** 2)
            distance_betweeeeeen_centres := sqrt ((mx - circle5x) ** 2 + (my - circle5y) ** 2)
        else
            distance_between_centres := sqrt ((x - circle_1_x) ** 2 + (y - circle_1_y) ** 2)
            distance_betweeen_centres := sqrt ((x - circle_2_x) ** 2 + (y - circle_2_y) ** 2)
            distance_betweeeen_centres := sqrt ((x - circle3x) ** 2 + (y - circle3y) ** 2)
            distance_betweeeeen_centres := sqrt ((x - circle4x) ** 2 + (y - circle4y) ** 2)
            distance_betweeeeeen_centres := sqrt ((x - circle5x) ** 2 + (y - circle5y) ** 2)
        end if
        % collision detection
        if distance_between_centres <= circle_1_radius + circle_radius
                or distance_betweeen_centres <= circle_2_radius + circle_radius
                or distance_betweeeen_centres <= circle3radius + circle_radius
                or distance_betweeeeen_centres <= circle4radius + circle_radius
                or distance_betweeeeeen_centres <= circle5radius + circle_radius then
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)         %gameover screen
            exit
        end if
        counter4 := counter4 + 1
        exit when counter4 > 400
    elsif deadoralive = "dead" then
        exit
    end if
end loop

if counter4 > 400 and choice = "2" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try using the cheat bigdanger for a bigger challenge.", 7, 100, level, 255)
elsif counter4 > 400 and choice = "speedy" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try NOT using cheats.", 140, 100, level, 255)
elsif counter4 > 400 and choice = "bigdanger" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("You have mastered Circular Danger.", 118, 100, level, 255)
elsif counter4 > 400 and choice = "smallcircle" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try NOT using cheats.", 140, 100, level, 255)
end if

View.Update

[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
Jack140




PostPosted: Tue Nov 25, 2008 10:05 am   Post subject: Re: Gr. 10 Game

That was a fun and fantastic game!!! +1 Karma (I need at least 25 posts, to be able to give you karma... you will recieve it soon) Thanks for posting your game!

You could of reduce the amount of else if and stuff...
but besides that it was Great Very Happy
Hard to imagine that you only had like 2-3 months experience like me...
I wouldn't be able to make a that game...
It must have taken you a long time to do.

Awesome Game!!!
Insectoid




PostPosted: Tue Nov 25, 2008 12:25 pm   Post subject: RE:Gr. 10 Game

You should arrange it so that when using mouse control, the circles don't start on top of you (causing and instant game-over). Also, you should use procedures. It would shorten your code to less than 200 lines, easily.
Parker




PostPosted: Tue Nov 25, 2008 3:44 pm   Post subject: Re: RE:Gr. 10 Game

insectoid @ Tue Nov 25, 2008 12:25 pm wrote:
You should arrange it so that when using mouse control, the circles don't start on top of you (causing and instant game-over). Also, you should use procedures. It would shorten your code to less than 200 lines, easily.


Yes, this happens in the keyboard control mode as well. It has been a problem I have been annoyed about since I first started making the game but unsure how to fix it other than pausing between levels, and resetting where everything starts. About the procedures I have wondered about as well and wanted to do/learn. I don't know how to use procedures yet, and my teacher won't teach me. This game I will also be using for my final just improving later in the semested and my teacher said I cannot use procedures for my final because no other students would be able to. (therefore giving me an advantage)

And Thank you Jack, glad you liked it. I have been working with turing for about 6 months, but I meant only using this site for 2-3 months to help me. It did take me a while cause I have had to do other stuff my class is doing as well. (I was making this game while my teacher was teaching the class how to use a "put" command Razz )
A.J




PostPosted: Tue Nov 25, 2008 3:53 pm   Post subject: Re: Gr. 10 Game

not bad game, in fact it was very good Very Happy

Hints to improve game:
- try making the enemy circles collide
- add more levels
- look into "type"'s and "record"'s
- try changing the enemy's shape (like adding a tail of circles behind them)

I recently made a game in turing that uses records, types and weird enemies....it might help u

here's the link to it : http://compsci.ca/v3/viewtopic.php?t=19428

very good game though !!! Mr. Green
Parker




PostPosted: Tue Nov 25, 2008 4:03 pm   Post subject: Re: Gr. 10 Game

A.J @ Tue Nov 25, 2008 3:53 pm wrote:
not bad game, in fact it was very good Very Happy

Hints to improve game:
- try making the enemy circles collide
- add more levels
- look into "type"'s and "record"'s
- try changing the enemy's shape (like adding a tail of circles behind them)

I recently made a game in turing that uses records, types and weird enemies....it might help u

here's the link to it : http://compsci.ca/v3/viewtopic.php?t=19428

very good game though !!! Mr. Green


I like your game, I am thinking about looking into effects. Have never used types or records but I will look into it. As I said in my last post about my teacher not letting me use procedures for my game, it will probably be the same so I have decided I will try to make the game using procedures, records and types but will save it under another name. Making the circles collide would definately make it a nice new challenge but would add alot of math to it, I will try that next though Razz
Insectoid




PostPosted: Tue Nov 25, 2008 4:04 pm   Post subject: RE:Gr. 10 Game

Your teacher won't allow you to use procedures?!?!? What a <sexual word> <body part>! That it will give you an advantage is the most ridiculous thing I have ever heard, yes, it gives you an advantage, but it is also one of the most important concepts in programming. If you go ahead to learn things on your own, you should be allowed to take full advantage of that knowledge. (sorry, long rant). I just can't get across how shocked I am by this guy! When I was in gr. 10, my teacher praised me for learning these things. You, sir, do not deserve to be taught by whoever it is that is teaching you. Hell, said teacher doesn't deserve to teach at all! Anywho, I'll stop now because I don't want to get any warnings for saying these things about a teacher, but I trust you get the gist of what I'm saying. Please, learn procedures. Once you understand them, you will never go back. If I were you, I would use procedures anyway, because I don't care if it hurts my mark, as long as it helps my understanding. But I don't recommend you do that, unless you are the same kind of person as me (the kind of person that psychs out the principal while you receive your honor role thingummy).

~Insectoid (still shocked)

EDIT: Beat me by a minute!
Parker




PostPosted: Tue Nov 25, 2008 4:25 pm   Post subject: RE:Gr. 10 Game

Well first of all, my teacher is a women Razz

Next, I am looking into tutorials on procedures and will be trying them out cause from what I hear (mainly from you but some others) they are good to work with lol. And um, my marks they matter quite a bit to me Smile I had the highest mark in grade 9 and currently have a 93 average. Call me a nerd but I am very physically active, I play hockey and soccer. (I am quite good at both, played in an international soccer tourney in the summer and a national hockey tournament last year)
Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: Tue Nov 25, 2008 4:40 pm   Post subject: RE:Gr. 10 Game

procedures are a HUGE part to organized code.
Jack140




PostPosted: Tue Nov 25, 2008 5:25 pm   Post subject: Re: RE:Gr. 10 Game

SNIPERDUDE @ Tue Nov 25, 2008 4:40 pm wrote:
procedures are a HUGE part to organized code.


Agreed, its a huge life saver!!! Very Happy
Trust me... instead of spending hours typing repetitve code over and over again...
You could of been done in less amounts of time, and by the way who cares if your teacher doesn't allow procedures!
(Its the whole part of the educational process, especially when learning a whole new language)...
A.J




PostPosted: Tue Nov 25, 2008 8:04 pm   Post subject: Re: Gr. 10 Game

Parker wrote:

Making the circles collide would definately make it a nice new challenge but would add alot of math to it, I will try that next though Razz


it is quite easy actually!

the most basic one (the one you could get away with using it now) is this.
code:

function Collide (var circle1x, circle1y, circle1r, circle2x, circle2y, circle2r : int) : boolean
    result Math.Distance(circle1x, circle1y,circle2x, circle2y) < circle1.r + circle2.r
end Collide


all the above code means is if the distance between the centers of the 2 circles is less than the sum of the radii of the circles (i.e., if they are touching or gonr into each other) then return true. Otherwise, returns false!

This is not a very good way to check for collision (for a good way, check out the Perfect Circle Collision Tutorial) but it is nevertheless sufficient enough Very Happy[syntax=""][/syntax][syntax=""][/syntax][syntax=""] [/syntax][syntax=""][/syntax]
gitoxa




PostPosted: Tue Nov 25, 2008 9:52 pm   Post subject: RE:Gr. 10 Game

My teacher didn't allow me to use procedures in any of my grade 10 and start of grade 11 assignments. The reason for this was because he wanted us to learn how to use them properly.
Parker




PostPosted: Wed Nov 26, 2008 8:18 am   Post subject: RE:Gr. 10 Game

Thanks A.J., I will try that out and if I can get it +1 karma (when I get 25 posts)

And gitoxa that may be part of the reason why my teacher doesn't want me using them.

EDIT: Just tried a few tutorials and I....am LOST Razz I will keep trying and see if I can make some sense out of functions but for now nothing is going to be happening lol. On the bright side procedures don't seem too hard.
Parker




PostPosted: Tue Dec 02, 2008 8:35 am   Post subject: Re: Gr. 10 Game

Tried to edit my first post but it wouldnt let me Sad
I changed the code, using more procedures and arrays to shorten up a bit. I learned how to use these using tutorials on Compsci Mr. Green

Well, here is the new code, tell me if I used the procedures wrong, or if there is a better way, thanks.

Turing:
View.Set ("position:center;center,offscreenonly, nocursor, nobuttonbar,title: Avoid the Circles!!")
% variables
var circlex : array 0 .. 8 of int
var circley : array 0 .. 8 of int
var circler : array 0 .. 8 of int
var x : int % your circle
var y : int % your circle
var circle_radius : int % your circle
var chars : array char of boolean
var xdir : array 0 .. 6 of int
var ydir : array 0 .. 6 of int
var distance_between_centres : array 0 .. 8 of real
var counter : array 0 .. 4 of int
var font1 : int
var gameover : int
var youwin : int
var key : string (1)
var level : int
var choice : string
var deadoralive : string := "alive"
var colourcount : int := 32
%%%%%%%%%%%%%%%%%%%%%%%Mouse%%%%%%%%%%%%%%%%
var mx, my, mb : int := 0

%values of circles and everything..
circlex (0) := 50
circley (0) := 200
circler (0) := 50
circlex (1) := 200
circley (1) := 200
circler (1) := 70
circlex (2) := 450
circley (2) := 85
circler (2) := 22
circlex (3) := 500
circley (3) := 310
circler (3) := 45
circlex (4) := 70
circley (4) := 100
circler (4) := 3
circlex (5) := 29
circley (5) := 25
circler (5) := 30
circlex (6) := 300
circley (6) := 370
circler (6) := 30
circlex (7) := 20
circley (7) := 25
circler (7) := 30
circlex (8) := 612
circley (8) := 380
circler (8) := 30
x := 150
y := 91
circle_radius := 23
xdir (0) := 2
ydir (0) := 2
xdir (1) := 3
ydir (1) := 3
xdir (2) := 5
ydir (2) := 5
xdir (3) := 4
ydir (3) := 4
xdir (4) := 10
ydir (4) := 10
xdir (5) := 2
xdir (6) := 2
ydir (5) := 2
ydir (6) := 2
counter (2) := 0
counter (1) := 0
counter (0) := 0
counter (3) := 0
counter (4) := 0

%%%%%Procedure%%%%%

procedure movecircle
    Input.KeyDown (chars)
    if choice = "1" or choice = "2" then
        drawfilloval (x, y, circle_radius, circle_radius, colourcount) %one that you move
        View.Update
        if choice = "smallcircle" then

            if chars (KEY_UP_ARROW) and y < 385 then
                y := y + 4
            end if
            if chars (KEY_RIGHT_ARROW) and x < 625 then
                x := x + 4
            end if
            if chars (KEY_LEFT_ARROW) and x > 14 then
                x := x - 4
            end if
            if chars (KEY_DOWN_ARROW) and y > 12 then
                y := y - 4
            end if

        elsif choice = "speedy" then

            if chars (KEY_UP_ARROW) and y < 375 then
                y := y + 8
            end if
            if chars (KEY_RIGHT_ARROW) and x < 613 then
                x := x + 8
            end if
            if chars (KEY_LEFT_ARROW) and x > 27 then
                x := x - 8
            end if
            if chars (KEY_DOWN_ARROW) and y > 25 then
                y := y - 8
            end if

        else

            if chars (KEY_UP_ARROW) and y < 375 then
                y := y + 4
            end if
            if chars (KEY_RIGHT_ARROW) and x < 613 then
                x := x + 4
            end if
            if chars (KEY_LEFT_ARROW) and x > 23 then
                x := x - 4
            end if
            if chars (KEY_DOWN_ARROW) and y > 25 then
                y := y - 4

            end if
        end if

    elsif choice = "3" then

        mousewhere (mx, my, mb)

        if my > 375 then
            my := 375
        elsif my < 25 then
            my := 25
        end if

        if mx > 615 then
            mx := 615
        elsif mx < 25 then
            mx := 25
        end if

        drawfilloval (mx, my, circle_radius, circle_radius, colourcount)     %one that you move
        View.Update
        delay (8)
        cls
    end if
end movecircle

procedure colorcount
    if colourcount > 55 then
        colourcount := 32
    end if
    colourcount := colourcount + 1
end colorcount

%Fonts
font1 := Font.New ("Vineta BT:21:underline")
assert font1 > 0

gameover := Font.New ("Wide Latin:30:bold")
assert gameover > 0

youwin := Font.New ("Wide Latin:19:bold")
assert youwin > 0

level := Font.New ("Castellar:11")
assert level > 0

 /*****TITLE PAGE*******/
loop
    cls
    drawfill (maxx, maxy, 10, 14)
    Font.Draw ("Welcome to Circular Danger", 9, 300, font1, 255)
    locatexy (1, 100)
    colorback (103)
    put "                         Press any key to continue" : 1
    getch (key)
    View.Update
    cls
    %%%%%%%%%%Choice Screen%%%%%%%%%%%%%%%
    View.Update
    drawfill (maxx, maxy, 42, 42)
    colorback (94)
    locatexy (1, 300)
    put "1.  How to Play...?"
    locatexy (1, 250)
    put "2.  Start the Game!!! (Using keys)"
    locatexy (1, 200)
    put "3.  Start the Game!!! (Using mouse)"
    locatexy (1, 150)
    put "Please choose an option or enter a cheat."
    View.Update
    get choice
    cls
    if choice = "1" then
        %%%%%%%%%%%%%How to Play screen%%%%%%%%%%
        drawfill (maxx, maxy, 88, 88)
        colourback (118)
        locatexy (1, 350)
        put "                                  OBJECTIVE"
        colourback (68)
        locatexy (1, 290)
        put "The objective of circular danger is quite simple, AVOID the CIRCLES."
        colourback (118)
        locatexy (1, 230)
        put "                                  CONTROLS"
        colourback (68)
        locatexy (1, 170)
        put "You control the circle that flashes different colours using the arrow keys."
        put "Up arrow moves you up, Down arrow moves you down, Left arrow moves you left and the Right arrow moves you right."
        colourback (61)
        locatexy (1, 80)
        put "                       Press any key to start the game"
        View.Update
        getch (key)
        exit
    elsif choice = "2" then
        exit
    elsif choice = "smallcircle" then
        circle_radius := 5
        locatexy (1, 400)
        put "Cheat smallcircle activated."
        View.Update
        getch (key)
        exit
    elsif choice = "bigdanger" then
        circler (0) := 65
        circler (1) := 80
        circler (2) := 30
        circler (3) := 46
        circler (4) := 7
        circle_radius := 19
        locatexy (1, 400)
        put "Cheat bigdanger activated."
        put "Good luck, you will need it!"
        View.Update
        getch (key)
        exit
    elsif choice = "speedy" then
        locatexy (1, 400)
        put "Cheat speedy activated."
        put "Fasten your seatbelt."
        View.Update
        getch (key)
        exit
    elsif choice = "3" then
        exit
    end if
end loop

%%%%%%%%%%%%%Level 1 loop%%%%%%%%%%%%%

loop
    counter (0) := counter (0) + 1
    exit when counter (0) > 700
    colorcount
    drawfill (maxx, maxy, 101, 101)
    Font.Draw ("Level 1", 285, 380, level, 255)
    drawfilloval (circlex (0), circley (0), circler (0), circler (0), 36)     %big one you're avoiding
    drawfilloval (circlex (1), circley (1), circler (1), circler (1), 23)     %big one you're avoiding
    delay (8)
    View.Update
    % Move your circle
    movecircle
    %Move the other circles
    if choice = "bigdanger" then

        if circley (0) > 330 then
            ydir (0) := -2
        elsif circley (0) < 68 then
            ydir (0) := 2
        end if

        if circlex (0) > 571 then
            xdir (0) := -2
        elsif circlex (0) < 73 then
            xdir (0) := 2
        end if

        if circley (1) > 316 then
            ydir (1) := -3
        elsif circley (1) < 80 then
            ydir (1) := 3
        end if

        if circlex (1) > 555 then
            xdir (1) := -3
        elsif circlex (1) < 82 then
            xdir (1) := 3
        end if

    else

        if circley (0) > 345 then
            ydir (0) := -2
        elsif circley (0) < 49 then
            ydir (0) := 2
        end if

        if circlex (0) > 578 then
            xdir (0) := -2
        elsif circlex (0) < 48 then
            xdir (0) := 2
        end if

        if circley (1) > 325 then
            ydir (1) := -3
        elsif circley (1) < 67 then
            ydir (1) := 3
        end if

        if circlex (1) > 570 then
            xdir (1) := -3
        elsif circlex (1) < 70 then
            xdir (1) := 3
        end if
    end if


    circlex (0) := circlex (0) + xdir (0)
    circley (0) := circley (0) + ydir (0)
    circlex (1) := circlex (1) + xdir (1)
    circley (1) := circley (1) + ydir (1)

    %calculate the distance between the centres of the circles
    if choice = "3" then
        distance_between_centres (0) := sqrt ((mx - circlex (0)) ** 2 + (my - circley (0)) ** 2)
        distance_between_centres (1) := sqrt ((mx - circlex (1)) ** 2 + (my - circley (1)) ** 2)
    else
        distance_between_centres (0) := sqrt ((x - circlex (0)) ** 2 + (y - circley (0)) ** 2)
        distance_between_centres (1) := sqrt ((x - circlex (1)) ** 2 + (y - circley (1)) ** 2)
    end if
    % collision detection
    if distance_between_centres (0) <= circler (0) + circle_radius
            or distance_between_centres (1) <= circler (1) + circle_radius then
        drawfill (maxx, maxy, 14, 14)
        Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
        deadoralive := "dead"
        View.Update
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%LEVEL 2!!!!!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if deadoralive = "alive" then
        counter (1) := counter (1) + 1
        exit when counter (1) > 600
        colorcount
        drawfill (maxx, maxy, 84, 84)
        Font.Draw ("Level 2", 285, 380, level, 255)
        drawfilloval (circlex (0), circley (0), circler (0), circler (0), 36)     %big one you're avoiding
        drawfilloval (circlex (1), circley (1), circler (1), circler (1), 23)     %very big one you're avoiding
        drawfilloval (circlex (2), circley (2), circler (2), circler (2), 45)     %small one you're avoiding
        delay (10)

        % Move your circle
        movecircle
        %Move the other circles
        if choice = "bigdanger" then

            if circley (0) > 330 then
                ydir (0) := -2
            elsif circley (0) < 68 then
                ydir (0) := 2
            end if

            if circlex (0) > 571 then
                xdir (0) := -2
            elsif circlex (0) < 73 then
                xdir (0) := 2
            end if

            if circley (1) > 316 then
                ydir (1) := -3
            elsif circley (1) < 80 then
                ydir (1) := 3
            end if

            if circlex (1) > 555 then
                xdir (1) := -3
            elsif circlex (1) < 82 then
                xdir (1) := 3
            end if

            if circley (2) > 365 then
                ydir (2) := -5
            elsif circley (2) < 32 then
                ydir (2) := 5
            end if

            if circlex (2) > 598 then
                xdir (2) := -5
            elsif circlex (2) < 34 then
                xdir (2) := 5
            end if

        else
            if circley (0) > 349 then
                ydir (0) := -2
            elsif circley (0) < 49 then
                ydir (0) := 2
            end if

            if circlex (0) > 578 then
                xdir (0) := -2
            elsif circlex (0) < 48 then
                xdir (0) := 2
            end if

            if circley (1) > 329 then
                ydir (1) := -3
            elsif circley (1) < 67 then
                ydir (1) := 3
            end if

            if circlex (1) > 570 then
                xdir (1) := -3
            elsif circlex (1) < 70 then
                xdir (1) := 3
            end if

            if circley (2) > 366 then
                ydir (2) := -5
            elsif circley (2) < 27 then
                ydir (2) := 5
            end if

            if circlex (2) > 602 then
                xdir (2) := -5
            elsif circlex (2) < 28 then
                xdir (2) := 5
            end if
        end if

        circlex (0) := circlex (0) + xdir (0)
        circley (0) := circley (0) + ydir (0)
        circlex (1) := circlex (1) + xdir (1)
        circley (1) := circley (1) + ydir (1)
        circley (2) := circley (2) + ydir (2)
        circlex (2) := circlex (2) + xdir (2)

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres (0) := sqrt ((mx - circlex (0)) ** 2 + (my - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((mx - circlex (1)) ** 2 + (my - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((mx - circlex (2)) ** 2 + (my - circley (2)) ** 2)
        else
            distance_between_centres (0) := sqrt ((x - circlex (0)) ** 2 + (y - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((x - circlex (1)) ** 2 + (y - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((x - circlex (2)) ** 2 + (y - circley (2)) ** 2)
        end if
        % collision detection
        if distance_between_centres (0) <= circler (0) + circle_radius
                or distance_between_centres (1) <= circler (1) + circle_radius
                or distance_between_centres (2) <= circler (2) + circle_radius then
            deadoralive := "dead"
            drawfill (maxx, maxy, 14, 14)
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
            View.Update
            exit
        end if
    elsif deadoralive = "dead" then
        exit
    end if
end loop

%****************************************************LEVEL 3!!!!!!*****************************************************%

loop
    if deadoralive = "alive" then
        colorcount
        drawfill (maxx, maxy, 3, 3)
        Font.Draw ("Level 3", 285, 380, level, 255)
        drawfilloval (circlex (0), circley (0), circler (0), circler (0), 36)     %big one you're avoiding
        drawfilloval (circlex (1), circley (1), circler (1), circler (1), 23)     %very big one you're avoiding
        drawfilloval (circlex (2), circley (2), circler (2), circler (2), 45)     %small one you're avoiding
        drawfilloval (circlex (3), circley (3), circler (3), circler (3), 76)     %medium one you're avoiding
        delay (10)

        % Move your circle
        movecircle
        %Move the other circles
        if choice = "bigdanger" then

            if circley (0) > 330 then
                ydir (0) := -2
            elsif circley (0) < 68 then
                ydir (0) := 2
            end if

            if circlex (0) > 571 then
                xdir (0) := -2
            elsif circlex (0) < 73 then
                xdir (0) := 2
            end if

            if circley (1) > 316 then
                ydir (1) := -3
            elsif circley (1) < 80 then
                ydir (1) := 3
            end if

            if circlex (1) > 555 then
                xdir (1) := -3
            elsif circlex (1) < 82 then
                xdir (1) := 3
            end if

            if circley (2) > 349 then
                ydir (2) := -5
            elsif circley (2) < 38 then
                ydir (2) := 5
            end if

            if circlex (2) > 580 then
                xdir (2) := -5
            elsif circlex (2) < 41 then
                xdir (2) := 5
            end if

            if circley (3) > 334 then
                ydir (3) := -4
            elsif circley (3) < 65 then
                ydir (3) := 4
            end if

            if circlex (3) > 569 then
                xdir (3) := -4
            elsif circlex (3) < 54 then
                xdir (3) := 4
            end if

        else

            if circley (0) > 349 then
                ydir (0) := -2
            elsif circley (0) < 49 then
                ydir (0) := 2
            end if

            if circlex (0) > 578 then
                xdir (0) := -2
            elsif circlex (0) < 48 then
                xdir (0) := 2
            end if

            if circley (1) > 329 then
                ydir (1) := -3
            elsif circley (1) < 67 then
                ydir (1) := 3
            end if

            if circlex (1) > 570 then
                xdir (1) := -3
            elsif circlex (1) < 95 then
                xdir (1) := 3
            end if

            if circley (2) > 366 then
                ydir (2) := -5
            elsif circley (2) < 28 then
                ydir (2) := 5
            end if

            if circlex (2) > 605 then
                xdir (2) := -5
            elsif circlex (2) < 30 then
                xdir (2) := 5
            end if

            if circley (3) > 354 then
                ydir (3) := -4
            elsif circley (3) < 50 then
                ydir (3) := 4
            end if

            if circlex (3) > 588 then
                xdir (3) := -4
            elsif circlex (3) < 42 then
                xdir (3) := 4
            end if
        end if

        circlex (0) := circlex (0) + xdir (0)
        circley (0) := circley (0) + ydir (0)
        circlex (1) := circlex (1) + xdir (1)
        circley (1) := circley (1) + ydir (1)
        circley (2) := circley (2) + ydir (2)
        circlex (2) := circlex (2) + xdir (2)
        circley (3) := circley (3) + ydir (3)
        circlex (3) := circlex (3) + xdir (3)

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres (0) := sqrt ((mx - circlex (0)) ** 2 + (my - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((mx - circlex (1)) ** 2 + (my - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((mx - circlex (2)) ** 2 + (my - circley (2)) ** 2)
            distance_between_centres (3) := sqrt ((mx - circlex (3)) ** 2 + (my - circley (3)) ** 2)
        else
            distance_between_centres (0) := sqrt ((x - circlex (0)) ** 2 + (y - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((x - circlex (1)) ** 2 + (y - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((x - circlex (2)) ** 2 + (y - circley (2)) ** 2)
            distance_between_centres (3) := sqrt ((x - circlex (3)) ** 2 + (y - circley (3)) ** 2)
        end if
        % collision detection
        if distance_between_centres (0) <= circler (0) + circle_radius
                or distance_between_centres (1) <= circler (1) + circle_radius
                or distance_between_centres (2) <= circler (2) + circle_radius
                or distance_between_centres (3) <= circler (3) + circle_radius then
            deadoralive := "dead"
            drawfill (maxx, maxy, 14, 14)
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)
            View.Update
            exit
        end if
        counter (2) := counter (2) + 1
        exit when counter (2) > 500
    elsif deadoralive = "dead" then
        exit
    end if
end loop

%%%%%%%%%%%&*^#(*#&$%(#@#)@)@)@@%%%%%%%%%LEVEL~4%%%%%%%%%%%%%%%%@$(#!#($@#*&@(@()*$@#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if deadoralive = "alive" then
        colorcount
        drawfill (maxx, maxy, 52, 52)
        Font.Draw ("Level 4", 285, 380, level, 255)
        drawfilloval (circlex (0), circley (0), circler (0), circler (0), 36)     %big one you're avoiding
        drawfilloval (circlex (5), circley (5), circler (5), circler (5), 255)
        drawfilloval (circlex (6), circley (6), circler (6), circler (6), 255)
        drawfilloval (circlex (3), circley (3), circler (3), circler (3), 86)     %medium one you're avoiding
        drawfilloval (circlex (7), circley (7), circler (7), circler (7), 255)
        drawfilloval (circlex (8), circley (8), circler (8), circler (8), 255)
        delay (10)

        % Move your circle
        movecircle
        %Move the other circles
        if choice = "bigdanger" then

            if circley (0) > 330 then
                ydir (0) := -2
            elsif circley (0) < 68 then
                ydir (0) := 2
            end if

            if circlex (0) > 571 then
                xdir (0) := -2
            elsif circlex (0) < 73 then
                xdir (0) := 2
            end if

            if circley (3) > 334 then
                ydir (3) := -4
            elsif circley (3) < 65 then
                ydir (3) := 4
            end if

            if circlex (3) > 569 then
                xdir (3) := -4
            elsif circlex (3) < 54 then
                xdir (3) := 4
            end if

            if circlex (5) > 630 then
                xdir (5) := -2
            elsif circlex (5) < 30 then
                xdir (5) := 2
            end if

            if circlex (6) > 630 then
                xdir (6) := -2
            elsif circlex (6) < 30 then
                xdir (6) := 2
            end if

            if circley (7) > 382 then
                ydir (5) := -2
            elsif circley (7) < 22 then
                ydir (5) := 2
            end if

            if circley (8) > 382 then
                ydir (6) := -2
            elsif circley (8) < 22 then
                ydir (6) := 2
            end if

        else

            if circley (0) > 349 then
                ydir (0) := -2
            elsif circley (0) < 49 then
                ydir (0) := 2
            end if

            if circlex (0) > 578 then
                xdir (0) := -2
            elsif circlex (0) < 48 then
                xdir (0) := 2
            end if

            if circley (3) > 354 then
                ydir (3) := -4
            elsif circley (3) < 50 then
                ydir (3) := 4
            end if

            if circlex (3) > 588 then
                xdir (3) := -4
            elsif circlex (3) < 42 then
                xdir (3) := 4
            end if

            if circlex (5) > 630 then
                xdir (5) := -2
            elsif circlex (5) < 30 then
                xdir (5) := 2
            end if

            if circlex (6) > 625 then
                xdir (6) := -2
            elsif circlex (6) < 20 then
                xdir (6) := 2
            end if

            if circley (7) > 382 then
                ydir (5) := -2
            elsif circley (7) < 22 then
                ydir (5) := 2
            end if

            if circley (8) > 382 then
                ydir (6) := -2
            elsif circley (8) < 22 then
                ydir (6) := 2
            end if
        end if

        circlex (0) := circlex (0) + xdir (0)
        circley (0) := circley (0) + ydir (0)
        circley (3) := circley (3) + ydir (3)
        circlex (3) := circlex (3) + xdir (3)
        circlex (5) := circlex (5) + xdir (5)
        circlex (6) := circlex (6) + xdir (6)
        circley (8) := circley (8) + ydir (6)
        circley (7) := circley (7) + ydir (5)

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres (0) := sqrt ((mx - circlex (0)) ** 2 + (my - circley (0)) ** 2)
            distance_between_centres (3) := sqrt ((mx - circlex (3)) ** 2 + (my - circley (3)) ** 2)
            distance_between_centres (5) := sqrt ((mx - circlex (5)) ** 2 + (my - circley (5)) ** 2)
            distance_between_centres (6) := sqrt ((mx - circlex (6)) ** 2 + (my - circley (6)) ** 2)
            distance_between_centres (7) := sqrt ((mx - circlex (7)) ** 2 + (my - circley (7)) ** 2)
            distance_between_centres (8) := sqrt ((mx - circlex (8)) ** 2 + (my - circley (8)) ** 2)
        else
            distance_between_centres (0) := sqrt ((x - circlex (0)) ** 2 + (y - circley (0)) ** 2)
            distance_between_centres (3) := sqrt ((x - circlex (3)) ** 2 + (y - circley (3)) ** 2)
            distance_between_centres (5) := sqrt ((x - circlex (5)) ** 2 + (y - circley (5)) ** 2)
            distance_between_centres (6) := sqrt ((x - circlex (6)) ** 2 + (y - circley (6)) ** 2)
            distance_between_centres (7) := sqrt ((x - circlex (7)) ** 2 + (y - circley (7)) ** 2)
            distance_between_centres (8) := sqrt ((x - circlex (8)) ** 2 + (y - circley (8)) ** 2)
        end if
        % collision detection
        if distance_between_centres (0) <= circler (0) + circle_radius
                or distance_between_centres (5) <= circler (5) + circle_radius
                or distance_between_centres (6) <= circler (6) + circle_radius
                or distance_between_centres (3) <= circler (3) + circle_radius
                or distance_between_centres (8) <= circler (8) + circle_radius
                or distance_between_centres (7) <= circler (7) + circle_radius then
            drawfill (maxx, maxy, 14, 14)
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)         %gameover screen
            View.Update
            deadoralive := "dead"
            exit
        end if
        counter (4) := counter (4) + 1
        exit when counter (4) > 730
    elsif deadoralive = "dead" then
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%~~~~~~LEVEL 5~~~~~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop
    if deadoralive = "alive" then
        colorcount
        drawfill (maxx, maxy, 12, 12)
        Font.Draw ("Level 5", 285, 380, level, 255)
        drawfilloval (circlex (0), circley (0), circler (0), circler (0), 36)     %big one you're avoiding
        drawfilloval (circlex (1), circley (1), circler (1), circler (1), 23)     %very big one you're avoiding
        drawfilloval (circlex (2), circley (2), circler (2), circler (2), 45)     %small one you're avoiding
        drawfilloval (circlex (3), circley (3), circler (3), circler (3), 76)     %medium one you're avoiding
        drawfilloval (circlex (4), circley (4), circler (4), circler (4), 57)     %very small and fast one you're avoiding
        delay (10)

        % Move your circle
        movecircle
        %Move the other circles
        if choice = "bigdanger" then

            if circley (0) > 330 then
                ydir (0) := -2
            elsif circley (0) < 68 then
                ydir (0) := 2
            end if

            if circlex (0) > 571 then
                xdir (0) := -2
            elsif circlex (0) < 73 then
                xdir (0) := 2
            end if

            if circley (1) > 316 then
                ydir (1) := -3
            elsif circley (1) < 80 then
                ydir (1) := 3
            end if

            if circlex (1) > 555 then
                xdir (1) := -3
            elsif circlex (1) < 82 then
                xdir (1) := 3
            end if

            if circley (2) > 349 then
                ydir (2) := -5
            elsif circley (2) < 38 then
                ydir (2) := 5
            end if

            if circlex (2) > 580 then
                xdir (2) := -5
            elsif circlex (2) < 41 then
                xdir (2) := 5
            end if

            if circley (3) > 334 then
                ydir (3) := -4
            elsif circley (3) < 65 then
                ydir (3) := 4
            end if

            if circlex (3) > 569 then
                xdir (3) := -4
            elsif circlex (3) < 54 then
                xdir (3) := 4
            end if

            if circley (4) > 360 then
                ydir (4) := -10
            elsif circley (4) < 40 then
                ydir (4) := 10
            end if

            if circlex (4) > 590 then
                xdir (4) := -10
            elsif circlex (4) < 40 then
                xdir (4) := 10
            end if

        else

            if circley (0) > 349 then
                ydir (0) := -2
            elsif circley (0) < 49 then
                ydir (0) := 2
            end if

            if circlex (0) > 578 then
                xdir (0) := -2
            elsif circlex (0) < 48 then
                xdir (0) := 2
            end if

            if circley (1) > 329 then
                ydir (1) := -3
            elsif circley (1) < 67 then
                ydir (1) := 3
            end if

            if circlex (1) > 570 then
                xdir (1) := -3
            elsif circlex (1) < 70 then
                xdir (1) := 3
            end if

            if circley (2) > 366 then
                ydir (2) := -5
            elsif circley (2) < 28 then
                ydir (2) := 5
            end if

            if circlex (2) > 605 then
                xdir (2) := -5
            elsif circlex (2) < 30 then
                xdir (2) := 5
            end if

            if circley (3) > 354 then
                ydir (3) := -4
            elsif circley (3) < 50 then
                ydir (3) := 4
            end if

            if circlex (3) > 588 then
                xdir (3) := -4
            elsif circlex (3) < 42 then
                xdir (3) := 4
            end if

            if circley (4) > 380 then
                ydir (4) := -10
            elsif circley (4) < 20 then
                ydir (4) := 10
            end if

            if circlex (4) > 605 then
                xdir (4) := -10
            elsif circlex (4) < 25 then
                xdir (4) := 10
            end if
        end if

        circlex (0) := circlex (0) + xdir (0)
        circley (0) := circley (0) + ydir (0)
        circlex (1) := circlex (1) + xdir (1)
        circley (1) := circley (1) + ydir (1)
        circley (2) := circley (2) + ydir (2)
        circlex (2) := circlex (2) + xdir (2)
        circley (3) := circley (3) + ydir (3)
        circlex (3) := circlex (3) + xdir (3)
        circley (4) := circley (4) + ydir (4)
        circlex (4) := circlex (4) + xdir (4)

        %calculate the distance between the centres of the circles
        if choice = "3" then
            distance_between_centres (0) := sqrt ((mx - circlex (0)) ** 2 + (my - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((mx - circlex (1)) ** 2 + (my - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((mx - circlex (2)) ** 2 + (my - circley (2)) ** 2)
            distance_between_centres (3) := sqrt ((mx - circlex (3)) ** 2 + (my - circley (3)) ** 2)
            distance_between_centres (4) := sqrt ((mx - circlex (4)) ** 2 + (my - circley (4)) ** 2)
        else
            distance_between_centres (0) := sqrt ((x - circlex (0)) ** 2 + (y - circley (0)) ** 2)
            distance_between_centres (1) := sqrt ((x - circlex (1)) ** 2 + (y - circley (1)) ** 2)
            distance_between_centres (2) := sqrt ((x - circlex (2)) ** 2 + (y - circley (2)) ** 2)
            distance_between_centres (3) := sqrt ((x - circlex (3)) ** 2 + (y - circley (3)) ** 2)
            distance_between_centres (4) := sqrt ((x - circlex (4)) ** 2 + (y - circley (4)) ** 2)
        end if
        % collision detection
        if distance_between_centres (0) <= circler (0) + circle_radius
                or distance_between_centres (1) <= circler (1) + circle_radius
                or distance_between_centres (2) <= circler (2) + circle_radius
                or distance_between_centres (3) <= circler (3) + circle_radius
                or distance_between_centres (4) <= circler (4) + circle_radius then
            drawfill (maxx, maxy, 14, 14)
            Font.Draw ("GAME OVER!!", 50, 200, gameover, 255)         %gameover screen
            View.Update
            exit
        end if
        counter (3) := counter (3) + 1
        exit when counter (3) > 400
    elsif deadoralive = "dead" then
        exit
    end if
end loop

if counter (3) > 400 and choice = "2" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try using the cheat bigdanger for a bigger challenge.", 7, 100, level, 255)
elsif counter (3) > 400 and choice = "speedy" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try NOT using cheats.", 140, 100, level, 255)
elsif counter (3) > 400 and choice = "bigdanger" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("You have mastered Circular Danger.", 118, 100, level, 255)
elsif counter (3) > 400 and choice = "smallcircle" then
    Font.Draw ("Congratulations, You Won!", 20, 200, youwin, 255)             %Win screen
    Font.Draw ("Next time try NOT using cheats.", 140, 100, level, 255)
end if
View.Update
Forumer




PostPosted: Tue Dec 02, 2008 7:08 pm   Post subject: RE:Gr. 10 Game

holy..how long did it take u to code that?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 24 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: