Example #1
0
  private void spawn(int x, int y, boolean LeftButton) {
    if (spawnCooldown < 300) {
      return;
    }

    if (LeftButton) {
      entities.addAll(PhysSimHelper.spawnRandom(x, y, 1));
    } else {
      RigidBody b = PhysSimHelper.spawnDiamond(x, y, 1);
      b.setVelocity(Vector2D.LEFT.mult(50));
      b.setId(++testId);
      testDebug = true;
      entities.add(b);
    }

    spawnCooldown = 0;
  }
Example #2
0
  public void init(GameContainer gc) throws SlickException {
    entities = new ArrayList<RigidBody>();

    PhysSimHelper.createObstacles(entities);

    // Initialize engines
    physEngine = new PhysicsEngine(entities);
    renderEngine = new RenderEngine(entities);

    AudioPlayer.getInstance().setSoundsEnabled(false);
    initFont();
  }
Example #3
0
 private void renderMouseOver() {
   String mouseoverText = "";
   RigidBody b =
       PhysSimHelper.createBox(Mouse.getX() - 1, PhysiKsSim.HEIGHT - Mouse.getY() - 1, 2, 2, 1);
   for (RigidBody body : entities) {
     if (SeparatingAxisTest.getSeparatingAxis(body, b) == null) {
       //				mouseoverText += "Position: " + body.getPosition() + "\n";
       mouseoverText += "[" + body.getId() + "] - " + "Velocity: " + body.getVelocity() + "\n";
     }
   }
   //		font.get().drawString(0, 0, mouseoverText);
 }