Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class spaceFrame extends JFrame
- {
- private static final long serialVersionUID = 1L;
- fullScreen screen = new fullScreen();
- Images img = new Images();
- startMenu menu = new startMenu();
- Controller control = new Controller();
- mouseMotionInput mouse = new mouseMotionInput();
- private int shipX = 350;
- private int shipY = 450;
- public spaceFrame()
- {
- DisplayMode dm = new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN);
- run(dm);
- img.loadpics();
- this.addMouseListener(new mouseInput());
- this.addMouseMotionListener(mouse);
- this.addKeyListener(new keyInput());
- }
- public void run(DisplayMode dm)
- {
- setBackground(Color.BLACK);
- setForeground(Color.BLACK);
- setFont(new Font("Arial", Font.PLAIN, 20));
- screen.setFullScreen(dm, this);
- }
- public void paint(Graphics g)
- {
- /*
- if(!menu.isPlayClicked()) // menu
- {
- menu.draw(g);
- repaint();
- return;
- }*/
- g.drawImage(img.getBackground(), 0, 0, null); // background
- g.drawImage(img.getSpaceShip(), mouse.getMouseX()-58, mouse.getMouseY()-38, null); // ship
- control.startingEnemies(g);
- control.draw(g);
- if(shipX < -100)
- shipX = 800;
- if(shipX > 800) // bounds
- shipX = -100;
- if(shipY < -100)
- shipY = 600;
- if(shipY > 600)
- shipY = -100;
- try {
- Thread.sleep(50);
- repaint();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement