diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java index 9eee358c06866d3461cb828f804d025459c0a049..8caeb4575ca7b30556ace57a423bd60f916625ba 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Ship/ShipView.java @@ -114,6 +114,11 @@ public class ShipView extends AbstractShip { private ShipType shipType; + /** + * the x and y position the ship starts at on the screen + */ + private float baseX, baseY; + /** * Constructor * @param main - the main class for SpriteBatch @@ -147,8 +152,8 @@ public class ShipView extends AbstractShip { roomWidth = shipRoomBackground.getWidth()*1.5f; roomHeight = shipRoomBackground.getHeight()*1.5f; - float roomsBaseX = (70 + width/2); - float roomsBaseY = main.HEIGHT/2; + baseX = (70 + width/2); + baseY = main.HEIGHT/2; List<Crew> crews = new ArrayList<>(); for(Room r : ship.getSystems()) { @@ -157,7 +162,7 @@ public class ShipView extends AbstractShip { crew = new HashMap<>(); float cy = Main.HEIGHT - 150; for(Crew c : crews) { - crew.put(c.getId(), new CrewUI(main, c, stage, this, 30, cy, font15, getRoomX(ship.getShipType(), c.getCurrentRoom().getInteriorID(), roomsBaseX), getRoomY(ship.getShipType(), c.getCurrentRoom().getInteriorID(), roomsBaseY), ship.getShipType())); + crew.put(c.getId(), new CrewUI(main, c, stage, this, 30, cy, font15, getRoomX(ship.getShipType(), c.getCurrentRoom().getInteriorID(), baseX), getRoomY(ship.getShipType(), c.getCurrentRoom().getInteriorID(), baseY), ship.getShipType())); cy -= 60; } @@ -170,20 +175,20 @@ public class ShipView extends AbstractShip { for(Room r : existingRooms) { if(r instanceof System) { if(r instanceof Shield) { - rooms.put(r.getId(), new ShieldUI(main, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), roomsBaseX), getRoomY(ship.getShipType(), r.getInteriorID(), roomsBaseY), (Shield) r, sx)); + rooms.put(r.getId(), new ShieldUI(main, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), baseX), getRoomY(ship.getShipType(), r.getInteriorID(), baseY), (Shield) r, sx)); } else if(! (r instanceof WeaponSystem)) { - rooms.put(r.getId(), new SubsystemUI(main, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), roomsBaseX), getRoomY(ship.getShipType(), r.getInteriorID(), roomsBaseY), (System) r, sx)); + rooms.put(r.getId(), new SubsystemUI(main, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), baseX), getRoomY(ship.getShipType(), r.getInteriorID(), baseY), (System) r, sx)); } sx += 55; } else { - rooms.put(r.getId(), new RoomUI(main, r, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), roomsBaseX), getRoomY(ship.getShipType(), r.getInteriorID(), roomsBaseY))); + rooms.put(r.getId(), new RoomUI(main, r, tileStage, this, getRoomX(ship.getShipType(), r.getInteriorID(), baseX), getRoomY(ship.getShipType(), r.getInteriorID(), baseY))); } } //need to be done extra bc they need the actual weapon, not just the system for(Weapon w : game.loadWeapons()) { - rooms.put(w.getId(), new WeaponUI(main, tileStage, this, getRoomX(ship.getShipType(), w.getWeaponSystem().getInteriorID(), roomsBaseX), getRoomY(ship.getShipType(), w.getWeaponSystem().getInteriorID(), roomsBaseY), w, sx + 55)); + rooms.put(w.getId(), new WeaponUI(main, tileStage, this, getRoomX(ship.getShipType(), w.getWeaponSystem().getInteriorID(), baseX), getRoomY(ship.getShipType(), w.getWeaponSystem().getInteriorID(), baseY), w, sx + 55)); } moveButton = new MoveButton(Main.WIDTH/(2.259f), main.HEIGHT - Main.HEIGHT/(12), Main.WIDTH/(21.8f), Main.HEIGHT/(25.12f), this); @@ -671,10 +676,9 @@ public class ShipView extends AbstractShip { * a crew member is moved to a new room * called by crew ui after player attempts to move a crew * @param crew the crew member - * @param room the new room */ public void crewMoved(Crew crew, Room room) { - this.crew.get(crew.getId()).crewMoved(room); + this.crew.get(crew.getId()).crewMoved(getRoomX(shipType, room.getInteriorID(), baseX), getRoomY(shipType, room.getInteriorID(), baseY)); } /** diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/ShipInformation/CrewUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/ShipInformation/CrewUI.java index ebe767c5ec602b51987592e5fed871c43b1eb6ea..f200bc3320ea9f0543c2bd8e1f706600c7ad7571 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/ShipInformation/CrewUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/ShipInformation/CrewUI.java @@ -165,10 +165,11 @@ public class CrewUI { * the crew member was moved to a new room * called by shipview * - * @param room the new room + * @param roomX the x position of the lower left corner the crew member is in */ - public void crewMoved(Room room) { - + public void crewMoved(float roomX, float roomY) { + this.roomX = roomX; + this.roomY = roomY; } /** diff --git a/database.mv.db b/database.mv.db index 37c26b87e709f49afbec9cd506293e54398fe6a5..79e68c7adec93158c5542d099a25c0e6bb31729c 100644 Binary files a/database.mv.db and b/database.mv.db differ