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

Username:   Password: 
 RegisterRegister   
 I Need To Improve My Program and Need Feedback...
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
solblade05




PostPosted: Tue Jan 03, 2006 3:05 pm   Post subject: I Need To Improve My Program and Need Feedback...

Thanks, please help me with improving it too
Sponsor
Sponsor
Sponsor
sponsor
solblade05




PostPosted: Tue Jan 03, 2006 3:06 pm   Post subject: (No subject)

sorry^^


Mp.t
 Description:

Download
 Filename:  Mp.t
 Filesize:  22.27 KB
 Downloaded:  114 Time(s)

cool dude




PostPosted: Tue Jan 03, 2006 6:58 pm   Post subject: (No subject)

i like the graphics that your doing since turing isn't easy to do graphics on. suggestions would be:

1)let the user see wat answer they're typing

2)error proof it!!! (Don't allow letters, b/c program crashes)

3)when u get the answer wrong and u display the correct one it cuts off so u can't really see it. just change the text size to a bit smaller.

4)have statistics of how many u got right and how many wrong.

5)when user is playing the game have a button where they could exit, else keep randomizing equations.
solblade05




PostPosted: Tue Jan 03, 2006 7:13 pm   Post subject: (No subject)

thanks, that the first feedback. phew...

i can figure out how to do all of them except the not accepting letter. Do i use If statements, and i do how do i use them? thanks, if anyone helps...

code:

setscreen ("graphics:750;750, nocursor, noecho")


% Star Variable
var s : int
var s1 : int

% Done By
var f2 : int := Font.New ("Ignacio:22:bold")         % Font Information
assert f2 > 0                                 % Make Sure Font Is Made

% Adding
var f4 : int := Font.New ("Ignacio:14")
assert f4 > 0

% Subtract
var f5 : int := Font.New ("Ignacio:14")              % Font Information
assert f5 > 0                                 % Make Sure Font Is Made

% Multiply
var f6 : int := Font.New ("Ignacio:14")              % Font Information
assert f6 > 0                                 % Make Sure Font Is Made

% Divide
var f7 : int := Font.New ("Ignacio:14")              % Font Information
assert f7 > 0                                 % Make Sure Font Is Made

% Exit
var f8 : int := Font.New ("Ignacio:14")              % Font Information
assert f8 > 0                                 % Make Sure Font Is Made

% Credits
var f9 : int := Font.New ("Ignacio:40:bold")              % Font Information
assert f9 > 0                                 % Make Sure Font Is Made

var f10 : int := Font.New ("Ignacio:16:bold")
assert f10 > 0

var f11 : int := Font.New ("Ignacio:16:bold")     % Font Information
assert f11 > 0                                % Make Sure Font Is Made

% Click To Start Instruction
var f12 : int := Font.New ("Ignacio:12")     % Font Information
assert f12 > 0                                % Make Sure Font Is Made

% Variable For When Box Not Clicked On The Menu
var f13 : int := Font.New ("Ignacio:10")     % Font Information
assert f13 > 0                                % Make Sure Font Is Made

% Variable For Select Level (Addition)
var f14 : int := Font.New ("Ignacio:36")     % Font Information
assert f14 > 0                                % Make Sure Font Is Made

% Back (Addition)
var f15 : int := Font.New ("Ignacio:16")
assert f15 > 0

% Easy (Addition)
var f16 : int := Font.New ("Ignacio:16")
assert f16 > 0

% Normal (Addition)
var f17 : int := Font.New ("Ignacio:16")
assert f17 > 0

% Hard (Addition)
var f18 : int := Font.New ("Ignacio:16")
assert f18 > 0

% Varaiable For buttonwait
var x : int
var y : int
var bnum : int
var bud : int
var a : int
var b : int
var c : int
var ans : int
const NUM_OF_QUESTIONS := 5
var temp : int

% Animation Variables
var s2 : int

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SPLASH SCREEN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Music

Music.PlayFile ("Splash Screen.mp3")

% Flicker Free Transitions
View.Update

% Horizon Above (Sky)
drawfillbox (0, 300, 200, 600, 53)
drawfillbox (200, 300, 500, 600, 53)
drawfillbox (500, 300, 750, 600, 53)
drawfillbox (0, 600, 750, 750, 53)

% Horizon Below (Ground)
drawfillbox (0, 0, 750, 300, 45)

% Tree (Left)
drawfillbox (0, 0, 150, 400, red)

% Tree (Left) Leaves
drawfillbox (125, 225, 225, 325, green)
drawfillbox (115, 305, 250, 500, green)
drawfillbox (0, 365, 125, 550, green)

% Tree (Right)
drawfillbox (600, 0, 750, 375, red)

% Tree (Right) Leaves
drawfillbox (625, 375, 750, 550, green)
drawfillbox (500, 325, 625, 500, green)
drawfillbox (525, 225, 625, 325, green)

% Title (Creating The Font)
Pic.ScreenLoad ("MagicMath.jpg", 135, 520, picCopy)

% Font (Done By..)
Font.Draw ("Done By: Jawad Khan", 190, 180, f2, black)

% Instruction
Font.Draw ("Click To Let The Magic Begin", 210, 120, f12, black)
buttonwait ("down", x, y, bnum, bud)


Music.PlayFileStop

%%%%%%%%% Variables %%%%%%%%
loop
    delay (150)

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MENU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % Music

    Music.PlayFile ("Menu Screen.mp3")

    % Color Back
    drawfillbox (0, 0, 750, 750, 53)

    % Horizon Below (Ground)
    drawfillbox (0, 0, 750, 300, 45)

    % Tree (Left)
    drawfillbox (0, 0, 150, 400, red)

    % Tree (Left) Leaves
    drawfillbox (125, 225, 225, 325, green)
    drawfillbox (115, 305, 250, 500, green)
    drawfillbox (0, 365, 125, 550, green)

    % Tree (Right)
    drawfillbox (600, 0, 750, 375, red)

    % Tree (Right) Leaves
    drawfillbox (625, 375, 750, 550, green)
    drawfillbox (500, 325, 650, 500, green)
    drawfillbox (525, 225, 625, 325, green)


    % Selections Boxes
    drawfillbox (85, 275, 223, 375, 43)         % Add
    drawfillbox (100, 285, 210, 365, 44)
    drawfillbox (235, 275, 373, 375, 43)         % Sub
    drawfillbox (245, 285, 365, 365, 44)
    drawfillbox (385, 275, 520, 375, 43)         % Multiply
    drawfillbox (395, 285, 510, 365, 44)
    drawfillbox (530, 275, 665, 375, 43)         % Divide
    drawfillbox (540, 285, 655, 365, 44)
    drawfillbox (310, 165, 445, 265, 43)         % Exit
    drawfillbox (320, 175, 435, 255, 44)

    % Add
    Font.Draw ("Add", 130, 315, f4, black)

    % Subtract
    Font.Draw ("Subtract", 250, 315, f5, black)

    % Multiply
    Font.Draw ("Multiply", 400, 315, f6, black)

    % Divide
    Font.Draw ("Divide", 560, 315, f7, black)

    % Exit
    Font.Draw ("Exit", 350, 205, f8, black)

    % Menu
    Pic.ScreenLoad ("Menu.jpg", 255, 450, picCopy)

    Music.PlayFileStop

    % Buttonwait &  Loop
    Music.PlayFile ("Game.mp3")
    buttonwait ("down", x, y, bnum, bud)

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if x > 85 and x < 223 and y > 275 and y < 375 then

        loop

            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 200, 565, f14, black)
            Font.Draw ("Addition", 305, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)     % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 450, f15, black)

            drawfillbox (305, 275, 440, 375, 43)     % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 350, 300, f16, black)

            drawfillbox (305, 170, 440, 270, 43)     % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 350, 190, f17, black)

            drawfillbox (305, 65, 440, 165, 43)     % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 350, 90, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 285, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (ans), 285, 565, f14, black)

                    if ans = a + b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 30)
                    randint (b, -10, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for
            else
                exit
            end if
            delay (500)
        end loop


        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtraction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 235 and x < 373 and y > 275 and y < 375 then

        loop

            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 200, 565, f14, black)
            Font.Draw ("Subtraction", 255, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)     % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 450, f15, black)

            drawfillbox (305, 275, 440, 375, 43)     % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 350, 300, f16, black)

            drawfillbox (305, 170, 440, 270, 43)     % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 350, 190, f17, black)

            drawfillbox (305, 65, 440, 165, 43)     % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 350, 90, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 285, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (ans), 285, 565, f14, black)
                    if ans = a - b then
                        Font.Draw ("Correct!", 300, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)

                    loop
                        exit when hasch
                    end loop
                end for
            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 20)
                    randint (b, -10, 20)
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for

            else
                exit
            end if
            delay (500)
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtract End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 385 and x < 520 and y > 275 and y < 375 then

        loop

            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 200, 565, f14, black)
            Font.Draw ("Multiplication", 285, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)     % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 450, f15, black)

            drawfillbox (305, 275, 440, 375, 43)     % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 350, 300, f16, black)

            drawfillbox (305, 170, 440, 270, 43)     % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 350, 190, f17, black)

            drawfillbox (305, 65, 440, 165, 43)     % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 350, 90, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 5)
                    randint (b, 0, 5)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 285, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (ans), 285, 565, f14, black)

                    if ans = a * b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 10)
                    randint (b, 0, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for
            else
                exit
            end if
            delay (500)
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multiply End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 530 and x < 665 and y > 275 and y < 375 then
        loop

            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 200, 565, f14, black)
            Font.Draw ("Division", 285, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)     % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 450, f15, black)

            drawfillbox (305, 275, 440, 375, 43)     % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 350, 300, f16, black)

            drawfillbox (305, 170, 440, 270, 43)     % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 350, 190, f17, black)

            drawfillbox (305, 65, 440, 165, 43)     % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 350, 90, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 8)
                    randint (b, 0, 8)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 285, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (ans), 285, 565, f14, black)

                    if ans = a * b div a then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 10)
                    randint (b, 0, 10)
                    Font.Draw (intstr (a * b) + " * " + intstr (a) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a * b) + " * " + intstr (a) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get ans
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (ans), 90, 565, f14, black)

                    if ans = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Right Answer Is " + intstr (a * b div a), 80, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                end for
            else
                exit
            end if
            delay (500)
        end loop



        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 310 and x < 445 and y > 165 and y < 265 then
        cls
        delay (500)
        drawfillbox (0, 0, 750, 750, white)
        Font.Draw ("Magic Math", 290, 600, f9, 43)
        Font.Draw ("Done By: Jawad Khan", 280, 500, f10, 43)
        Font.Draw ("Infor-Games, In Cooperation With", 110, 400, f11, 43)
        Pic.ScreenLoad ("EA2.jpg", 205, 125, picCopy)
        delay (500)

        exit
    end if
    delay (500)
    Music.PlayFileStop
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%

DIIST




PostPosted: Tue Jan 03, 2006 10:02 pm   Post subject: (No subject)

Try this. It will help the program chrash less!

code:

%Use this procedure!!!
proc getint (var interger_varible : int)
    var temp : string
    get temp%Takes input as string
    %Checks if its Safe to convert
    if strrealok (temp) then %Note used converts to real so 15.5 is still valid number
        interger_varible := round (strreal (temp))%Rounds real number into interger
    else
        interger_varible := 0 %So program still runs!!!
    end if
end getint


var answer : int

%Example of Use
getint (answer)


put answer %Regardless of what the enter it will not crash!!


cool dude




PostPosted: Tue Jan 03, 2006 11:33 pm   Post subject: (No subject)

i believe theres a really good tuturial on error proofing check into it. if your still having trouble post again and i will try to explain better on error proofing Smile
solblade05




PostPosted: Wed Jan 04, 2006 11:04 am   Post subject: (No subject)

I looked at the tutorials and sort of understood the basics, (bith the array and error proofing), but i still cant figure out where to insrt them in my code, also how do i make them both compatible with fot.draw Question
pavol




PostPosted: Wed Jan 04, 2006 12:39 pm   Post subject: (No subject)

if i've created programs in the past that have to do with getting integer values, and i don't want the program to crash i do sort of like what thuvs suggested except i don't use procedures and stuff, i just declare the variables as strings from the start and when i need to use them in mathematical 'ways' i just use strint(the variable).
Sponsor
Sponsor
Sponsor
sponsor
solblade05




PostPosted: Wed Jan 04, 2006 1:26 pm   Post subject: (No subject)

yeah i know, but i dont know how to put that in my code Sad
I'm also using Font.Draw. Please refer to my code above, tell me where and what to add, you dont have to add it in for me but atleast i'll know what to do...

I'm an extreme noob in turing please give me alot of help.... Sad Sad Crying or Very sad
pavol




PostPosted: Thu Jan 05, 2006 11:31 am   Post subject: (No subject)

just change your ans variable to be declared as a string instead and when you're testing for a value like you do here:
code:
if ans = a + b then
    Font.Draw ("Correct!", 300, 450, f14, black)

else
    Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
end if

you can use strintok(), which checks if the value can safely be converted and returns either a true or false value, and strint(), which changes the value from a string to an integer, like this:
code:
if strintok(ans) then
    if strint(ans) = a + b then
        Font.Draw ("Correct", 300, 450, f14, black)
    else
        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
end if

and Font.Draw seems fine to me
cool dude




PostPosted: Thu Jan 05, 2006 5:26 pm   Post subject: (No subject)

k since u didn't fix the words cutting of the way u fix it is by increasing the first number in your setscreen

code:

setscreen ("graphics:850;750, nocursor, noecho")


anyways in order to make sure they don't enter any letters u can make a function checking the "ans"

code:

function ValidInt : int
var ans : string         % User's input - can be anything
    get ans
    %keep asking for input until it is a valid integer
    loop
        exit when strintok (ans)
        colour (0)
        put "Not a valid difficulty level, try again"
        View.Update
        get ans
    end loop
    %Sends the result to the main program
    result strint (ans)
end ValidInt


Dont forget to decalre ans as string instead of int!!!
solblade05




PostPosted: Fri Jan 06, 2006 12:02 am   Post subject: (No subject)

OK This is what i have so far...

code:


setscreen ("graphics:750;750, nocursor, noecho")

%Stars
var q : int
var w : int

% Done By
var f2 : int := Font.New ("Ignacio:22:bold")         % Font Information
assert f2 > 0                                 % Make Sure Font Is Made

% Adding
var f4 : int := Font.New ("Ignacio:16")              % Font Information
assert f4 > 0                                 % Make Sure Font Is Made

% Menu
var f3 : int := Font.New ("Ignacio:44")              % Font Information
assert f3 > 0                                 % Make Sure Font Is Made

% Subtract
var f5 : int := Font.New ("Ignacio:16")              % Font Information
assert f5 > 0                                 % Make Sure Font Is Made

% Multiply
var f6 : int := Font.New ("Ignacio:16")              % Font Information
assert f6 > 0                                 % Make Sure Font Is Made

% Divide
var f7 : int := Font.New ("Ignacio:16")              % Font Information
assert f7 > 0                                 % Make Sure Font Is Made

% Exit
var f8 : int := Font.New ("Ignacio:16")              % Font Information
assert f8 > 0                                 % Make Sure Font Is Made

% Credits
var f9 : int := Font.New ("Ignacio:50:bold")              % Font Information
assert f9 > 0                                 % Make Sure Font Is Made

var f10 : int := Font.New ("Ignacio:16:bold")
assert f10 > 0

var f11 : int := Font.New ("Ignacio:16:bold")     % Font Information
assert f11 > 0                                % Make Sure Font Is Made

% Click To Let Magic Begin
var f12 : int := Font.New ("Ignacio:14")     % Font Information
assert f12 > 0                                % Make Sure Font Is Made

% Variable For Select Level (Addition)
var f14 : int := Font.New ("Ignacio:32")     % Font Information
assert f14 > 0                                % Make Sure Font Is Made

% Back (Addition)
var f15 : int := Font.New ("Ignacio:16")
assert f15 > 0

% Easy (Addition)
var f16 : int := Font.New ("Ignacio:16")
assert f16 > 0

% Normal (Addition)
var f17 : int := Font.New ("Ignacio:16")
assert f17 > 0

% Hard (Addition)
var f18 : int := Font.New ("Ignacio:16")
assert f18 > 0

% Varaiable For buttonwait
var x : int
var y : int
var bnum : int
var bud : int
var a : int
var b : int
var c : int
var answer : int
const NUM_OF_QUESTIONS := 5
var temp : int
var count : int := 0

% Music Variable  (Finished)
var finished : boolean := false
var finished2 : boolean := false
% During
var finished3 : boolean := false
% End During
var finished4 : boolean := false
var finished5 : boolean := false

% Flicker Free Transitions
View.Update

%%%%%%%%%%% Music Variables %%%%%%%%%%%%
% Splash Screen
process splash
    loop
        exit when finished
        Music.PlayFile ("Splash.mp3")
    end loop
end splash

% Menu Screen
process menu
    loop
        exit when finished2
        Music.PlayFile ("Menu.mp3")
    end loop
end menu

% During Gameplay
process Dgame
    loop
        exit when finished3
        Music.PlayFile ("Termina.mp3")
    end loop
end Dgame

% Back To Menu
process BTM
    loop
        exit when finished4
        Music.PlayFile ("Menu.mp3")
    end loop
end BTM

% Credits Music
process CM
    loop
        exit when finished5
        Music.PlayFile ("Splash.mp3")
    end loop
end CM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SPLASH SCREEN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fork splash
% Horizon Above (Sky)
drawfillbox (0, 300, 200, 600, 53)
drawfillbox (200, 300, 500, 600, 53)
drawfillbox (500, 300, 750, 600, 53)
drawfillbox (0, 600, 750, 750, 53)

% Horizon Below (Ground)
drawfillbox (0, 0, 750, 300, 45)

% Tree (Left)
drawfillbox (0, 0, 150, 400, red)

% Tree (Left) Leaves
drawfillbox (125, 225, 225, 325, green)
drawfillbox (115, 305, 250, 500, green)
drawfillbox (0, 365, 125, 550, green)

% Tree (Right)
drawfillbox (600, 0, 750, 375, red)

% Tree (Right) Leaves
drawfillbox (625, 375, 750, 550, green)
drawfillbox (500, 325, 625, 500, green)
drawfillbox (525, 225, 625, 325, green)

% Title (Creating The Font)
Pic.ScreenLoad ("MagicMath.jpg", 135, 520, picCopy)

% Font (Done By..)
Font.Draw ("Done By: Jawad Khan", 227, 180, f2, black)

% Instruction
Font.Draw ("!Press A Key Then Click, Let The Magic Begin!", 190, 120, f12, black)

% Stars
for s1 : 1 .. 15
    randint (q, 0, 700)
    randint (w, 620, 750)
    loop
        drawfillstar (q, w, q + 10, w + 10, yellow)
        delay (100)
        drawfillstar (q, w, q + 10, w + 10, white)
        exit when hasch
    end loop
end for

% Click To Enter Menu
buttonwait ("down", x, y, bnum, bud)

% Ending the Music
% Stops the background music.
finished := true                % The flag
Music.PlayFileStop              % Music.PlayFile will return immediately

%%%%%%%%% Variables %%%%%%%%
loop
    delay (150)
    fork menu
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MENU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % Color Back
    drawfillbox (0, 0, 750, 750, 53)

    % Horizon Below (Ground)
    drawfillbox (0, 0, 750, 300, 45)

    % Tree (Left)
    drawfillbox (0, 0, 150, 400, red)

    % Tree (Left) Leaves
    drawfillbox (125, 225, 225, 325, green)
    drawfillbox (115, 305, 250, 500, green)
    drawfillbox (0, 365, 125, 550, green)

    % Tree (Right)
    drawfillbox (600, 0, 750, 375, red)

    % Tree (Right) Leaves
    drawfillbox (625, 375, 750, 550, green)
    drawfillbox (500, 325, 650, 500, green)
    drawfillbox (525, 225, 625, 325, green)


    % Selections Boxes
    drawfillbox (85, 275, 223, 375, 43)         % Add
    drawfillbox (100, 285, 210, 365, 44)
    Font.Draw ("Add", 135, 315, f4, black)

    drawfillbox (235, 275, 373, 375, 43)         % Sub
    drawfillbox (245, 285, 365, 365, 44)
    Font.Draw ("Subtract", 265, 315, f5, black)

    drawfillbox (385, 275, 520, 375, 43)         % Multiply
    drawfillbox (395, 285, 510, 365, 44)
    Font.Draw ("Multiply", 415, 315, f6, black)

    drawfillbox (530, 275, 665, 375, 43)         % Divide
    drawfillbox (540, 285, 655, 365, 44)
    Font.Draw ("Divide", 565, 315, f7, black)

    drawfillbox (310, 165, 445, 265, 43)         % Exit
    drawfillbox (320, 175, 435, 255, 44)
    Font.Draw ("Exit", 360, 205, f8, black)

    % Menu
    Font.Draw ("Menu", 300, 440, f3, black)

    % Stars
    for s1 : 1 .. 15
        randint (q, 0, 700)
        randint (w, 620, 750)
        loop
            drawfillstar (q, w, q + 10, w + 10, yellow)
            delay (100)
            drawfillstar (q, w, q + 10, w + 10, white)
            exit when hasch
        end loop
    end for

    % Buttonwait &  Loop
    buttonwait ("down", x, y, bnum, bud)

    % Ending the Music
    % Stops the background music.
    finished2 := true            % The flag
    Music.PlayFileStop          % Music.PlayFile will return immediately

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if x > 85 and x < 223 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Addition", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 30)
                    randint (b, -10, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer

                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtraction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 235 and x < 373 and y > 275 and y < 375 then

        loop
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Subtraction", 267, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)
                    if answer = a - b then
                        Font.Draw ("Correct!", 300, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)

                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then             % Normal
                colorback (68)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 20)
                    randint (b, -10, 20)
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtract End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 385 and x < 520 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Multiplication", 250, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 5)
                    randint (b, 0, 5)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " =", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 10)
                    randint (b, 0, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multiply End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 530 and x < 665 and y > 275 and y < 375 then
        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Division", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 8)
                    randint (b, 1, 8)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 10)
                    randint (b, 1, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Right Answer Is " + intstr (a * b div a), 80, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
                % Ending the Music
                % Stops the background music.
                finished3 := true     % The flag
                Music.PlayFileStop     % Music.PlayFile will return immediately
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 310 and x < 445 and y > 165 and y < 265 then
        fork CM
        cls
        delay (500)
        drawfillbox (0, 0, 750, 750, white)
        delay (3000)
        for yy : 0 .. maxy by 100
            Font.Draw ("Magic Math", 200, yy, f9, 43)
            delay (2000)
            cls
        end for
        for yyy : 0 .. maxy by 100
            Font.Draw ("Done By: Jawad Khan", 280, yyy, f10, 43)
            delay (2000)
            cls
        end for
        for yyyy : 0 .. maxy by 100
            Font.Draw ("Infor-Games, In Cooperation With", 200, yyyy, f11, 43)
            delay (2000)
            cls
        end for
        for yyyyy : 0 .. maxy by 100
            Pic.ScreenLoad ("EA2.jpg", 230, yyyyy, picCopy)
            delay (1500)
            cls
        end for
        delay (500)
        Font.Draw ("Magic Math", 200, 500, f9, 43)
        cls
        % Ending the Music
        % Stops the background music.
        finished5 := true        % The flag
        Music.PlayFileStop      % Music.PlayFile will return immediately
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%



You'll also need these music files...
solblade05




PostPosted: Fri Jan 06, 2006 12:04 am   Post subject: (No subject)

OK This is what i have so far...

code:


setscreen ("graphics:750;750, nocursor, noecho")

%Stars
var q : int
var w : int

% Done By
var f2 : int := Font.New ("Ignacio:22:bold")         % Font Information
assert f2 > 0                                 % Make Sure Font Is Made

% Adding
var f4 : int := Font.New ("Ignacio:16")              % Font Information
assert f4 > 0                                 % Make Sure Font Is Made

% Menu
var f3 : int := Font.New ("Ignacio:44")              % Font Information
assert f3 > 0                                 % Make Sure Font Is Made

% Subtract
var f5 : int := Font.New ("Ignacio:16")              % Font Information
assert f5 > 0                                 % Make Sure Font Is Made

% Multiply
var f6 : int := Font.New ("Ignacio:16")              % Font Information
assert f6 > 0                                 % Make Sure Font Is Made

% Divide
var f7 : int := Font.New ("Ignacio:16")              % Font Information
assert f7 > 0                                 % Make Sure Font Is Made

% Exit
var f8 : int := Font.New ("Ignacio:16")              % Font Information
assert f8 > 0                                 % Make Sure Font Is Made

% Credits
var f9 : int := Font.New ("Ignacio:50:bold")              % Font Information
assert f9 > 0                                 % Make Sure Font Is Made

var f10 : int := Font.New ("Ignacio:16:bold")
assert f10 > 0

var f11 : int := Font.New ("Ignacio:16:bold")     % Font Information
assert f11 > 0                                % Make Sure Font Is Made

% Click To Let Magic Begin
var f12 : int := Font.New ("Ignacio:14")     % Font Information
assert f12 > 0                                % Make Sure Font Is Made

% Variable For Select Level (Addition)
var f14 : int := Font.New ("Ignacio:32")     % Font Information
assert f14 > 0                                % Make Sure Font Is Made

% Back (Addition)
var f15 : int := Font.New ("Ignacio:16")
assert f15 > 0

% Easy (Addition)
var f16 : int := Font.New ("Ignacio:16")
assert f16 > 0

% Normal (Addition)
var f17 : int := Font.New ("Ignacio:16")
assert f17 > 0

% Hard (Addition)
var f18 : int := Font.New ("Ignacio:16")
assert f18 > 0

% Varaiable For buttonwait
var x : int
var y : int
var bnum : int
var bud : int
var a : int
var b : int
var c : int
var answer : int
const NUM_OF_QUESTIONS := 5
var temp : int
var count : int := 0

% Music Variable  (Finished)
var finished : boolean := false
var finished2 : boolean := false
% During
var finished3 : boolean := false
% End During
var finished4 : boolean := false
var finished5 : boolean := false

% Flicker Free Transitions
View.Update

%%%%%%%%%%% Music Variables %%%%%%%%%%%%
% Splash Screen
process splash
    loop
        exit when finished
        Music.PlayFile ("Splash.mp3")
    end loop
end splash

% Menu Screen
process menu
    loop
        exit when finished2
        Music.PlayFile ("Menu.mp3")
    end loop
end menu

% During Gameplay
process Dgame
    loop
        exit when finished3
        Music.PlayFile ("Termina.mp3")
    end loop
end Dgame

% Back To Menu
process BTM
    loop
        exit when finished4
        Music.PlayFile ("Menu.mp3")
    end loop
end BTM

% Credits Music
process CM
    loop
        exit when finished5
        Music.PlayFile ("Splash.mp3")
    end loop
end CM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SPLASH SCREEN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fork splash
% Horizon Above (Sky)
drawfillbox (0, 300, 200, 600, 53)
drawfillbox (200, 300, 500, 600, 53)
drawfillbox (500, 300, 750, 600, 53)
drawfillbox (0, 600, 750, 750, 53)

% Horizon Below (Ground)
drawfillbox (0, 0, 750, 300, 45)

% Tree (Left)
drawfillbox (0, 0, 150, 400, red)

% Tree (Left) Leaves
drawfillbox (125, 225, 225, 325, green)
drawfillbox (115, 305, 250, 500, green)
drawfillbox (0, 365, 125, 550, green)

% Tree (Right)
drawfillbox (600, 0, 750, 375, red)

% Tree (Right) Leaves
drawfillbox (625, 375, 750, 550, green)
drawfillbox (500, 325, 625, 500, green)
drawfillbox (525, 225, 625, 325, green)

% Title (Creating The Font)
Pic.ScreenLoad ("MagicMath.jpg", 135, 520, picCopy)

% Font (Done By..)
Font.Draw ("Done By: Jawad Khan", 227, 180, f2, black)

% Instruction
Font.Draw ("!Press A Key Then Click, Let The Magic Begin!", 190, 120, f12, black)

% Stars
for s1 : 1 .. 15
    randint (q, 0, 700)
    randint (w, 620, 750)
    loop
        drawfillstar (q, w, q + 10, w + 10, yellow)
        delay (100)
        drawfillstar (q, w, q + 10, w + 10, white)
        exit when hasch
    end loop
end for

% Click To Enter Menu
buttonwait ("down", x, y, bnum, bud)

% Ending the Music
% Stops the background music.
finished := true                % The flag
Music.PlayFileStop              % Music.PlayFile will return immediately

%%%%%%%%% Variables %%%%%%%%
loop
    delay (150)
    fork menu
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MENU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % Color Back
    drawfillbox (0, 0, 750, 750, 53)

    % Horizon Below (Ground)
    drawfillbox (0, 0, 750, 300, 45)

    % Tree (Left)
    drawfillbox (0, 0, 150, 400, red)

    % Tree (Left) Leaves
    drawfillbox (125, 225, 225, 325, green)
    drawfillbox (115, 305, 250, 500, green)
    drawfillbox (0, 365, 125, 550, green)

    % Tree (Right)
    drawfillbox (600, 0, 750, 375, red)

    % Tree (Right) Leaves
    drawfillbox (625, 375, 750, 550, green)
    drawfillbox (500, 325, 650, 500, green)
    drawfillbox (525, 225, 625, 325, green)


    % Selections Boxes
    drawfillbox (85, 275, 223, 375, 43)         % Add
    drawfillbox (100, 285, 210, 365, 44)
    Font.Draw ("Add", 135, 315, f4, black)

    drawfillbox (235, 275, 373, 375, 43)         % Sub
    drawfillbox (245, 285, 365, 365, 44)
    Font.Draw ("Subtract", 265, 315, f5, black)

    drawfillbox (385, 275, 520, 375, 43)         % Multiply
    drawfillbox (395, 285, 510, 365, 44)
    Font.Draw ("Multiply", 415, 315, f6, black)

    drawfillbox (530, 275, 665, 375, 43)         % Divide
    drawfillbox (540, 285, 655, 365, 44)
    Font.Draw ("Divide", 565, 315, f7, black)

    drawfillbox (310, 165, 445, 265, 43)         % Exit
    drawfillbox (320, 175, 435, 255, 44)
    Font.Draw ("Exit", 360, 205, f8, black)

    % Menu
    Font.Draw ("Menu", 300, 440, f3, black)

    % Stars
    for s1 : 1 .. 15
        randint (q, 0, 700)
        randint (w, 620, 750)
        loop
            drawfillstar (q, w, q + 10, w + 10, yellow)
            delay (100)
            drawfillstar (q, w, q + 10, w + 10, white)
            exit when hasch
        end loop
    end for

    % Buttonwait &  Loop
    buttonwait ("down", x, y, bnum, bud)

    % Ending the Music
    % Stops the background music.
    finished2 := true            % The flag
    Music.PlayFileStop          % Music.PlayFile will return immediately

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if x > 85 and x < 223 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Addition", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 30)
                    randint (b, -10, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer

                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtraction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 235 and x < 373 and y > 275 and y < 375 then

        loop
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Subtraction", 267, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)
                    if answer = a - b then
                        Font.Draw ("Correct!", 300, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)

                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then             % Normal
                colorback (68)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 20)
                    randint (b, -10, 20)
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtract End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 385 and x < 520 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Multiplication", 250, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 5)
                    randint (b, 0, 5)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " =", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 10)
                    randint (b, 0, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multiply End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 530 and x < 665 and y > 275 and y < 375 then
        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Division", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 8)
                    randint (b, 1, 8)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 10)
                    randint (b, 1, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Right Answer Is " + intstr (a * b div a), 80, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
                % Ending the Music
                % Stops the background music.
                finished3 := true     % The flag
                Music.PlayFileStop     % Music.PlayFile will return immediately
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 310 and x < 445 and y > 165 and y < 265 then
        fork CM
        cls
        delay (500)
        drawfillbox (0, 0, 750, 750, white)
        delay (3000)
        for yy : 0 .. maxy by 100
            Font.Draw ("Magic Math", 200, yy, f9, 43)
            delay (2000)
            cls
        end for
        for yyy : 0 .. maxy by 100
            Font.Draw ("Done By: Jawad Khan", 280, yyy, f10, 43)
            delay (2000)
            cls
        end for
        for yyyy : 0 .. maxy by 100
            Font.Draw ("Infor-Games, In Cooperation With", 200, yyyy, f11, 43)
            delay (2000)
            cls
        end for
        for yyyyy : 0 .. maxy by 100
            Pic.ScreenLoad ("EA2.jpg", 230, yyyyy, picCopy)
            delay (1500)
            cls
        end for
        delay (500)
        Font.Draw ("Magic Math", 200, 500, f9, 43)
        cls
        % Ending the Music
        % Stops the background music.
        finished5 := true        % The flag
        Music.PlayFileStop      % Music.PlayFile will return immediately
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%



You'll also need these music files...
solblade05




PostPosted: Fri Jan 06, 2006 12:07 am   Post subject: (No subject)

OK This is what i have so far...

code:


setscreen ("graphics:750;750, nocursor, noecho")

%Stars
var q : int
var w : int

% Done By
var f2 : int := Font.New ("Ignacio:22:bold")         % Font Information
assert f2 > 0                                 % Make Sure Font Is Made

% Adding
var f4 : int := Font.New ("Ignacio:16")              % Font Information
assert f4 > 0                                 % Make Sure Font Is Made

% Menu
var f3 : int := Font.New ("Ignacio:44")              % Font Information
assert f3 > 0                                 % Make Sure Font Is Made

% Subtract
var f5 : int := Font.New ("Ignacio:16")              % Font Information
assert f5 > 0                                 % Make Sure Font Is Made

% Multiply
var f6 : int := Font.New ("Ignacio:16")              % Font Information
assert f6 > 0                                 % Make Sure Font Is Made

% Divide
var f7 : int := Font.New ("Ignacio:16")              % Font Information
assert f7 > 0                                 % Make Sure Font Is Made

% Exit
var f8 : int := Font.New ("Ignacio:16")              % Font Information
assert f8 > 0                                 % Make Sure Font Is Made

% Credits
var f9 : int := Font.New ("Ignacio:50:bold")              % Font Information
assert f9 > 0                                 % Make Sure Font Is Made

var f10 : int := Font.New ("Ignacio:16:bold")
assert f10 > 0

var f11 : int := Font.New ("Ignacio:16:bold")     % Font Information
assert f11 > 0                                % Make Sure Font Is Made

% Click To Let Magic Begin
var f12 : int := Font.New ("Ignacio:14")     % Font Information
assert f12 > 0                                % Make Sure Font Is Made

% Variable For Select Level (Addition)
var f14 : int := Font.New ("Ignacio:32")     % Font Information
assert f14 > 0                                % Make Sure Font Is Made

% Back (Addition)
var f15 : int := Font.New ("Ignacio:16")
assert f15 > 0

% Easy (Addition)
var f16 : int := Font.New ("Ignacio:16")
assert f16 > 0

% Normal (Addition)
var f17 : int := Font.New ("Ignacio:16")
assert f17 > 0

% Hard (Addition)
var f18 : int := Font.New ("Ignacio:16")
assert f18 > 0

% Varaiable For buttonwait
var x : int
var y : int
var bnum : int
var bud : int
var a : int
var b : int
var c : int
var answer : int
const NUM_OF_QUESTIONS := 5
var temp : int
var count : int := 0

% Music Variable  (Finished)
var finished : boolean := false
var finished2 : boolean := false
% During
var finished3 : boolean := false
% End During
var finished4 : boolean := false
var finished5 : boolean := false

% Flicker Free Transitions
View.Update

%%%%%%%%%%% Music Variables %%%%%%%%%%%%
% Splash Screen
process splash
    loop
        exit when finished
        Music.PlayFile ("Splash.mp3")
    end loop
end splash

% Menu Screen
process menu
    loop
        exit when finished2
        Music.PlayFile ("Menu.mp3")
    end loop
end menu

% During Gameplay
process Dgame
    loop
        exit when finished3
        Music.PlayFile ("Termina.mp3")
    end loop
end Dgame

% Back To Menu
process BTM
    loop
        exit when finished4
        Music.PlayFile ("Menu.mp3")
    end loop
end BTM

% Credits Music
process CM
    loop
        exit when finished5
        Music.PlayFile ("Splash.mp3")
    end loop
end CM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SPLASH SCREEN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fork splash
% Horizon Above (Sky)
drawfillbox (0, 300, 200, 600, 53)
drawfillbox (200, 300, 500, 600, 53)
drawfillbox (500, 300, 750, 600, 53)
drawfillbox (0, 600, 750, 750, 53)

% Horizon Below (Ground)
drawfillbox (0, 0, 750, 300, 45)

% Tree (Left)
drawfillbox (0, 0, 150, 400, red)

% Tree (Left) Leaves
drawfillbox (125, 225, 225, 325, green)
drawfillbox (115, 305, 250, 500, green)
drawfillbox (0, 365, 125, 550, green)

% Tree (Right)
drawfillbox (600, 0, 750, 375, red)

% Tree (Right) Leaves
drawfillbox (625, 375, 750, 550, green)
drawfillbox (500, 325, 625, 500, green)
drawfillbox (525, 225, 625, 325, green)

% Title (Creating The Font)
Pic.ScreenLoad ("MagicMath.jpg", 135, 520, picCopy)

% Font (Done By..)
Font.Draw ("Done By: Jawad Khan", 227, 180, f2, black)

% Instruction
Font.Draw ("!Press A Key Then Click, Let The Magic Begin!", 190, 120, f12, black)

% Stars
for s1 : 1 .. 15
    randint (q, 0, 700)
    randint (w, 620, 750)
    loop
        drawfillstar (q, w, q + 10, w + 10, yellow)
        delay (100)
        drawfillstar (q, w, q + 10, w + 10, white)
        exit when hasch
    end loop
end for

% Click To Enter Menu
buttonwait ("down", x, y, bnum, bud)

% Ending the Music
% Stops the background music.
finished := true                % The flag
Music.PlayFileStop              % Music.PlayFile will return immediately

%%%%%%%%% Variables %%%%%%%%
loop
    delay (150)
    fork menu
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MENU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % Color Back
    drawfillbox (0, 0, 750, 750, 53)

    % Horizon Below (Ground)
    drawfillbox (0, 0, 750, 300, 45)

    % Tree (Left)
    drawfillbox (0, 0, 150, 400, red)

    % Tree (Left) Leaves
    drawfillbox (125, 225, 225, 325, green)
    drawfillbox (115, 305, 250, 500, green)
    drawfillbox (0, 365, 125, 550, green)

    % Tree (Right)
    drawfillbox (600, 0, 750, 375, red)

    % Tree (Right) Leaves
    drawfillbox (625, 375, 750, 550, green)
    drawfillbox (500, 325, 650, 500, green)
    drawfillbox (525, 225, 625, 325, green)


    % Selections Boxes
    drawfillbox (85, 275, 223, 375, 43)         % Add
    drawfillbox (100, 285, 210, 365, 44)
    Font.Draw ("Add", 135, 315, f4, black)

    drawfillbox (235, 275, 373, 375, 43)         % Sub
    drawfillbox (245, 285, 365, 365, 44)
    Font.Draw ("Subtract", 265, 315, f5, black)

    drawfillbox (385, 275, 520, 375, 43)         % Multiply
    drawfillbox (395, 285, 510, 365, 44)
    Font.Draw ("Multiply", 415, 315, f6, black)

    drawfillbox (530, 275, 665, 375, 43)         % Divide
    drawfillbox (540, 285, 655, 365, 44)
    Font.Draw ("Divide", 565, 315, f7, black)

    drawfillbox (310, 165, 445, 265, 43)         % Exit
    drawfillbox (320, 175, 435, 255, 44)
    Font.Draw ("Exit", 360, 205, f8, black)

    % Menu
    Font.Draw ("Menu", 300, 440, f3, black)

    % Stars
    for s1 : 1 .. 15
        randint (q, 0, 700)
        randint (w, 620, 750)
        loop
            drawfillstar (q, w, q + 10, w + 10, yellow)
            delay (100)
            drawfillstar (q, w, q + 10, w + 10, white)
            exit when hasch
        end loop
    end for

    % Buttonwait &  Loop
    buttonwait ("down", x, y, bnum, bud)

    % Ending the Music
    % Stops the background music.
    finished2 := true            % The flag
    Music.PlayFileStop          % Music.PlayFile will return immediately

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    if x > 85 and x < 223 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Addition", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 30)
                    randint (b, -10, 30)
                    Font.Draw (intstr (a) + " + " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer

                    Font.Draw (intstr (a) + " + " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a + b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a + b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a + b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Addition End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtraction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 235 and x < 373 and y > 275 and y < 375 then

        loop
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Subtraction", 267, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 9)
                    randint (b, 0, 9)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)
                    if answer = a - b then
                        Font.Draw ("Correct!", 300, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)

                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then             % Normal
                colorback (68)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 30)
                    randint (b, 0, 30)
                    if b > a then
                        temp := b
                        b := a
                        a := temp
                    end if
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for o : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -10, 20)
                    randint (b, -10, 20)
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " - " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a - b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a - b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a - b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtract End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 385 and x < 520 and y > 275 and y < 375 then

        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Multiplication", 250, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 5)
                    randint (b, 0, 5)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " =", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)

                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 0, 10)
                    randint (b, 0, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a) + " * " + intstr (b) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately

        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multiply End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 530 and x < 665 and y > 275 and y < 375 then
        loop
            fork Dgame
            % Horizon Above (Sky)
            drawfillbox (0, 300, 200, 600, 53)
            drawfillbox (200, 300, 500, 600, 53)
            drawfillbox (500, 300, 750, 600, 53)
            drawfillbox (0, 600, 750, 750, 53)

            % Horizon Below (Ground)
            drawfillbox (0, 0, 750, 300, 45)

            % Tree (Left)
            drawfillbox (0, 0, 150, 400, red)

            % Tree (Left) Leaves
            drawfillbox (125, 225, 225, 325, green)
            drawfillbox (115, 305, 250, 500, green)
            drawfillbox (0, 365, 125, 550, green)

            % Tree (Right)
            drawfillbox (600, 0, 750, 375, red)

            % Tree (Right) Leaves
            drawfillbox (625, 375, 750, 550, green)
            drawfillbox (500, 325, 625, 500, green)
            drawfillbox (525, 225, 625, 325, green)

            % Selection Boxes (Level)

            Font.Draw ("Select Your Level", 220, 565, f14, black)
            Font.Draw ("Division", 302, 625, f14, black)

            drawfillbox (305, 380, 440, 480, 43)         % Back
            drawfillbox (315, 390, 430, 470, 44)
            Font.Draw ("Back", 350, 425, f15, black)

            drawfillbox (305, 275, 440, 375, 43)         % Easy
            drawfillbox (315, 285, 430, 365, 44)
            Font.Draw ("Novice", 345, 320, f16, black)

            drawfillbox (305, 170, 440, 270, 43)         % Moderate
            drawfillbox (315, 180, 430, 260, 44)
            Font.Draw ("Moderate", 335, 210, f17, black)

            drawfillbox (305, 65, 440, 165, 43)         % Hard
            drawfillbox (315, 75, 430, 155, 44)
            Font.Draw ("Expert", 345, 100, f18, black)

            buttonwait ("down", x, y, bnum, bud)

            if x > 305 and x < 440 and y > 275 and y < 375 then            % Easy
                colorback (53)
                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 8)
                    randint (b, 1, 8)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 285, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 285, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 300, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 170 and y < 270 then         % Normal
                colorback (68)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, 1, 10)
                    randint (b, 1, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)

                    else
                        Font.Draw ("Sorry, The Correct Answer Is " + intstr (a * b div a), 90, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for

            elsif x > 305 and x < 440 and y > 65 and y < 165 then         % Hard
                colorback (40)

                for i : 1 .. NUM_OF_QUESTIONS
                    cls
                    randint (a, -5, 10)
                    randint (b, -5, 10)
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = ", 90, 565, f14, black)
                    get answer
                    Font.Draw (intstr (a * b) + " / " + intstr (a) + " = " + intstr (answer), 90, 565, f14, black)

                    if answer = a * b div a then
                        Font.Draw ("Correct!", 90, 450, f14, black)
                    else
                        Font.Draw ("Sorry, The Right Answer Is " + intstr (a * b div a), 80, 400, f14, black)
                    end if
                    Font.Draw ("Press The Enter Key To Continue...", 40, 300, f14, black)
                    loop
                        exit when hasch
                    end loop
                    if answer = a * b div a then
                        count := count + 1
                    end if
                    cls
                    colorback (68)
                    Font.Draw ("You Got " + intstr (count) + " Out Of 5", 250, 500, f14, black)
                    delay (300)
                end for
                % Ending the Music
                % Stops the background music.
                finished3 := true     % The flag
                Music.PlayFileStop     % Music.PlayFile will return immediately
            else
                fork BTM
                exit
            end if
            delay (500)
            % Ending the Music
            % Stops the background music.
            finished4 := true     % The flag
            Music.PlayFileStop     % Music.PlayFile will return immediately
        end loop

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Divide End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    elsif x > 310 and x < 445 and y > 165 and y < 265 then
        fork CM
        cls
        delay (500)
        drawfillbox (0, 0, 750, 750, white)
        delay (3000)
        for yy : 0 .. maxy by 100
            Font.Draw ("Magic Math", 200, yy, f9, 43)
            delay (2000)
            cls
        end for
        for yyy : 0 .. maxy by 100
            Font.Draw ("Done By: Jawad Khan", 280, yyy, f10, 43)
            delay (2000)
            cls
        end for
        for yyyy : 0 .. maxy by 100
            Font.Draw ("Infor-Games, In Cooperation With", 200, yyyy, f11, 43)
            delay (2000)
            cls
        end for
        for yyyyy : 0 .. maxy by 100
            Pic.ScreenLoad ("EA2.jpg", 230, yyyyy, picCopy)
            delay (1500)
            cls
        end for
        delay (500)
        Font.Draw ("Magic Math", 200, 500, f9, 43)
        cls
        % Ending the Music
        % Stops the background music.
        finished5 := true        % The flag
        Music.PlayFileStop      % Music.PlayFile will return immediately
        exit
    end if
end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Exit End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%



You'll also need these music files...
[Gandalf]




PostPosted: Fri Jan 06, 2006 12:35 am   Post subject: (No subject)

Sweet, we all love scrolling down pages of code, but for the few that don't next time attach anything nearly as long as that so we can actually see what the post is about.











To make this post stand out Rolling Eyes.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

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


Style:  
Search: