public void tick() { tick++; if (player.removed) { respawnTime++; if (respawnTime == 20) { screen.mayRespawn = true; } } for (int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); int xSlotOld = e.xSlot; int ySlotOld = e.ySlot; if (!e.removed) e.tick(); e.xSlot = (int) ((e.x + e.w / 2.0) / 10); e.ySlot = (int) ((e.y + e.h / 2.0) / 10); if (e.removed) { if (xSlotOld >= 0 && ySlotOld >= 0 && xSlotOld < width && ySlotOld < height) { entityMap[xSlotOld + ySlotOld * width].remove(e); } entities.remove(i--); } else { if (e.xSlot != xSlotOld || e.ySlot != ySlotOld) { if (xSlotOld >= 0 && ySlotOld >= 0 && xSlotOld < width && ySlotOld < height) { entityMap[xSlotOld + ySlotOld * width].remove(e); } if (e.xSlot >= 0 && e.ySlot >= 0 && e.xSlot < width && e.ySlot < height) { entityMap[e.xSlot + e.ySlot * width].add(e); } else { e.outOfBounds(); } } } } }
public void getGun(int level) { screen.getGun(level); }
public void transition(int x, int y) { screen.transition(x, y); }
public void readSign(Sign sign) { screen.readSign(sign.id - 1); }