Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void run()
- {
- long beforeTime, timeDiff, sleep;
- beforeTime = System.currentTimeMillis();
- array = copy(GMObject.list);
- ArrayList<GMObject> two = copy(array);
- ArrayList<GMObject> deac = new ArrayList<GMObject>();
- Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
- while (true)
- {
- array = GMObject.list;
- two = copy(array);
- if (deactivate)
- {
- for (GMObject obj: two)
- {
- if (Math.abs(obj.x - Player.getX()) < 400)
- deac.add(obj);
- if (obj instanceof Menu)
- deac.add(obj);
- if (obj instanceof Player)
- deac.add(obj);
- if (obj instanceof Player2)
- deac.add(obj);
- }
- }
- else
- {
- deac = two;
- }
- for (GMObject x: deac)
- {
- x.beginStep();
- }
- for (GMObject x: deac)
- {
- x.step();
- }
- for (GMObject x: deac)
- {
- x.updateRec();
- }
- for (GMObject x: deac)
- {
- if (x.bounds!=null && x.solid==true)
- {
- for (GMObject y: deac)
- {
- if (y.bounds!=null && y.solid==true)
- {
- if (x.bounds.intersects(y.bounds) && x!=y)
- {
- x.collision(y);
- }
- }
- }
- }
- }
- for (GMObject x: deac)
- {
- x.endStep();
- }
- repaint();
- try
- {
- Thread.sleep(DELAY);
- }
- catch (InterruptedException e)
- {
- System.out.println("interrupted");
- }
- beforeTime = System.currentTimeMillis();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement