
-----------------------------------
Super
Sat Jan 17, 2004 11:26 pm

TURING BASEBALL PROGRAM HELP
-----------------------------------
I have made a baseball game where the user can choose to play again or exit after playing one game. But if they choose to play again, it goes to the outcome of their last game. HELP PLEASE!

%Results of Game
procedure strikeoutresult
    title
    color (12)
    put "NADIM STRUCK HIM OUT!"
    GUI.Show (draw9)
    GUI.Enable (draw9)

end strikeoutresult

procedure walkresult
    title
    put "BOO"
    color (12)

    GUI.Show (draw9)
    GUI.Enable (draw9)
end walkresult

procedure hitBatter
    title
    color (12)
    put "hit batter"
    GUI.Show (draw9)
    GUI.Enable (draw9)
end hitBatter

%Game using fastball

procedure fastballScreen
    title
    picture13
    x11 := 300
    x21 := 392
    y11 := 200
    y21 := 275
    % drawbox (x11, y11, x21, y21, 12)
    % drawbox (330, 230, 350, 255, 14)
    % drawbox (300, 255, 365, 275, 12)
    % drawbox (300, 230, 330, 255, 9)
    % drawbox (300, 200, 375, 230, 12)
    % drawbox (350, 230, 370, 255, 14)
    % drawbox (365, 255, 375, 268, 9)
    % drawbox (375, 200, 392, 213, 12)
    % %----
    % drawbox (375, 213, 392, 275, 12)
    % drawbox (365, 268, 375, 275, 9)
    % drawbox (370, 230, 375, 255, 100)
    %-----

    color (12)
    colorback (7)
    locate (4, 67)
    put "Strikes"
    locate (7, 68)
    put "Balls"
    locate (10, 66)
    put "Pitch Speed"
    
loop
setscreen("offscreenonly")


var strikes : int := 0
var balls : int := 0
var randomspeed : int
 var draw9 : int := 0
    loop

        mousewhere (xmouse1, ymouse1, button1)

        if (xmouse1 >= 330 and xmouse1 = 230 and ymouse1  94 then
                locate (20, 20)
                color (12)
                put "You're really bringing the heat tonight!"
                delay (1500)
                color (7)
                locate (20, 20)
                put "You're really bringing the heat tonight!"
            elsif randomspeed < 80 then
                locate (20, 20)
                color (12)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
                delay (1500)
                locate (20, 20)
                color (7)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
            end if
            picture14
            delay (1000)

            picture13

        elsif xmouse1 >= 300 and xmouse1 = 255 and ymouse1 = 300 and xmouse1 = 230 and ymouse1 = 300 and xmouse1 = 200 and ymouse1 = 350 and xmouse1 = 230 and ymouse1  94 then
                locate (20, 20)
                color (12)
                put "You're throwing some fireballs tonight!"
                delay (1500)
                color (7)
                locate (20, 20)
                put "You're throwing some fireballs tonight!"
            elsif randomspeed < 80 then
                locate (20, 20)
                color (12)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
                delay (1500)
                locate (20, 20)
                color (7)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
            end if
            picture18
            delay (1000)
            picture13

        elsif xmouse1 >= 365 and xmouse1 = 255 and ymouse1 = 375 and xmouse1 = 200 and ymouse1  94 then
                locate (20, 20)
                color (12)
                put "That 2-seamer was blazing!"
                delay (1500)
                color (7)
                locate (20, 20)
                put "That 2-seamer was blazing!"
            elsif randomspeed < 80 then
                locate (20, 20)
                color (12)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
                delay (1500)
                locate (20, 20)
                color (7)
                put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
            end if
            picture18
            delay (1000)
            picture13

        else
            if xmouse1 >= 375 and xmouse1 = 213 and ymouse1 = 365 and xmouse1 = 230 and ymouse1 = 370 and xmouse1 = 230 and ymouse1 >= 255 and button1 = 1 then
                for x : 1 .. 70
                    picture13
                    drawfilloval (310 + x, 260, 3, 3, 31)
                    delay (1)
                    drawfilloval (310 + x, 260, 2, 2, 42)

                    color (12)
                    colorback (7)

                end for

                randomize
                randint (randomspeed, 75, 100)
                locate (11, 70)
                color (12)
                put randomspeed
                delay (1500)
                color (7)
                locate (11, 70)
                put randomspeed

                locate (20, 20)
                color (12)
                put "YOU HIT THE BATTER! GAME OVER!"
                delay (2000)
                color (7)
                locate (20, 20)
                put "YOU HIT THE BATTER! GAME OVER!"

                picture19
                delay (1000)
                picture13
                exit
            end if
        end if

           exit when strikes =3 or balls=4  

    end loop
 :arrow: if strikes = 3 then
                strikeoutresult
end if
            if

                    balls = 4 then
                walkresult
                end if
                
if xmouse1 >= 375 and xmouse1 = 213 and ymouse1 = 365 and xmouse1 = 230 and ymouse1 = 370 and xmouse1 = 230 and ymouse1 >= 255 and button1 = 1 then
                    hitBatter

                end if

     end loop
     

        end fastballScreen
