Example #1
0
 @Override
 public void render(Graphics g) {
   if (size == 0) {
     super.render(g);
   } else {
     g.fill(new Rectangle(x - size / 2, y - size / 2, size, size));
   }
 }
Example #2
0
  @Override
  public void init() {
    super.init();

    offset = new Vector2f(x, y);
    offsetFactor = 1;
    size = 0;
    canBeRemovedForSpeed = false;
    diesAfterTime = false;
  }
Example #3
0
  @Override
  public void logic(int delta) {
    super.logic(delta);

    float tmpX = (level.getCamX() * offsetFactor + offset.x) % (Engine.SCREEN_WIDTH * 1.1f);
    float tmpY = (level.getCamY() * offsetFactor + offset.y) % (Engine.SCREEN_HEIGHT * 1.1f);
    if (tmpX < 0) {
      tmpX += Engine.SCREEN_WIDTH * 1.1f;
    }

    if (tmpY < 0) {
      tmpY += Engine.SCREEN_HEIGHT * 1.1f;
    }

    x = -level.getCamX() + tmpX;
    y = -level.getCamY() + tmpY;
  }
 /** Insert a particle into the grid. */
 public void addParticle(BaseParticle particle) {
   // The particles use world coordinates, which need to be converted to grid coordinates
   // before they can be inserted.
   addObjectHelper(
       particle, worldXToGridX(particle.getPositionX()), worldYToGridY(particle.getPositionY()));
 }