changing entire screen after making selection

Hey its me again :stuck_out_tongue: So what I’m trying to do is after i select play on my game it should end up going to a level selection screen. The problem is that when i click play my menu screen stays the same, and my level select background doesn’t show.
Heres the code. probably another stupid mistake :stuck_out_tongue: thx in advance.

Main class

import java.awt.DisplayMode;
import java.awt.Graphics2D;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiUnavailableException;

public class Game{
	public Renderer s;
	public PlayerShip player= new PlayerShip();
	public Menu m = new Menu();
	public static LevelSelect ls = new LevelSelect();
	private int moveSpeed = 5;
	public static boolean playon = true;
	public static boolean exiton = false;
	public static boolean menuactive = true;
	public static boolean levelselactive = false;
	public static boolean waitingForKeyPress = false;
	public static boolean upPressed = false;
	public static boolean downPressed = false;
	public static boolean rightPressed = false;
	public static boolean leftPressed = false;
	public static boolean enterPressed = false;
	public boolean islooping = true;
	private static final DisplayMode modes1[] = {
		new DisplayMode(800,600,32,0),
		new DisplayMode(800,600,24,0),
		new DisplayMode(800,600,16,0),
		new DisplayMode(640,480,32,0),
		new DisplayMode(640,480,24,0),
		new DisplayMode(640,480,16,0),
	};;
	
	public static void main(String argv[]) throws InvalidMidiDataException, IOException, MidiUnavailableException {
		DisplayMode dm = new DisplayMode(800, 600, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
		Game game = new Game();
		game.run(dm);
		
		
	}
	public void run(DisplayMode dm2) throws InvalidMidiDataException, IOException, MidiUnavailableException{
		s = new Renderer();
		DisplayMode dm = s.find1stcompatmode(modes1);
		s.setFullScreen(dm);
		s.getFullScreenWindow().addKeyListener(new KeyInputHandeler());
		s.getFullScreenWindow().requestFocus();
		m.loadmenu();
		menuactive = true;
		long startTime = System.currentTimeMillis();
		long cumTime = startTime;
		while(islooping){
			long timePassed = System.currentTimeMillis() - cumTime;
			cumTime = System.currentTimeMillis();
			Graphics2D g = s.getGraphics();
			if(menuactive){
				m.selection();
				m.a.update(timePassed);
				m.h.update(timePassed);
					if(playon){
						m.p.update(timePassed);
					}
					if(exiton){
						m.e.update(timePassed);
					}
					m.draw(g);
					g.dispose();
					s.update();
			}
			if(levelselactive){
				ls.p.update(timePassed);
				ls.c.update(timePassed);
				ls.m.update(timePassed);
				ls.draw(g);
				g.dispose();
				s.update();
			}
			try{
				Thread.sleep(10);
			}catch(Exception ex){}
			}
			s.restoreScreen();
	}
	/*public void movieLoop(){
		long startTime = System.currentTimeMillis();
		long cumTime = startTime;
		while(cumTime - startTime<2000){
			long timePassed = System.currentTimeMillis() - cumTime;
			cumTime = System.currentTimeMillis();
			player.f.update(timePassed);
			a.update(timePassed);
			Graphics2D g = s.getGraphics();
			draw(g);
			g.dispose();
			s.update();
			try{
				Thread.sleep(10);
			}catch(Exception ex){}
			}
		}*/
	
	}

Menu class

import java.awt.Graphics2D;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.swing.ImageIcon;


public class Menu {
	private Image txt1;
	private Image txt2;
	private Image txt3;
	private Image txt4;
	private Image play;
	private Image playselect;
	private Image playselect1;
	private Image exits, exits1, exit;
	private Image hand, hand2, hand3;
	private Image bg;
	public static int x=310, y=430;
	public Ani a,p,e,h;
	Sequence sequence;
	public Sequencer sequencer;
	
	public void selection() throws InvalidMidiDataException, IOException, MidiUnavailableException{
		if(Game.leftPressed){
			x = 310;
			y = 430;
			Game.playon = true;
			Game.exiton = false;
		}
		if(Game.rightPressed){
			x=410;
			y = 450;
			Game.playon = false;
			Game.exiton = true;
		}
		if(Game.exiton && Game.enterPressed){
			System.exit(1);
		}
		if(Game.playon && Game.enterPressed){
			Game.menuactive = false;
			Game.levelselactive = true;
			Game.ls.loadmap();
			sequencer.stop();
		}
	}
	public void loadmenu() throws InvalidMidiDataException, IOException, MidiUnavailableException{
		sequence = MidiSystem.getSequence(new File("C:\\Users\\Nima\\workspace\\Computer Science Game\\Music_Sound\\fzero.mid"));
		sequencer = MidiSystem.getSequencer();
	    sequencer.open();
	    sequencer.setSequence(sequence);
	    sequencer.start();
	    play = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt.png").getImage();
	    playselect = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt.png").getImage();
	    playselect1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt2.png").getImage();
	    exit = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit1.png").getImage();
	    exits = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit1.png").getImage();
	    exits1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit2.png").getImage();
	    hand = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h1.png").getImage();
	    hand2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h2.png").getImage();
	    hand3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h3.png").getImage();
	    h = new Ani();
	    e = new Ani();
	    p = new Ani();
	    h.addScene(hand, 150);
	    h.addScene(hand2, 150);
	    h.addScene(hand3, 150);
	    e.addScene(exits, 150);
	    e.addScene(exits1, 150);
	    p.addScene(playselect, 160);
	    p.addScene(playselect1, 160);
		bg = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\Untitled-2.jpg").getImage();
		txt1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf.png").getImage();
		txt2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf2.png").getImage();
		txt3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf3.png").getImage();
		txt4 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf4.png").getImage();
		a = new Ani();
		a.addScene(txt1, 80);
		a.addScene(txt2, 80);
		a.addScene(txt3, 80);
		a.addScene(txt4, 80);
		a.addScene(txt3, 80);
		a.addScene(txt2, 80);
		a.addScene(txt1, 80);
	}

	public void draw(Graphics2D g){
		g.drawImage(bg,0,0, null);
		g.drawImage(a.getImage(), 50, 70, null);
		g.drawImage(h.getImage(), x, y, null);
		if(Game.playon){
			g.drawImage(p.getImage(), 300, 408, null);
			g.drawImage(exit, 400, 400, null);
		}
		if(Game.exiton){
			g.drawImage(e.getImage(), 400, 408, null);
			g.drawImage(play, 300, 408, null);	
		}
	}
}

Level Select Class

import java.awt.Graphics2D;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.swing.ImageIcon;

public class LevelSelect {
	private Image comet, comet1, comet2;
	private Image map, map1, map2, map3;
	private Image pl1, pl2,pl3, pl4,pl5,pl6,pl7,pl8,pl9,pl10,pl11,pl12,pl13,pl14;
	public Ani p,m,c;
	private int x =720, y=510;
	public void selection(){
		if(Game.leftPressed){
			x = 60;
			y = 510;
		}
		if(Game.rightPressed){	
		}
	}
	public void loadmap()throws InvalidMidiDataException, IOException, MidiUnavailableException{
		Sequence sequence = MidiSystem.getSequence(new File("C:\\Users\\Nima\\workspace\\Computer Science Game\\Music_Sound\\SF64_Map-KM.mid"));
		Sequencer sequencer = MidiSystem.getSequencer();
	    sequencer.open();
	    sequencer.setSequence(sequence);
	    sequencer.start();
		map = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map.png").getImage();
		map1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map1.png").getImage();
		map2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map2.png").getImage();
		map3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map3.png").getImage();
		pl1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l1.png").getImage();
		pl2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l2.png").getImage();
		pl3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l3.png").getImage();
		pl4 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l4.png").getImage();
		pl5 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l5.png").getImage();
		pl6 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l6.png").getImage();
		pl7 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l7.png").getImage();
		pl8 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l8.png").getImage();
		pl9 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l9.png").getImage();
		pl10 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l10.png").getImage();
		pl11 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l11.png").getImage();
		pl12 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l12.png").getImage();
		pl13 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l13.png").getImage();
		pl14 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l14.png").getImage();
		comet = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet.png").getImage();
		comet1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet2.png").getImage();
		comet2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet3.png").getImage();
		p = new Ani();
		m = new Ani();
		c = new Ani();
		p.addScene(pl1, 100);
		p.addScene(pl2, 100);
		p.addScene(pl3, 100);
		p.addScene(pl4, 100);
		p.addScene(pl5, 100);
		p.addScene(pl6, 100);
		p.addScene(pl7, 100);
		p.addScene(pl8, 100);
		p.addScene(pl9, 100);
		p.addScene(pl10, 100);
		p.addScene(pl11, 100);
		p.addScene(pl12, 100);
		p.addScene(pl13, 100);
		p.addScene(pl14, 100);
		m.addScene(map, 80);
		m.addScene(map1, 80);
		m.addScene(map2, 80);
		m.addScene(map3, 80);
		c.addScene(comet,80);
		c.addScene(comet1, 80);
		c.addScene(comet2, 80);
	}
	public void draw(Graphics2D g){
		g.drawImage(m.getImage(), 0, 0, null);
		g.drawImage(p.getImage(), 60, 440, null);
		g.drawImage(c.getImage(), x, y, null);
	}	
}

I can’t seem to find where you handle key or mouse input. Where is your KeyInputHandler class? (btw, you mispelled Handler ;))

EDIT: Have you thought about adding an “update(long)” method in LevelSelect and Menu? You could update your Animations from there instead of the game loop.

Oh lol woops. didnt even notice that :stuck_out_tongue: The update method sounds like a good idea, but it wouldn’t neccesarily change anything right? I think ill fix that up once i get the basic game working.

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KeyInputHandeler extends KeyAdapter {
	public void keyPressed(KeyEvent e) {
		// if we're waiting for an "any key" typed then we don't 
		// want to do anything with just a "press"
		if (Game.waitingForKeyPress) {
			return;
		}
		if (e.getKeyCode() == KeyEvent.VK_UP) {
			Game.upPressed = true;
		}
		if (e.getKeyCode() == KeyEvent.VK_DOWN) {
			Game.downPressed = true;
		}
		if (e.getKeyCode() == KeyEvent.VK_LEFT) {
			Game.leftPressed = true;
		}
		if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
			Game.rightPressed = true;
		}
		if(e.getKeyCode() == KeyEvent.VK_ENTER){
			Game.enterPressed = true;
		}
	} 
	
	/**
	 * Notification from AWT that a key has been released.
	 *
	 * @param e The details of the key that was released 
	 */
	public void keyReleased(KeyEvent e) {
		// if we're waiting for an "any key" typed then we don't 
		// want to do anything with just a "released"
		if (Game.waitingForKeyPress) {
			return;
		}
		if (e.getKeyCode() == KeyEvent.VK_UP) {
			Game.upPressed = false;
		}
		if (e.getKeyCode() == KeyEvent.VK_DOWN) {
			Game.downPressed = false;
		}
		if (e.getKeyCode() == KeyEvent.VK_LEFT) {
			Game.leftPressed = false;
		}
		if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
			Game.rightPressed = false;
		}
		if(e.getKeyCode() == KeyEvent.VK_ENTER){
			Game.enterPressed = false;
		}
	}

	@Override
		public void keyTyped(KeyEvent e) {
			// if we hit escape, then quit the game

			if (e.getKeyChar() == 27) {
				System.exit(0);
			}
	}

	public void addKeyListner(KeyInputHandeler keyInputHandeler) {
		// TODO Auto-generated method stub
		
	}
	}

I looked over your code and everything looks like it should work fine. I don’t notice any obvious errors or bugs. Try going through your code line by line using a debugger. Be careful of every variable and pay attention to what each line does.

bad image again :stuck_out_tongue: but now i have a new problem haha. so ummm after I load the level selector I setup some stuff to move the pointer around, but when i try it in the game the position isn’t updated.

Here’s the updated classes

Level Selector

import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.swing.ImageIcon;

public class LevelSelect {
	Font font;
	private Image comet, comet1, comet2;
	private Image map, map1, map2, map3;
	private Image pl1, pl2,pl3, pl4,pl5,pl6,pl7,pl8,pl9,pl10,pl11,pl12,pl13,pl14;
	private Image h1,h2,h3;
	public Ani p,m,c,hand;
	public static int x =113, y=370;
	
	public void selection() throws InvalidMidiDataException, IOException, MidiUnavailableException, FontFormatException{
		if(Game.leftPressed){
			if(x==225 && y == 370){
				x=225;
				y=370;
			}
		if(Game.rightPressed){
			if(x==113 && y == 370){
				x=225;
				y=370;
			}
		}
		}
	}
	public void loadmap()throws InvalidMidiDataException, IOException, MidiUnavailableException, FontFormatException{
		Sequence sequence = MidiSystem.getSequence(new File("C:\\Users\\Nima\\workspace\\Computer Science Game\\Music_Sound\\SF64_Map-KM.mid"));
		Sequencer sequencer = MidiSystem.getSequencer();
	    sequencer.open();
	    sequencer.setSequence(sequence);
	    sequencer.start();
	    map = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map.png").getImage();
		map1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map1.png").getImage();
		map2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map2.png").getImage();
		map3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\map3.png").getImage();
		pl1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l1.png").getImage();
		pl2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l2.png").getImage();
		pl3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l3.png").getImage();
		pl4 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l4.png").getImage();
		pl5 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l5.png").getImage();
		pl6 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l6.png").getImage();
		pl7 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l7.png").getImage();
		pl8 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l8.png").getImage();
		pl9 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l9.png").getImage();
		pl10 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l10.png").getImage();
		pl11 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l11.png").getImage();
		pl12 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l12.png").getImage();
		pl13 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l13.png").getImage();
		pl14 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\l14.png").getImage();
		comet = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet.png").getImage();
		comet1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet2.png").getImage();
		comet2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\comet3.png").getImage();
		h1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\h1.png").getImage();
	    h2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\h2.png").getImage();
	    h3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Level Select\\h3.png").getImage();
	    hand = new Ani();
		p = new Ani();
		m = new Ani();
		c = new Ani();
		hand.addScene(h1, 150);
	    hand.addScene(h2, 150);
	    hand.addScene(h3, 150);
		p.addScene(pl1, 100);
		p.addScene(pl2, 100);
		p.addScene(pl3, 100);
		p.addScene(pl4, 100);
		p.addScene(pl5, 100);
		p.addScene(pl6, 100);
		p.addScene(pl7, 100);
		p.addScene(pl8, 100);
		p.addScene(pl9, 100);
		p.addScene(pl10, 100);
		p.addScene(pl11, 100);
		p.addScene(pl12, 100);
		p.addScene(pl13, 100);
		p.addScene(pl14, 100);
		m.addScene(map, 80);
		m.addScene(map1, 80);
		m.addScene(map2, 80);
		m.addScene(map3, 80);
		c.addScene(comet,80);
		c.addScene(comet1, 80);
		c.addScene(comet2, 80);
	}
	public void draw(Graphics2D g){
		g.drawImage(m.getImage(), 0, 0, null);
		g.drawImage(p.getImage(), 85, 420, null);
		g.drawImage(hand.getImage(), x, y, null);
	}	
}

Main

import java.awt.FontFormatException;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.swing.ImageIcon;


public class Menu {
	private Image txt1;
	private Image txt2;
	private Image txt3;
	private Image txt4;
	private Image play;
	private Image playselect;
	private Image playselect1;
	private Image exits, exits1, exit;
	private Image hand, hand2, hand3;
	private Image bg;
	public static int x=310, y=430;
	public Ani a,p,e;
	public Ani h;
	Sequence sequence;
	public Sequencer sequencer;
	
	public void selection() throws InvalidMidiDataException, IOException, MidiUnavailableException, FontFormatException{
		if(Game.leftPressed){
			x = 310;
			y = 430;
			Game.playon = true;
			Game.exiton = false;
		}
		if(Game.rightPressed){
			x=410;
			y = 450;
			Game.playon = false;
			Game.exiton = true;
		}
		if(Game.exiton && Game.enterPressed){
			System.exit(1);
		}
		if(Game.playon && Game.enterPressed){
			Game.ls.loadmap();
			sequencer.stop();
			Game.levelselactive = true;
			Game.menuactive = false;
		}
	}
	public void loadmenu() throws InvalidMidiDataException, IOException, MidiUnavailableException{
		sequence = MidiSystem.getSequence(new File("C:\\Users\\Nima\\workspace\\Computer Science Game\\Music_Sound\\fzero.mid"));
		sequencer = MidiSystem.getSequencer();
	    sequencer.open();
	    sequencer.setSequence(sequence);
	    sequencer.start();
	    play = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt.png").getImage();
	    playselect = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt.png").getImage();
	    playselect1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\playbutt2.png").getImage();
	    exit = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit1.png").getImage();
	    exits = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit1.png").getImage();
	    exits1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\exit2.png").getImage();
	    hand = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h1.png").getImage();
	    hand2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h2.png").getImage();
	    hand3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\h3.png").getImage();
	    h = new Ani();
	    e = new Ani();
	    p = new Ani();
	    h.addScene(hand, 150);
	    h.addScene(hand2, 150);
	    h.addScene(hand3, 150);
	    e.addScene(exits, 150);
	    e.addScene(exits1, 150);
	    p.addScene(playselect, 160);
	    p.addScene(playselect1, 160);
		bg = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\Untitled-2.jpg").getImage();
		txt1 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf.png").getImage();
		txt2 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf2.png").getImage();
		txt3 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf3.png").getImage();
		txt4 = new ImageIcon("C:\\Users\\Nima\\workspace\\Computer Science Game\\Sprites\\Menu\\uf4.png").getImage();
		a = new Ani();
		a.addScene(txt1, 80);
		a.addScene(txt2, 80);
		a.addScene(txt3, 80);
		a.addScene(txt4, 80);
		a.addScene(txt3, 80);
		a.addScene(txt2, 80);
		a.addScene(txt1, 80);
	}

	public void draw(Graphics2D g){
		g.drawImage(bg,0,0, null);
		g.drawImage(a.getImage(), 50, 70, null);
		g.drawImage(h.getImage(), x, y, null);
		if(Game.playon){
			g.drawImage(p.getImage(), 300, 408, null);
			g.drawImage(exit, 400, 400, null);
		}
		if(Game.exiton){
			g.drawImage(e.getImage(), 400, 408, null);
			g.drawImage(play, 300, 408, null);	
		}
	}
}

sry for constantly asking questions :frowning:


if(Game.leftPressed){
            if(x==225 && y == 370){
                x=225;
                y=370;
            }
        if(Game.rightPressed){
            if(x==113 && y == 370){
                x=225;
                y=370;
            }
        }
        }

No duh the positions aren’t changing, the X and Y values are the same! :stuck_out_tongue:
Plus you forgot another bracket after the first “if(Game.leftPressed)” so “if(Game.rightPressed)” is inside the first if :stuck_out_tongue:

OH LAWL…i knew something was wrong with my IF statements. I was inthe proccess of chaning the x & y values tho. sigh i need to look more closely at these things. ok another question. When i call loadmap() I would like to unload everything from when I called loadmenu() so do i just set everything to null?

Setting the images to null should cause the Garbage Collector to reclaim them sooner or later so yes.