package com.spacefive;
import java.awt.;
import java.awt.event.;
import java.util.Timer;
import javax.swing.*;
public class Fase extends JPanel implements ActionListener {
private Image fundo;
private Player player;
private Timer troll;
public Fase() {
setFocusable(true);
setDoubleBuffered(true);
ImageIcon referencia = new ImageIcon("res\\imagem espaço.png");
fundo = referencia.getImage();
player = new Player();
player.load();
addKeyListener(new TecladoAdapter());
troll = new Timer(5, this); // Aqui o compilador indica erro
troll.start(); // Aqui indica outro erro
}
public void paint(Graphics g) {
Graphics2D graficos = (Graphics2D) g;
graficos.drawImage(fundo, 0, 0, null);
graficos.drawImage(player.getImagem(), player.getX(), player.getY(), this);
g.dispose(); }
@Override
public void actionPerformed(ActionEvent arg0) {
player.update();
repaint(); }
private class TecladoAdapter extends KeyAdapter {
@Override
public void keyPressed(KeyEvent e) {
player.keyPressed(e); }
@Override
public void keyReleased(KeyEvent e) {
player.keyRelease(e); }
} //Aqui o compilador indica erro