
-----------------------------------
ify
Sun Jun 13, 2004 5:17 pm

PONG BABY :includes super advanced A.I.
-----------------------------------
what else can i say its freakin pong

// The "asdf" class.
import java.awt.*;
import javax.swing.*;

public class asdf extends Frame
{

    // declaiations of variables
    int ballX = 300;
    int ballY = 200;
    int xTwenty = 20;
    int yFive = 7;
    int playerY = 200;
    int computerY = 200;
    int playerScore = 0;
    int computerScore = 0;
    int twenty = 20;

    Image offScreenImage;
    Graphics offScreenBuffer;



    MenuItem newOption, exitOption, helpOption, aboutOption;



    public asdf ()
    {
        super ("asdf");  // Set the frame's name
        setResizable (false);
        setSize (600, 400);     // Set the frame's size
        setLocation (360, 25);

        setBackground (Color.black);

        newOption = new MenuItem ("New");
        exitOption = new MenuItem ("Exit");
        helpOption = new MenuItem ("Help");
        aboutOption = new MenuItem ("Info");

        Menu gameMenu = new Menu ("Game");
        Menu gameMenuTwo = new Menu ("Help");

        gameMenu.add (newOption);
        gameMenu.addSeparator ();
        gameMenu.add (exitOption);

        gameMenuTwo.add (helpOption);
        gameMenuTwo.addSeparator ();
        gameMenuTwo.add (aboutOption);

        // Set up the Game Menu


        MenuBar mainMenu = new MenuBar ();
        mainMenu.add (gameMenu);
        mainMenu.add (gameMenuTwo);
        // Set the menu bar for this frame to mainMenu
        setMenuBar (mainMenu);

        show ();                // Show the frame
        // Constructor
    }


    public void newGame ()
    {
        ballX = 300;
        ballY = 200;
        playerScore = 0;
        computerScore = 0;

        repaint ();
    }


    public boolean action (Event evt, Object arg)
    {
        if (evt.target == newOption)
        {

            newGame ();
        }
        else if (evt.target == exitOption)
        {
            hide ();
            System.exit (0);
        }
        else if (evt.target == helpOption)
        {

            JOptionPane.showMessageDialog (null, "PONG its tennis but electronic", "Help window", JOptionPane.INFORMATION_MESSAGE);
        }
        else if (evt.target == aboutOption)
        {

            JOptionPane.showMessageDialog (null, "programed by: Steven Baldwin, Julian Change", "About", JOptionPane.INFORMATION_MESSAGE);

        }
        else
            return false;
        return true;
    }


    // handles imput from the mouse
    public boolean mouseMove (Event event, int x, int y)
    {
        if (y >= 30 || y = ballY)
            computerY = computerY - 30;
        else if (computerY  350)
        {
            yFive = -yFive;

        }

        //this is incase the ball hits a corner and doesnt get stuck in the wall or if the ball hits the pattle



        else if (ballX = 50 && ballY >= playerY & ballY = computerY & ballY 