Exemplo n.º 1
0
 public void defineSnapperViews() {
   if (logic.level == null) return;
   SnapperView view;
   int i;
   int j;
   int state;
   synchronized (activeSnappers) {
     for (i = 0; i < activeSnappers.size; i++) removeActor(activeSnappers.get(i));
     snapperViewPool.free(activeSnappers);
     activeSnappers.clear();
     int w = logic.width;
     int h = logic.height;
     for (i = 0; i < Snappers.WIDTH; i++)
       for (j = 0; j < Snappers.HEIGHT; j++)
         if ((state = logic.snappers.getSnapper(i, j)) > 0) {
           view = snapperViewPool.obtain();
           view.set(i, j, state);
           view.setRandomStart(0, 0, w, h, SNAPPER_WARM_TIME);
           activeSnappers.add(view);
           addActor(view);
           view.setListener(snapperAnimationListener);
           view.setAnimFn(snapperAnimFn);
         }
   }
 }
Exemplo n.º 2
0
 @Override
 public void snapperHit(int i, int j) {
   SnapperView view = snappers.find(i, j);
   view.touch();
   /*if (view.state <1){
       snappers.free(view);
       bangs.add(i, j);
   }*/
 }
Exemplo n.º 3
0
 @Override
 public void onAnimationEnd(MovableActor item) {
   float time = (float) Math.random() * 2f + 1f;
   ((SnapperView) item).shiftRandom(time);
 }