Ejemplo n.º 1
0
 private void removeOutsideObjects(OPGameFrame f, ArrayList<OPObject> objects) {
   ArrayList<OPObject> removeObjects = new ArrayList<OPObject>();
   for (OPObject o : objects) {
     if (o.positionX < -o.width / 2
         || o.positionX > f.getWidth() + o.width
         || o.positionY < -o.height / 2
         || o.positionY > f.getHeight() + o.height) {
       removeObjects.add(o);
       if (o.getClass().equals(OPEnemy.class)) {
         stackEnemiesUrls.add(((OPEnemy) o).url);
       }
     }
   }
   for (OPObject o : removeObjects) {
     objects.remove(o);
   }
 }
Ejemplo n.º 2
0
 public void setBullets(OPGameFrame f, OPGraphicPanel p, Point point) {
   for (char c : stackTweets.get(rightMouseCount).toCharArray()) {
     OPObject ch =
         this.myselfFactory.createCharacter(
             f.getWidth() - myself.getWidth(),
             f.getHeight() / 2,
             (int) (point.getX() - f.getWidth() + myself.getWidth()),
             (int) (point.getY() - f.getHeight() / 2),
             String.valueOf(c));
     stackCharacters.add(ch);
   }
   rightMouseCount++;
   if (rightMouseCount >= stackTweets.size()) {
     rightMouseCount = 0;
   }
   isBullet = true;
 }