@@ -24,19 +24,23 @@ public class GamePanel extends JPanel {
2424 */
2525 static {
2626 BufferedImage img = null ;
27+ BufferedImage jumpScare = null ;
2728 BufferedImage background = null ;
2829 try {
2930 img = ImageIO .read (new File ("download.png" ));
31+ jumpScare = ImageIO .read (new File ("jumpscare.png" ));
3032 background = ImageIO .read (new File ("download.jpg" ));
3133 } catch (IOException ioe ) {
3234 System .err .println ("Fatal error: Failed to load images" );
3335 System .exit (1 );
3436 }
3537 backgroundImg = background ;
38+ jumpScareImg = jumpScare ;
3639 heartImg = makeColorTransparent (img , Color .WHITE );
3740 }
3841
3942 static final Image heartImg ;
43+ static final Image jumpScareImg ;
4044 static final Image backgroundImg ;
4145 static final Font font = new Font ("Courier" , Font .BOLD , 30 );
4246
@@ -48,7 +52,7 @@ public void paintComponent(Graphics g) {
4852 g .setColor (Color .WHITE );
4953 g .fillRect (0 , 0 , getWidth (), getHeight ());
5054
51- g .drawImage (backgroundImg , 0 , 0 , getWidth (), getHeight (), null );
55+ g .drawImage (Main . jumpScare ? jumpScareImg : backgroundImg , 0 , 0 , getWidth (), getHeight (), null );
5256
5357 /*
5458 * Draw the greeting in the center of the screen
0 commit comments