public void update() { current_Player.move(); // #if (tar) // @ // bewegt den Rocket nach Q-Pressed // @ if (current_Player.isRocket()){ // @ sch.move(current_Player.getDegree()); // @ } // #endif }
/** * Request that the ship move itself based on an elapsed ammount of time * * @param delta The time that has elapsed since last move (ms) */ public void move(long delta) { // if we're moving left and have reached the left hand side // of the screen, don't move if ((dx < 0) && (x < 10)) { return; } // if we're moving right and have reached the right hand side // of the screen, don't move if ((dx > 0) && (x > 750)) { return; } super.move(delta); }
@Override public void move(long delta) { lastX = x; lastY = y; super.move(delta); }
public void render() { this.map.update(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); this.mapInputListener.update(); while (Client.getCurrentState() == this) { TopPacket packet = Network.getInstance().pollPacket(); if (packet == null) break; if (packet.getType() == TopPacket.CHARACTER) { if (((CharacterPacket) packet).getType2() == CharacterPacket.Add) { Character entity = new Character(this, (CharacterPacket) packet); this.map.addEntity(entity); } else if (((CharacterPacket) packet).getType2() == CharacterPacket.Del) { Entity entity = getEntityByEntityId(((CharacterPacket) packet).getEntityId()); this.map.removeEntity(entity); } } else if (packet.getType() == TopPacket.MONSTER) { if (((MonsterPacket) packet).getType2() == MonsterPacket.Add) { Monster monster = new Monster(this, (MonsterPacket) packet); this.map.addEntity(monster); } else if (((MonsterPacket) packet).getType2() == MonsterPacket.Del) { Entity entity = getEntityByEntityId(((MonsterPacket) packet).getEntityId()); this.map.removeEntity(entity); } } else if (packet.getType() == TopPacket.MOVE) { Entity target = getEntityByEntityId(((MovePacket) packet).getEntityId()); if (target == null) break; int src_x = ((MovePacket) packet).getSx(); int src_y = ((MovePacket) packet).getSy(); int dest_x = ((MovePacket) packet).getDx(); int dest_y = ((MovePacket) packet).getDy(); target.move(src_x, src_y, dest_x, dest_y); } else if (packet.getType() == TopPacket.UPDATE) { Entity target = getEntityByEntityId(((UpdatePacket) packet).getEntityId()); if (target == null) break; target.update((UpdatePacket) packet); } else if (packet.getType() == TopPacket.CHAT) { chattingDialog.append((ChatPacket) packet); } else if (packet.getType() == TopPacket.PARTY) { PartyPacket p = (PartyPacket) packet; if (p.getType2() == PartyPacket.info) { centerCharacterParty = new Party(); int[] entityIds = p.getPartyMemberEntityIds(); for (int i = 0; i < p.getPartyNumber(); i++) { Character c = (Character) getEntityByEntityId(entityIds[i]); centerCharacterParty.addMember(c); } } else if (p.getType2() == PartyPacket.withdraw) { centerCharacterParty = null; } else if (p.getType2() == PartyPacket.add) { centerCharacterParty.addMember((Character) getEntityByEntityId(p.getTargetEntityId())); } else if (p.getType2() == PartyPacket.del) { centerCharacterParty.removeMember(p.getTargetEntityId()); } else if (p.getType2() == PartyPacket.invite) { stage.addActor(new ServerMsgDialog("", skin, p)); } } else if (packet.getType() == TopPacket.MESSAGE) { MessagePacket p = (MessagePacket) packet; MessageDialog m = getMessageDialogByTarget(p.getName()); if (m == null) { m = new MessageDialog("", skin, p.getName()); messages.add(m); stage.addActor(m); } m.append(p); } else if (packet.getType() == TopPacket.SERVER) { SystemMessage.getInstance() .show(((ServerMsg) packet).getMsg(), 2000, 1.0f, 1.0f, 1.0f, 1.0f); } } }