@Override public void simpleUpdate(float tpf) { Juggernaut.Update(tpf); // Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f); // walkDirection.set( 0, 0, 0); // if(left) { walkDirection.addLocal(Vector3f.UNIT_X.negate().multLocal(0.4f));} // if(right) { walkDirection.addLocal(Vector3f.UNIT_X.clone().multLocal(0.4f));} // player.setWalkDirection(walkDirection); // if( walkDirection != Vector3f.ZERO){ // player.setViewDirection(walkDirection.negate()); // } // // playerDebug.setLocalTranslation(player.getPhysicsLocation()); elevator1.setLocalTranslation(304 + 20 * FastMath.cos(timer.getTimeInSeconds()), 20, 0); elvtr1.setPhysicsLocation(elevator1.getLocalTranslation()); // elevator2.setLocalTranslation( 192, 208 + 35*FastMath.cos(timer.getTimeInSeconds()), // 0); // elvtr2.setPhysicsLocation(elevator2.getLocalTranslation()); elvtr2.setLinearVelocity(new Vector3f(0, 25 * FastMath.cos(timer.getTimeInSeconds()), 0)); elvtr2.setPhysicsRotation(Matrix3f.IDENTITY); System.out.print(landscape.getCollideWithGroups() + "\n"); for (int i = 0; i < views.length; i++) { if (views[i].testForPlayer(Juggernaut)) { currentView = views[i]; } } cam.setLocation(currentView.CamPosition()); cam.lookAt(currentView.CamLookAt(), Vector3f.UNIT_Y); }
void playerHandeler() { inputListener(); if (player.health <= 0) { player.isDead = true; if (cheated == false) newHighscore = setHighscore(); } player.Update(xOffset, yOffset, delta); double[] pos = checkIfInsideBounds(player); player.body.setFrame(pos[0], pos[1], player.body.getWidth(), player.body.getHeight()); int levelupDif = 10; double val = levelupDif; for (int i = 0; i < difficulty; i++) { val = val + val / levelupDif + levelupDif; } if (player.score > val) { if (difficulty < 19) { difficulty = difficulty + 1; int toUpgrade = 0; int curLev = 100; for (int i = 0; i < player.weapon.length; i++) { if (player.weapon[i][11] != null && (Boolean) player.weapon[i][11] == true && player.unlockedWeapons[i] == true) { if ((Integer) player.weapon[i][10] < curLev) { curLev = (Integer) player.weapon[i][10]; toUpgrade = i; } } } if (curLev < 5 && curLev < difficulty / 2) { player.upgradeWeapon(toUpgrade, 1); player.newMessage( "Level up! The " + player.weapon[toUpgrade][13] + " was uppgraded to level " + (curLev + 1), 2000); } } } }