//
// PLAYER 1
//
int shots = input1.checkEvent(InputAction.SHOOT);
if (shots > 0) {
WorldObject bullet = new Planet(2,50, TypeE.WEAPON_SHOT_MINE);
Vector2d dir = new Vector2d(Math.cos(player1.getWorldObject().getRotation()), Math.sin(player1.getWorldObject().getRotation()));
Vector2d pos = player1.getWorldObject().getPosition();
pos.addScaled(16, dir);
bullet.setPosition(pos);
dir.scale(1000000);
//bullet.setVelocity(dir);
world.addObject(bullet, true);
bullet.applyImpulse(dir);
//dir.scale(-1);
//playerShip.applyImpulse(dir);
}
//
// PLAYER 2
//
shots = input2.checkEvent(InputAction.SHOOT);
if (shots > 0) {
WorldObject bullet = new Planet(2,50, TypeE.WEAPON_SHOT_MINE);
Vector2d dir = new Vector2d(Math.cos(player2.getWorldObject().getRotation()), Math.sin(player2.getWorldObject().getRotation()));
Vector2d pos = player2.getWorldObject().getPosition();
pos.addScaled(16, dir);
bullet.setPosition(pos);
dir.scale(1000000);
//bullet.setVelocity(dir);
world.addObject(bullet, true);
bullet.applyImpulse(dir);
}
// Advance the game time by one tick
engine.tick(1.0 / tickRate);
nextTick += NANOS_PER_SEC / tickRate;