@Test public void testFlagTick() { initialise(); SaveFlag flag = new SaveFlag(); Player player = new Player(); world.debugReset(); world.addEntity(player); player.setPosition(20, 20); world.addEntity(flag); flag.setPosition(20, 20); flag.tick(1); assertFalse(flag.inRangeFromOutRange); }
@Override protected void tick(long ms) { if (!(this.rider == null)) { playerInput.updateGameInput(); if (flyingMount) { fly(playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getUpPressed(), playerInput.getDownPressed()); } else { moveStateEntity(ms, playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getJumpPressed()); if (playerInput.getDownPressed() && jumpDown && playerInput.getJumpPressed()) { } else if (playerInput.getDownPressed() && jumpDown) { if (1000 * getMeasuredVelY() < -1.5 * jumpSpeed) { velY -= jumpSpeed; } } } PlayerMountActions.positionPlayer(rider); } else { boolean playerNear = false; for (Entity entity : this.getNearbyEntities(this.range)) { if (entity instanceof Player) { playerNear = true; } } if (playerNear) { Toaster.ejectAllToast(); Toaster.toast("Press " + ControlsKeyMap.getStyledKeyCode(GameAction.ACTIVATE_MOUNT) + " to mount"); } } }
Mount extends BasicMovingEntity { @Override protected void tick(long ms) { if (!(this.rider == null)) { playerInput.updateGameInput(); if (flyingMount) { fly(playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getUpPressed(), playerInput.getDownPressed()); } else { moveStateEntity(ms, playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getJumpPressed()); if (playerInput.getDownPressed() && jumpDown && playerInput.getJumpPressed()) { } else if (playerInput.getDownPressed() && jumpDown) { if (1000 * getMeasuredVelY() < -1.5 * jumpSpeed) { velY -= jumpSpeed; } } } PlayerMountActions.positionPlayer(rider); } else { boolean playerNear = false; for (Entity entity : this.getNearbyEntities(this.range)) { if (entity instanceof Player) { playerNear = true; } } if (playerNear) { Toaster.ejectAllToast(); Toaster.toast("Press " + ControlsKeyMap.getStyledKeyCode(GameAction.ACTIVATE_MOUNT) + " to mount"); } } } }
Mount extends BasicMovingEntity { @Override protected void tick(long ms) { if (!(this.rider == null)) { playerInput.updateGameInput(); if (flyingMount) { fly(playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getUpPressed(), playerInput.getDownPressed()); } else { moveStateEntity(ms, playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getJumpPressed()); if (playerInput.getDownPressed() && jumpDown && playerInput.getJumpPressed()) { } else if (playerInput.getDownPressed() && jumpDown) { if (1000 * getMeasuredVelY() < -1.5 * jumpSpeed) { velY -= jumpSpeed; } } } PlayerMountActions.positionPlayer(rider); } else { boolean playerNear = false; for (Entity entity : this.getNearbyEntities(this.range)) { if (entity instanceof Player) { playerNear = true; } } if (playerNear) { Toaster.ejectAllToast(); Toaster.toast("Press " + ControlsKeyMap.getStyledKeyCode(GameAction.ACTIVATE_MOUNT) + " to mount"); } } } Mount(); }
Mount extends BasicMovingEntity { @Override protected void tick(long ms) { if (!(this.rider == null)) { playerInput.updateGameInput(); if (flyingMount) { fly(playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getUpPressed(), playerInput.getDownPressed()); } else { moveStateEntity(ms, playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getJumpPressed()); if (playerInput.getDownPressed() && jumpDown && playerInput.getJumpPressed()) { } else if (playerInput.getDownPressed() && jumpDown) { if (1000 * getMeasuredVelY() < -1.5 * jumpSpeed) { velY -= jumpSpeed; } } } PlayerMountActions.positionPlayer(rider); } else { boolean playerNear = false; for (Entity entity : this.getNearbyEntities(this.range)) { if (entity instanceof Player) { playerNear = true; } } if (playerNear) { Toaster.ejectAllToast(); Toaster.toast("Press " + ControlsKeyMap.getStyledKeyCode(GameAction.ACTIVATE_MOUNT) + " to mount"); } } } Mount(); void registerRider(Player rider); Player getRider(); void removeRider(Player player); void fly(boolean left, boolean right, boolean up, boolean down); float getSaddleX(); float getSaddleY(); }
Mount extends BasicMovingEntity { @Override protected void tick(long ms) { if (!(this.rider == null)) { playerInput.updateGameInput(); if (flyingMount) { fly(playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getUpPressed(), playerInput.getDownPressed()); } else { moveStateEntity(ms, playerInput.getLeftPressed(), playerInput.getRightPressed(), playerInput.getJumpPressed()); if (playerInput.getDownPressed() && jumpDown && playerInput.getJumpPressed()) { } else if (playerInput.getDownPressed() && jumpDown) { if (1000 * getMeasuredVelY() < -1.5 * jumpSpeed) { velY -= jumpSpeed; } } } PlayerMountActions.positionPlayer(rider); } else { boolean playerNear = false; for (Entity entity : this.getNearbyEntities(this.range)) { if (entity instanceof Player) { playerNear = true; } } if (playerNear) { Toaster.ejectAllToast(); Toaster.toast("Press " + ControlsKeyMap.getStyledKeyCode(GameAction.ACTIVATE_MOUNT) + " to mount"); } } } Mount(); void registerRider(Player rider); Player getRider(); void removeRider(Player player); void fly(boolean left, boolean right, boolean up, boolean down); float getSaddleX(); float getSaddleY();  }