
-----------------------------------
rjm72
Thu Jan 20, 2005 2:10 pm

update on my pinball again
-----------------------------------
Hey another update on my pinball thank you ELCOMANDANTE for letting me use the turing piano music u made. Ill probably still fix more stuff. :D :D

% Ryan Murray  TIK2O
% December 8, 2004
% pinball.t

cls
View.Set ("offscreenonly")


var xchange : int
var ychange : int
var score : int
var kolor : int
var lives : int
var x : int
var y : int
var size : int
var col : int  %stands for color
var speed : int
var kol : int
var kol2 : int
var gameOver : boolean
gameOver := false

col := 42
score := 0
lives := 5
speed := 0
kol := white
kol2 := black
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process paddle
    var chars : array char of boolean
    View.Set ("offscreenonly")
    var x, x2 : int
    x := 320
    x2 := 260
    loop
        Input.KeyDown (chars)  %tells the computer that the user will be entering a character

        drawfillbox (x, 10, x2, 20, kol2)  %draws a black paddle to erase the white one at the end of the code


        if chars (KEY_RIGHT_ARROW) then   %tells the computer that if the user enters the right arrow key to move the paddle to the right
            x := x + 10
            x2 := x2 + 10
        end if
        if chars (KEY_LEFT_ARROW) then %tells the computer that if the user enters the left arrow key to move the paddle to the left
            x := x - 10
            x2 := x2 - 10
        end if
        drawfillbox (x, 10, x2, 20, kol) %draws the paddle

        View.Update
        delay (20)
        if score = 30 then
            kol2 := 11
        end if
        if score = 70 then
            kol2 := 50
        end if
        exit when gameOver %tells teh paddle to exit when count=0
    end loop


end paddle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process ball

    loop
        xchange := speed % sets a  speed for the ball
        exit when xchange not= 0
    end loop
    loop
        ychange := speed
        exit when ychange not= 0
    end loop



    Draw.FillBox (5, 5, maxx - 5, maxy - 5, black)
    colorback (black)
    cls

    kolor := red
    size := 6
    x := maxx div 2
    y := maxy div 2

    Draw.FillOval (x, y, size, size, kolor)
    loop
        drawfillbox (100, 100, 200, 200, col) %draws the shapes
        drawfillbox (90, 90, 190, 190, black)
        drawfillbox (400, 100, 500, 200, col)
        drawfillbox (410, 90, 510, 190, black)

        drawfillbox (100, 300, 200, 210, col)
        drawfillbox (90, 300, 190, 220, black)

        drawfillbox (400, 300, 500, 210, col)
        drawfillbox (410, 300, 500, 220, black)

        delay (11)


        if (x >= maxx - 5 - size - xchange) or (x = maxy - 5 - size - ychange) then        %tells the program that if th ball hits the top then the ball should bounce off
            ychange := -ychange
        end if
        if (y  0 then
            if whatdotcolor (x + xchange + size, y) not= black then %tells the program that if the ball hits a color thats not black  then it should add a point and bounce off
                xchange := -xchange
                score := score + 1
            end if
        else
            if
                    whatdotcolor (x + xchange - size, y) not= black then %tells the program that if the ball hits a color thats not black  then it should add a point and bounce off
                xchange := -xchange
                score := score + 1
            end if

        end if

        if ychange > 0 then
            if whatdotcolor (x, y + ychange + size) not= black then %tells the program that if the ball hits a color thats not black  then it should add a point and bounce off
                ychange := -ychange


                score := score + 1

            end if
        else
            if
                    whatdotcolor (x, y + ychange - size) not= black then    %tells the program that if the ball hits a color thats not black  then it should add a point and bounce off
                ychange := -ychange
                score := score + 1

            end if

        end if
        if lives = 2 then  %tells the computer that if the lives are at 2 then the ball is yellow
            kolor := yellow
        end if
        if lives = 5 then %tells the computer that if the lives are at 5 then the ball is blue
            kolor := blue
        end if
        if lives = 1 then %tells the computer that if the lives are at 1 then the ball is red
            kolor := 12
        end if
        if lives = 0 then %tells the computer that if the lives are at 0 then the ball is black
            kolor := black
        end if
        locate (1, 1)      %%tells the computer to show the score at the top of the screen
        color (green)
        put "Score:", score
        put "Lives:", lives


        Draw.FillOval (x, y, size, size, black) %earases the ball

        x := x + xchange %tells the ball how much to move
        y := y + ychange

        Draw.FillOval (x, y, size, size, kolor) %draws the ball
        View.Update

        if lives = 0 then  %tells the computer that if lives = 0 then the game is over
            cls
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put "                            -------------------"
            put "                                 GameOver      "
            put "                             Your Score is:", score
            put "                            -------------------"
            exit
        end if
        if score = 30 then    %tells the computer that if the score is 30 to go to the next level
            kol := white
            cls
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put "                             -------------------"
            put "                                    Level 2     "
            put "                             -------------------"
            delay (1000)
            cls
            exit
        end if
    end loop
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    loop
        xchange := speed
        exit when xchange not= 0
    end loop
    loop
        ychange := speed
        exit when ychange not= 0
    end loop
    size := 6
    x := maxx div 2
    y := maxy div 2
    Draw.FillBox (5, 5, maxx - 5, maxy - 5, 11)
    colorback (11)
    cls


    Draw.FillOval (x, y, size, size, kolor)
    loop
        drawfilloval (100, 250, 100, 100, 55)
        drawfilloval (150, 250, 100, 100, 11)
        drawfilloval (540, 250, 100, 100, 55)
        drawfilloval (490, 250, 100, 100, 11)
        drawfillbox (250, 200, 375, 300, 53)
        drawfillbox (275, 225, 350, 275, 11)
        drawfillbox (290, 200, 340, 275, 11)
        delay (11)



        if (x >= maxx - 5 - size - xchange) or (x = maxy - 5 - size - ychange) then
            ychange := -ychange
        end if
        if (y  0 then
            if whatdotcolor (x + xchange + size, y) not= 11 then
                xchange := -xchange
                score := score + 1
            end if
        else
            if
                    whatdotcolor (x + xchange - size, y) not= 11 then
                xchange := -xchange
                score := score + 1
            end if

        end if

        if ychange > 0 then
            if whatdotcolor (x, y + ychange + size) not= 11 then
                ychange := -ychange


                score := score + 1

            end if
        else
            if
                    whatdotcolor (x, y + ychange - size) not= 11 then
                ychange := -ychange

                score := score + 1

            end if

        end if
        if lives = 2 then
            kolor := yellow
        end if
        if lives = 5 then
            kolor := blue
        end if
        if lives = 1 then
            kolor := 12
        end if
        if lives = 0 then
            kolor := black
        end if
        locate (1, 1)
        color (green)
        put "Score:", score
        put "Lives:", lives

        Draw.FillOval (x, y, size, size, 11)

        x := x + xchange
        y := y + ychange

        Draw.FillOval (x, y, size, size, kolor)
        View.Update

        if lives = 0 then
            cls
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put "                            -------------------"
            put "                                 GameOver      "
            put "                             Your Score is:", score
            put "                            -------------------"
            exit
        end if
        if score = 70 then
            cls
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put ""
            put "                             -------------------"
            put "                                    Level 3     "
            put "                             -------------------"
            delay (1000)
            cls
            exit
        end if
    end loop
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    loop
        xchange := speed
        exit when xchange not= 0
    end loop
    loop
        ychange := speed
        exit when ychange not= 0
    end loop
    size := 6
    x := maxx div 2
    y := maxy div 2
    Draw.FillBox (5, 5, maxx - 5, maxy - 5, 50)
    colorback (50)
    cls

    Draw.FillOval (x, y, size, size, kolor)

    drawfilloval (320, 240, 50, 50, green)
    drawfilloval (320, 220, 50, 50, 50)
    drawfilloval (200, 240, 50, 50, green)
    drawfilloval (200, 220, 50, 50, 50)
    drawfilloval (440, 240, 50, 50, green)
    drawfilloval (440, 220, 50, 50, 50)
    drawfilloval (380, 150, 50, 50, green)
    drawfilloval (380, 130, 50, 50, 50)
    drawfilloval (260, 150, 50, 50, green)
    drawfilloval (260, 130, 50, 50, 50)

    loop

        delay (11)



        if (x >= maxx - 5 - size - xchange) or (x = maxy - 5 - size - ychange) then
            ychange := -ychange
        end if
        if (y  0 then
            if whatdotcolor (x + xchange + size, y) not= 50 then
                xchange := -xchange
                score := score + 1
            end if
        else
            if
                    whatdotcolor (x + xchange - size, y) not= 50 then
                xchange := -xchange
                score := score + 1
            end if

        end if

        if ychange > 0 then
            if whatdotcolor (x, y + ychange + size) not= 50 then
                ychange := -ychange


                score := score + 1

            end if
        else
            if
                    whatdotcolor (x, y + ychange - size) not= 50 then
                ychange := -ychange

                score := score + 1

            end if

        end if
        if lives = 2 then
            kolor := yellow
        end if
        if lives = 5 then
            kolor := blue
        end if
        if lives = 1 then
            kolor := 12
        end if
        if lives = 0 then
            kolor := black
        end if
        locate (1, 1)
        color (green)
        put "Score:", score
        put "Lives:", lives

        Draw.FillOval (x, y, size, size, 50)

        x := x + xchange
        y := y + ychange

        Draw.FillOval (x, y, size, size, kolor)
        View.Update

        if lives = 0 then
            gameOver := true
            exit
        end if
    end loop
end ball
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process kolo                   %makes the paddle and shapes flash
    loop
        delay (75)
        col := Rand.Int (33, 103)
        exit when gameOver
    end loop
end kolo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process music1
    loop
        %pirates/carribean
        play ("4d,8f,4g,4g,8g,8a,4b-,4b-,4b-,>4c,4c,4d,8e-,8e-,8d,8c,8d,4c,4e-,2c,4g-,2f,2e-,4c,2c,