Ejemplo n.º 1
0
  @Override
  public void render() {
    // Update
    getInput();

    b2dWorld.step(1f / 60f, 6, 2);

    camera.update();
    cameraBak.update();
    manager.update();
    background.update();

    // Draw
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);

    // Background
    batch.setProjectionMatrix(cameraBak.combined);
    batch.begin();
    background.draw(batch);
    batch.end();

    batch.setProjectionMatrix(camera.combined);
    debugMatrix = batch.getProjectionMatrix().cpy().scale(PPM, PPM, 0);
    // debugRenderer.render(b2dWorld, debugMatrix);
    batch.begin();
    manager.draw(batch);
    batch.end();

    // GUI
    batch.setProjectionMatrix(cameraBak.combined);
    batch.begin();
    drawGUI(batch);
    batch.end();
  }
Ejemplo n.º 2
0
 @Override
 public boolean touchDown(int x, int y, int arg2, int arg3) {
   camera.unproject(mousePos.set(x, y, 0));
   if (backButton.contains(mousePos.x, mousePos.y)) {
     goBack();
   }
   ObjectMap.Entries<String, Rectangle> entries = bindingButtons.entries();
   boolean focusedAnOption = false;
   while (entries.hasNext()) {
     ObjectMap.Entry<String, Rectangle> entry = entries.next();
     Rectangle bounds = entry.value;
     camera.unproject(mousePos.set(x, y, 0));
     if (bounds.contains(mousePos.x, mousePos.y)) {
       this.focused = true;
       focusedAnOption = true;
       this.focusedBox.setY(bounds.y);
       this.focusedBox.setX(bounds.x);
       BitmapFont.TextBounds b = font.getBounds(entry.key);
       this.focusedBox.setHeight(b.height);
       this.focusedBox.setWidth(b.width);
       this.focusedAction = entry.key;
     }
   }
   if (!focusedAnOption) {
     this.focused = false;
   }
   return false;
 }
Ejemplo n.º 3
0
  public GameScreen(final IkeGame game) {
    this.game = game;

    // Creates the world manager with the specified map
    worldManager = new WorldManager("test_map.tmx");
    // Creates the player at the specified coordinates
    worldManager.createPlayer(1.5f, 5.5f);
    // Sets this class's ike body instance to the world manager's for convenience
    ikeBody = worldManager.player;
    // Gets the ike instance from ike's body
    ike = (Ike) ikeBody.getUserData();

    // Creates the camera
    camera = new OrthographicCamera();
    // Makes the camera render 32 tiles wide and 18 tiles high
    camera.setToOrtho(false, 32, 18);
    // Updates the camera
    camera.update();

    // Creates the shape renderer
    shapeRenderer = new ShapeRenderer();

    // Sets the input listener
    Gdx.input.setInputProcessor(new ControlListener());
  }
Ejemplo n.º 4
0
 public DemoCamera() {
   overviewCamera = new OrthographicCamera();
   closeupCamera = new OrthographicCamera();
   closeupCamera.setToOrtho(
       false, Gdx.graphics.getWidth() * INITIAL_ZOOM, Gdx.graphics.getHeight() * INITIAL_ZOOM);
   overviewCamera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
 }
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub

    if (Gdx.input.justTouched()) {
      guiCam.unproject(touch.set(Gdx.input.getX(), Gdx.input.getY(), 0));
      if (startbutton.contains(touch)) {
        maingame.setScreen(maingame.mainscene);
        return;
      }
    }

    GL10 gl = Gdx.graphics.getGL10();
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    /*
     * Actualiza los parametros de la camara
     * y los enlaza al objeto de renderizado batcher
     * */
    guiCam.update();
    this.batcher.setProjectionMatrix(this.guiCam.combined);
    /*
     * Desactiva las trasnparencias
     * */
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.background, 0, 0, 10, 15);
    batcher.end();
    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.title, 1, 6, 8, 8);
    batcher.draw(Assets.start, x, 3, 6, 3);
    x += c;
    batcher.end();
  }
Ejemplo n.º 6
0
  @Override
  public void draw(Player p) {
    cam.setToOrtho(true, HawkthorneGame.WIDTH, HawkthorneGame.HEIGHT);
    cam.zoom = 1f;
    cam.update(true);
    batch.setProjectionMatrix(cam.combined);
    batch.begin();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    batch.draw(
        this.background,
        cam.viewportWidth / 2 - this.background.getRegionWidth() / 2,
        cam.viewportHeight / 2 - this.background.getRegionHeight() / 2);

    batch.setColor(0, 0, 0, 1);
    BitmapFont font = Assets.getFont();
    font.setScale(0.8f, -0.8f);
    font.draw(batch, "SERVER", 278, 151);
    font.draw(batch, "CLIENT", 278, 181);
    batch.setColor(1, 1, 1, 1);
    batch.draw(this.arrow, 236, 139 + 30 * this.option);
    String back = Keys.toString(KeyMapping.gameKeyToInt(GameKeys.START)) + ": EXIT GAME";
    String howto =
        "<JUMP> OR " + Keys.toString(KeyMapping.gameKeyToInt(GameKeys.JUMP)) + ": SELECT ITEM";
    font.draw(batch, back, 25, 25);
    font.draw(batch, howto, 25, 55);

    font.setColor(Color.RED);
    font.draw(batch, warning, 60, 305);

    font.setColor(Color.WHITE);
    batch.end();
  }
Ejemplo n.º 7
0
 /** used because actors usually need to run the full constructor before adding things to them */
 public GameRoot init() {
   /**
    * gameroot is 16 units wide and whatever units high, keeping aspect ratio. not too important..
    */
   this.setSize(16, (screenH / screenW) * 16);
   cam.setToOrtho(false, getWidth(), getHeight());
   cam.update();
   this.addListener(
       new EventListener() {
         @Override
         public boolean handle(Event event) {
           if (event instanceof MobRemoveEvent) {
             ((MobRemoveEvent) event).removeMob();
             if (event instanceof MobTouchedEvent) {
               stats.pointUp();
               screen.pointsChanged(stats.getPoints());
             } else if (event instanceof MobExplodeEvent) {
               screen.mobExploded(stats.mobExploded());
               if (stats.getStrikes() >= 5 && !gameOver) gameOver();
             }
           }
           return false;
         }
       });
   stats.reset();
   gameOver = false;
   return this;
 }
Ejemplo n.º 8
0
  @Override
  public void render() {
    // clear the screen with a dark blue color. The
    // arguments to glClearColor are the red, green
    // blue and alpha component in the range [0,1]
    // of the color to be used to clear the screen.
    Gdx.gl.glClearColor(0, 0, 0.2f, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.
    camera.update();

    // tell the SpriteBatch to render in the
    // coordinate system specified by the camera.
    batch.setProjectionMatrix(camera.combined);

    // begin a new batch and draw the bucket and
    // all drops
    batch.begin();
    batch.draw(bucketImage, bucket.x, bucket.y);
    for (Rectangle raindrop : raindrops) {
      batch.draw(dropImage, raindrop.x, raindrop.y);
    }
    batch.end();
    //

    // process user input
    if (Gdx.input.isTouched()) {
      Vector3 touchPos = new Vector3();
      touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(touchPos);
      bucket.x = touchPos.x - 48 / 2;
    }
    if (Gdx.input.isKeyPressed(Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();
    if (Gdx.input.isKeyPressed(Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();

    // make sure the bucket stays within the screen bounds
    if (bucket.x < 0) bucket.x = 0;
    if (bucket.x > 800 - 48) bucket.x = 800 - 48;

    // commit

    // check if we need to create a new raindrop
    if (TimeUtils.nanoTime() - lastDropTime > 1000000000) spawnRaindrop();

    // move the raindrops, remove any that are beneath the bottom edge of
    // the screen or that hit the bucket. In the later case we play back
    // a sound effect as well.
    Iterator<Rectangle> iter = raindrops.iterator();
    while (iter.hasNext()) {
      Rectangle raindrop = iter.next();
      raindrop.y -= 200 * Gdx.graphics.getDeltaTime();
      if (raindrop.y + 48 < 0) iter.remove();
      if (raindrop.overlaps(bucket)) {
        dropSound.play();
        iter.remove();
      }
    }
  }
Ejemplo n.º 9
0
 // Constructor
 public PlayScreen(KingsValley game) {
   this.game = game;
   camera = new OrthographicCamera();
   this.ratio = (float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();
   camera.setToOrtho(true, this.ratio * this.zoom, this.zoom);
   camera.position.set(544f / 2f, 480f / 2f, 0f);
   camera.update();
 }
Ejemplo n.º 10
0
 @Override
 public boolean touchDragged(int screenX, int screenY, int pointer) {
   mCurrentPos.set(screenX, screenY, 0);
   camera.unproject(mCurrentPos);
   camera.position.sub(mCurrentPos.sub(mCamPos));
   camera.update();
   return true;
 }
Ejemplo n.º 11
0
  /** Load cameras and set up viewport */
  private void initViewport() {
    getViewport().setWorldSize(V_WIDTH, V_HEIGHT);

    // Default cam : don't need BoundedCamera
    OrthographicCamera cam = new OrthographicCamera();
    cam.setToOrtho(false, V_WIDTH, V_HEIGHT);
    getViewport().setCamera(cam); // Set stage default camera
  }
Ejemplo n.º 12
0
 public void resize(int width, int height) {
   camera.viewportWidth = (Constants.VIEWPORT_HEIGHT / height) * width;
   camera.update();
   cameraGUI.viewportHeight = Constants.VIEWPORT_GUI_HEIGHT;
   cameraGUI.viewportWidth = Constants.VIEWPORT_GUI_HEIGHT / (float) height * (float) width;
   cameraGUI.position.set(cameraGUI.viewportWidth / 2, cameraGUI.viewportHeight / 2, 0);
   cameraGUI.update();
 }
Ejemplo n.º 13
0
 public void resize(int width, int height) {
   game.WIDTH = width;
   game.HEIGHT = height;
   game.scaleWidth = (float) width / game.SCALE;
   camera.viewportWidth = width;
   camera.viewportHeight = height;
   camera.update();
 }
Ejemplo n.º 14
0
  @Override
  public void create() {

    WIDTH_DEVICE = Gdx.graphics.getWidth();
    HEIGHT_DEVICE = Gdx.graphics.getHeight();

    ASPECT_RATIO = WIDTH_DEVICE / HEIGHT_DEVICE;

    WIDTH_WORLD = VIEWPORT_HEIGHT * ASPECT_RATIO;
    HEIGHT_WORLD = VIEWPORT_HEIGHT;

    // Models initialization

    // In the space there is not gravity :D
    int x_gravity = 0;
    int y_gravity = 0;

    boolean improve_performance_lowering_simulating_of_bodies = false;

    world =
        new World(
            new Vector2(x_gravity, y_gravity), improve_performance_lowering_simulating_of_bodies);

    /// Create a loader for the file saved from the editor. READ ONCE
    loader = new MiBodyEditorLoader(Gdx.files.internal("data/cr/world.json"));

    createPlanet();
    createPlanetCore();
    createBalls();

    // Render initialization

    batch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.BLACK);

    camera = new OrthographicCamera();
    camera.setToOrtho(
        false, WIDTH_WORLD, HEIGHT_WORLD); // setting aspect ratio and y-axis pointing to up
    camera.position.set(0, camera.viewportHeight / 2, 0);
    camera.update();

    createSprites();

    // Input initialization

    Gdx.input.setInputProcessor(
        new InputAdapter() {
          @Override
          public boolean touchDown(int x, int y, int pointer, int button) {
            restart();
            return true;
          }
        });

    // Run
    restart();
  }
Ejemplo n.º 15
0
 /** Set's the ShapeRenderer's projection matrix depending on the mode of the demo camera. */
 public void setCamera(ShapeRenderer renderer) {
   if (inCloseupMode) {
     closeupCamera.update();
     renderer.setProjectionMatrix(closeupCamera.combined);
   } else {
     overviewCamera.update();
     renderer.setProjectionMatrix(overviewCamera.combined);
   }
 }
Ejemplo n.º 16
0
 @Override
 public void create() {
   OrthographicCamera cam = new OrthographicCamera();
   cam.setToOrtho(true);
   vp = new StretchViewport(320, 480, cam);
   menu = new MenuStage(vp, this);
   stage = menu;
   Gdx.input.setInputProcessor(stage);
 }
Ejemplo n.º 17
0
 @Override
 public boolean scrolled(int amount) {
   camera.zoom += (amount * 0.1f);
   if (camera.zoom < 0.1f) {
     camera.zoom = 0.1f;
   }
   camera.update();
   return true;
 }
Ejemplo n.º 18
0
  @Override
  public void create() {
    WIDTH = Gdx.graphics.getWidth();
    HEIGHT = Gdx.graphics.getHeight();
    camera.translate(WIDTH / 2, HEIGHT / 2);
    camera.update();

    Gdx.input.setInputProcessor(inputProcessor);
  }
Ejemplo n.º 19
0
  @Override
  public void resize(int width, int height) {
    // TODO Auto-generated method stub

    camara2d.setToOrtho(false, Mundo.TAMANO_MUNDO_ANCHO, Mundo.TAMANO_MUNDO_ALTO);
    camara2d.update();

    spritebatch.setProjectionMatrix(camara2d.combined);
    spritebatch.disableBlending();
  }
Ejemplo n.º 20
0
 private void init() {
   batch = new SpriteBatch();
   camera = new OrthographicCamera(Constants.VIEWPORT_WIDTH, Constants.VIEWPORT_HEIGHT);
   camera.position.set(0, 0, 0);
   camera.update();
   cameraGUI = new OrthographicCamera(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT);
   cameraGUI.position.set(0, 0, 0);
   cameraGUI.setToOrtho(true); // flip y-axis
   cameraGUI.update();
 }
 @Override
 public boolean touchDragged(int x, int y, int pointer) {
   camera.unproject(curr.set(x, y, 0));
   if (!(last.x == -1 && last.y == -1 && last.z == -1)) {
     camera.unproject(delta.set(last.x, last.y, 0));
     delta.sub(curr);
     camera.position.add(delta.x, delta.y, 0);
   }
   last.set(x, y, 0);
   return false;
 }
Ejemplo n.º 22
0
  public void render(SpriteBatch batch) {
    // worldManager.updateCoords(tp.x, tp.y);

    if (dragging && resultX != 0 && resultY != 0) {
      int movingX = (resultX > 0 ? -1 : (resultX < 0) ? 1 : 0);
      int movingY = (resultY > 0 ? 1 : (resultY < 0) ? -1 : 0);
      camera.translate(resultX, -resultY, 0);
      // System.out.println("resultX: " + resultX + "    resultY: " + resultY);
    }
    camera.update();
    worldManager.render(batch);
  }
  private void processInput() {
    if (Gdx.input.isKeyPressed(Keys.LEFT)
        && (worldCamera.position.x - worldCamera.viewportWidth * .5f > 0))
      worldCamera.position.sub(deltaDimen, 0, 0);
    else if (Gdx.input.isKeyPressed(Keys.RIGHT)) worldCamera.position.add(deltaDimen, 0, 0);
    else if (Gdx.input.isKeyPressed(Keys.DOWN)) worldCamera.position.sub(0, deltaDimen, 0);
    else if (Gdx.input.isKeyPressed(Keys.UP)) worldCamera.position.add(0, deltaDimen, 0);
    else if (Gdx.input.isKeyPressed(Keys.CONTROL_RIGHT)) worldCamera.zoom *= 1.1f;
    else if (Gdx.input.isKeyPressed(Keys.ALT_RIGHT)) worldCamera.zoom /= 1.1f;

    worldCamera.update();
    batch.setProjectionMatrix(worldCamera.combined);
  }
Ejemplo n.º 24
0
  public void getInput() {

    if ((stop || win) && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
      stop = win = false;
      create();
    }

    if (Gdx.input.isKeyJustPressed(Input.Keys.A)) {
      camera.zoom += 1;
    }
    if (Gdx.input.isKeyJustPressed(Input.Keys.S)) {
      camera.zoom -= 1;
    }
  }
  @Override
  public void create() {

    // worldHeight = Utils.calculateOtherDimension(WH.width, worldWidth, Gdx.graphics.getWidth(),
    // Gdx.graphics.getHeight());
    worldHeight = 17;
    batch = new SpriteBatch();
    worldCamera = new OrthographicCamera();
    worldCamera.setToOrtho(false, worldWidth, worldHeight);
    worldCamera.update();

    createLayers();

    Gdx.input.setInputProcessor(new MyInputProcessor());
  }
Ejemplo n.º 26
0
  @Override
  public void render() {

    Gdx.gl.glClearColor(0, 0, 0.2f, 1);

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();

    batch.setProjectionMatrix(camera.combined);

    batch.begin();
    batch.draw(bucketImage, bucket.x, bucket.y);

    for (Rectangle raindrop : raindrops) {
      batch.draw(dropImage, raindrop.x, raindrop.y);
    }

    batch.end();

    if (Gdx.input.isTouched()) {
      Vector3 touchPos = new Vector3();
      touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
      camera.unproject(touchPos);
      bucket.x = touchPos.x - 64 / 2;
    }
    if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();
    if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();

    // make sure the bucket stays within the screen bounds
    if (bucket.x < 0) bucket.x = 0;
    if (bucket.x > 800 - 64) bucket.x = 800 - 64;

    if (TimeUtils.nanoTime() - lastDropTime > 1000000000) {
      spawnRaindrop();
    }

    Iterator<Rectangle> iter = raindrops.iterator();
    while (iter.hasNext()) {
      Rectangle raindrop = iter.next();
      raindrop.y -= 200 * Gdx.graphics.getDeltaTime();
      if (raindrop.y + 64 < 0) iter.remove();
      if (raindrop.overlaps(bucket)) {
        dropSound.play();
        iter.remove();
      }
    }
  }
Ejemplo n.º 27
0
 @Override
 public void render() {
   // wall and door tests
   if (nWy[0] > 0) {
     if (nPx > nWx[0] && nPx + 11 < nWx[0] + 35 && nPy == nWy[0]) {
       if (nKn[1] == 0) {
         nDy = 0;
         nHy--;
         nPy = nWy[0] - 1;
         camera.translate(0, -1);
         System.out.println("hit door");
       } else if (nKn[1] > 0) {
         nKn[1]--;
         for (int w = 0; w < 2; w++) {
           if (nKn[1] == w) {
             imgNum[0] = new Texture("Num " + nKn[w] + ".png");
           }
           nWy[0] = -10000;
         }
       }
     }
   }
   // camera and tiled
   camera.translate(nDx, nDy);
   nPx = nPx + nDx;
   nPy = nPy + nDy;
   nHx = nHx + nDx;
   nHy = nHy + nDy;
   for (int i = 0; i < 2; i++) {
     nNx[i] = nNx[i] + nDx;
     nNy[i] = nNy[i] + nDy;
   }
   camera.update();
   tiledMapRenderer.setView(camera);
   tiledMapRenderer.render();
   batch.setProjectionMatrix(camera.combined);
   batch.begin();
   batch.draw(imgBaseWall[0], nWx[0], nWy[0]);
   batch.draw(imgEnemy, nEx, nEy);
   batch.draw(imgPlayer, nPx, nPy);
   batch.draw(imgHud, nHx, nHy);
   batch.draw(imgNum[0], nHx + 24, nHy);
   batch.draw(imgNum[1], nHx + 48, nHy);
   batch.draw(imgNum[2], nHx + 71, nHy);
   batch.draw(imgBaseKey[0], nKx[0], nKy[0]);
   spMenu.draw(batch);
   batch.end();
 }
Ejemplo n.º 28
0
  @Override
  public void act(float fDelta) {
    if (sAction.equals("up")) {
      System.out.println("Up");
    } else if (sAction.equals("down")) {
      System.out.println("Down");
    } else if (sAction.equals("left")) {
      fDir = 0;
      trFrame = aniActor[0].getKeyFrame(fStateTime, true);
      if (fPosX > -300) {
        fPosX -= fVelX;
        camera.translate(-4, 0);
      }
    } else if (sAction.equals("right")) {
      fDir = 1;
      trFrame = aniActor[1].getKeyFrame(fStateTime, true);
      if (fPosX < 1200) {
        fPosX += fVelX;
        camera.translate(4, 0);
      }
    } else {
      if (fDir == 0) trFrame = trLeft[0];
      else if (fDir == 1) trFrame = trRight[0];
    }

    if (isJumping) {
      if (fVelY >= 0) {
        fY += fVelY * 2;
        fVelY -= 0.2;
      } else {
        isJumping = false;
        isFalling = true;
        fVelY = 0;
      }
    }

    if (isFalling) {
      if (fVelY >= 5) {
        isFalling = false;
        fVelY = 5;
      } else {
        fY -= fVelY * 2;
        fVelY += 0.2;
      }
    }

    updateBounds();
  }
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(Color.BLUE.r, Color.BLUE.g, Color.BLUE.b, Color.BLUE.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();
    game.batch.setProjectionMatrix(camera.combined);

    batch.begin();
    font.draw(batch, "Loading Game", 32, 32);
    background.draw(batch);
    batch.end();

    if (licenseVerified) {
      if (Gdx.input.isTouched()) {
        Logger.logMsg("transitioning to main menu screen");
        game.setGameScreen(this, game.mainMenuScreen);
        dispose();
      }
    } else {
      Dialog dialog =
          new Dialog("license key invalid", game.uiSkin) {
            protected void result(Object object) {
              Logger.logMsg("exiting");
              Gdx.app.exit();
            }
          };
      dialog.text("Your license key is invalid, exiting...");
      dialog.button("OK", true);
      dialog.show(stage);
    }
  }
  @Override
  public void create() {
    // load the images for the droplet and the bucket, 64x64 pixels each
    dropImage = new Texture(Gdx.files.internal("bottle.png"));
    bucketImage = new Texture(Gdx.files.internal("bucket_black.png"));
    brokenBucketImage = new Texture(Gdx.files.internal("bottle_broken.png"));

    // load the drop sound effect and the rain background "music"
    //        dropSound = Gdx.audio.newSound(Gdx.files.internal("drop.wav"));
    //        rainMusic = Gdx.audio.newMusic(Gdx.files.internal("rain.mp3"));

    // start the playback of the background music immediately
    //        rainMusic.setLooping(true);
    //        rainMusic.play();

    // create the camera and the SpriteBatch
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 480);
    batch = new SpriteBatch();

    // create a Rectangle to logically represent the bucket
    bucket = new Rectangle();
    bucket.x = 800 / 2 - 64 / 2; // center the bucket horizontally
    bucket.y = 20; // bottom left corner of the bucket is 20 pixels above the bottom screen edge
    bucket.width = 64;
    bucket.height = 80;

    // create the raindrops array and spawn the first raindrop
    raindrops = new Array<Rectangle>();
    brokenBottles = new Array<Rectangle>();
    spawnRaindrop();
  }