// IMPLEMENTACION DE LA CLASE RESISTENCIA -IMAGEN- import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CRESIS extends Canvas { Toolkit toolkit = Toolkit.getDefaultToolkit(); Image R_00 = toolkit.getImage("Resistencia_00.jpg"); Image R_90 = toolkit.getImage("Resistencia_90.jpg"); Image Resistencia = R_00; private boolean Orientacion = true; // horizontal = true // vertical = false int PCXi = PosX, PCYi = PosY+DimY/2; // Punto de contacto inicial int PCXf = PosX+DimX, PCYf = PosY+DimY/2; // Punto de contacto final // Constructores //____________________________________________________________________________ public CRESIS(int x, int y) { PosX = x; PosY = y; } public CRESIS() { this(1, 1); } public void Dibuja(Graphics R, AreaGrafica AG) { R.drawImage(Resistencia, PosX, PosY, AG); } void Posicion(int x, int y, Interfaz FRAME) { PosAX = PosX; PosAY = PosY; PosX = x; PosY = y; } void Rota() { Resistencia = (Orientacion ? R_90 : R_00); Orientacion = (Orientacion ? false : true); if (Orientacion) // Horizontal { DimX = DimX00; DimY = DimY00; PCXi = PosX; PCYi = PosY + DimY/2; PCXf = PosX + DimX; PCYf = PosY + DimY/2; } else // Vertical { DimX = DimX90; DimY = DimY90; PCXi = PosX + DimX/2; PCYi = PosY; PCXf = PosX + DimX/2; PCYf = PosY + DimY; } } }