/** * Create a new Vehicle object. * * @param n the name of the vehicle * @param pos the position of the vehicle * @param type the type of vehicle ("truck" or "car") */ public Vehicle(char n, Point pos, VehicleType type) { // myType = type; switch (type) { case RED_CAR: setLength(2); setType("car"); setOrientation('h'); break; case Horizontal_Car: setLength(2); setType("car"); setOrientation('h'); break; case Vertical_Car: setLength(2); setType("car"); setOrientation('v'); break; case Horizontal_Truck: setLength(3); setType("truck"); setOrientation('h'); break; case Vertical_Truck: setLength(3); setType("truck"); setOrientation('v'); break; } this.setName(n); this.setPosition(pos); thePoints = getPoints(); String imageName = "Images/" + name + orientation + ".gif"; vehicleImage = new ImageIcon(imageName); }