public void ctick(int dt) {
   int dt2 = dt + initdelay;
   initdelay = 0;
   for (GAttrib a : attr.values()) {
     if (a instanceof Drawable) a.ctick(dt2);
     else a.ctick(dt);
   }
   for (Iterator<Overlay> i = ols.iterator(); i.hasNext(); ) {
     Overlay ol = i.next();
     if (ol.spr == null) {
       if (((getattr(Drawable.class) == null) || (getneg() != null)) && (ol.res.get() != null))
         ol.spr = Sprite.create(this, ol.res.get(), ol.sdt);
     } else {
       boolean done = ol.spr.tick(dt);
       if ((!ol.delign || (ol.spr instanceof Overlay.CDel)) && done) i.remove();
     }
   }
 }
示例#2
0
 public synchronized void setup(Sprite.Drawer drw, final Coord cc, final Coord off) {
   if (base.get() == null) return;
   if (loading) {
     loading = false;
     for (Indir<Resource> r : layers) {
       if (sprites.get(r) == null) {
         if (r.get() == null) loading = true;
         else sprites.put(r, Sprite.create(gob, r.get(), null));
       }
     }
   }
   /* XXX: Fix this to construct parts dynamically depending on
    * which layers exist. */
   Sprite.Part me;
   me = makepart(0);
   me.setup(cc, off);
   drw.addpart(me);
   me = makepart(-10);
   me.setup(cc, off);
   drw.addpart(me);
 }