Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.51 KB | None | 0 0
  1. public void run()
  2.     {
  3.         long beforeTime, timeDiff, sleep;
  4.  
  5.         beforeTime = System.currentTimeMillis();
  6.         array = copy(GMObject.list);
  7.         ArrayList<GMObject> two = copy(array);
  8.         ArrayList<GMObject> deac = new ArrayList<GMObject>();
  9.         Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
  10.  
  11.  
  12.         while (true)
  13.         {
  14.             array = GMObject.list;
  15.             two = copy(array);
  16.  
  17.             if (deactivate)
  18.             {
  19.                 for (GMObject obj: two)
  20.                 {
  21.                     if (Math.abs(obj.x - Player.getX()) < 400)
  22.                         deac.add(obj);
  23.  
  24.                     if (obj instanceof Menu)
  25.                         deac.add(obj);
  26.  
  27.                     if (obj instanceof Player)
  28.                         deac.add(obj);
  29.  
  30.                     if (obj instanceof Player2)
  31.                         deac.add(obj);
  32.                 }
  33.             }
  34.             else
  35.             {
  36.                 deac = two;
  37.             }
  38.  
  39.             for (GMObject x: deac)
  40.             {
  41.                 x.beginStep();
  42.             }
  43.  
  44.             for (GMObject x: deac)
  45.             {
  46.                 x.step();
  47.             }
  48.  
  49.             for (GMObject x: deac)
  50.             {
  51.                 x.updateRec();
  52.             }
  53.  
  54.             for (GMObject x: deac)
  55.             {
  56.                 if (x.bounds!=null && x.solid==true)
  57.                 {
  58.                     for (GMObject y: deac)
  59.                     {
  60.                         if (y.bounds!=null && y.solid==true)
  61.                         {
  62.                             if (x.bounds.intersects(y.bounds) && x!=y)
  63.                             {
  64.                                 x.collision(y);
  65.                             }
  66.                         }
  67.                     }
  68.                 }
  69.             }
  70.  
  71.             for (GMObject x: deac)
  72.             {
  73.                 x.endStep();
  74.             }
  75.             repaint();
  76.  
  77.  
  78.             try
  79.             {
  80.                 Thread.sleep(DELAY);
  81.             }
  82.             catch (InterruptedException e)
  83.             {
  84.                 System.out.println("interrupted");
  85.             }
  86.  
  87.             beforeTime = System.currentTimeMillis();
  88.         }
  89.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement