diff --git a/Final_haines_v1/Final_haines_v1.pde b/Final_haines_v1/Final_haines_v1.pde index 93d245a..bb2bbfa 100644 --- a/Final_haines_v1/Final_haines_v1.pde +++ b/Final_haines_v1/Final_haines_v1.pde @@ -1,8 +1,25 @@ +import javax.swing.*; + final int BACKGROUND_COLOR = 10; final int WALL_COLOR = 0xCCCCCC; final int PACMAN_SPEED = 2; final int GHOST_SPEED = 1; +JFrame options = new JFrame( "Options" ); +JCheckBox redGhost = new JCheckBox( "Red Ghost" ); +JCheckBox blueGhost = new JCheckBox( "Blue Ghost" ); +JCheckBox greenGhost = new JCheckBox( "Green Ghost" ); +JCheckBox pinkGhost = new JCheckBox( "Pink Ghost" ); + +int redX = 10; +int redY = 10; +int blueX = 10; +int blueY = 30; +int greenX = 10; +int greenY = 50; +int pinkX = 10; +int pinkY = 70; + boolean running = false; boolean paused = false; @@ -22,6 +39,16 @@ void setup() { textSize( 32 ); fill( 255, 0, 0 ); text( "START", 260, 250 ); + + options.getContentPane().setLayout( new BoxLayout( options.getContentPane(), BoxLayout.Y_AXIS ) ); + options.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); + redGhost.setSelected( true ); + options.add( redGhost ); + options.add( blueGhost ); + options.add( greenGhost ); + options.add( pinkGhost ); + options.pack(); + options.setVisible( true ); } void mouseClicked() { @@ -132,8 +159,66 @@ void draw() { // DONE DRAWING PACMAN // DRAW GHOSTS - // to be implemented later + // movement to be implemented later + if( redGhost.isSelected() ) { + fill( 255, 0, 0 ); + drawGhost( redX, redY ); + } + if( blueGhost.isSelected() ) { + fill( 0, 0, 255 ); + drawGhost( blueX, blueY ); + } + if( greenGhost.isSelected() ) { + fill( 0, 255, 0 ); + drawGhost( greenX, greenY ); + } + if( pinkGhost.isSelected() ) { + fill( 230, 76, 194 ); + drawGhost( pinkX, pinkY ); + } if( !checkAlive() ) endGame(); } } + +void drawGhost( int x, int y ) { + translate( x, y ); + beginShape(); + vertex( 8, -6 ); + vertex( 7, -8 ); + vertex( 6, -9 ); + vertex( 4, -10 ); + vertex( -4, -10 ); + vertex( -6, -9 ); + vertex( -7, -8 ); + vertex( -8, -6 ); + vertex( -8, 2 ); + vertex( -9, 4 ); + vertex( -9, 6 ); + vertex( -8, 8 ); + vertex( -8, 6 ); + vertex( -6, 8 ); + vertex( -6, 6 ); + vertex( -4, 8 ); + vertex( -4, 6 ); + vertex( -2, 8 ); + vertex( -2, 6 ); + vertex( 0, 8 ); + vertex( 2, 6 ); + vertex( 2, 8 ); + vertex( 4, 6 ); + vertex( 4, 8 ); + vertex( 6, 6 ); + vertex( 6, 8 ); + vertex( 8, 6 ); + vertex( 8, 8 ); + vertex( 9, 6 ); + vertex( 9, 4 ); + vertex( 8, 2 ); + vertex( 8, -6 ); + endShape(); + fill( BACKGROUND_COLOR ); + ellipse( 3, -4, 2, 2 ); + ellipse( -3, -4, -2, 2 ); + translate( -x, -y ); +}