Example #1
0
 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();
         }
       }
     }
   }
 }
Example #2
0
 public void getGun(int level) {
   screen.getGun(level);
 }
Example #3
0
 public void transition(int x, int y) {
   screen.transition(x, y);
 }
Example #4
0
 public void readSign(Sign sign) {
   screen.readSign(sign.id - 1);
 }