Beispiel #1
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    if (this.isHit == false && !gc.isPaused()) {
      this.move(hip, this.ship.getRotation());
      this.ship.draw(this.x, this.y);
    } else if (System.currentTimeMillis() <= this.explosionTime + 300) {
      MultiplayerGame.explosion.draw(this.x - 15, this.y - 10);
    }

    if (shotFired && !Menu.multi) {
      if (currentShotSP.shotVisible && !currentShotSP.hit) {
        currentShotSP.updateShot();
        g.fillOval(currentShotSP.x, currentShotSP.y, 8, 8);
      } else if (currentShotSP.timeFired + 800 < System.currentTimeMillis()) {
        currentShotSP.hit = false;
        currentShotSP.shotVisible = false;
      }
    } else if (shotFired && Menu.multi) {
      if (currentShotMP.shotVisible && !currentShotMP.hit) {
        currentShotMP.updateShot();
        g.fillOval(currentShotMP.x, currentShotMP.y, 8, 8);
      } else if (currentShotMP.timeFired + 800 < System.currentTimeMillis()) {
        currentShotMP.hit = false;
        currentShotMP.shotVisible = false;
      }
    }
  }
 /*    */ public void render(GameContainer container, Graphics g) /*    */ throws SlickException
       /*    */ {
   /* 41 */ g.setColor(new Color(0.4F, 0.6F, 0.8F));
   /* 42 */ g.fillRect(0.0F, 0.0F, 1024.0F, 568.0F);
   /* 43 */ g.setColor(Color.white);
   /* 44 */ g.drawRect(5.0F, 5.0F, 1014.0F, 558.0F);
   /*    */
   /* 46 */ g.setColor(Color.white);
   /* 47 */ g.drawString(
       container.getInput().getMouseX() + "," + container.getInput().getMouseY(), 10.0F, 400.0F);
   /* 48 */ g.setColor(Color.red);
   /* 49 */ g.fillOval(
       container.getInput().getMouseX() - 10, container.getInput().getMouseY() - 10, 20.0F, 20.0F);
   /*    */ }
Beispiel #3
0
  /**
   * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, Graphics g) {
    g.drawString("left shift down: " + lshift, 100, 240);
    g.drawString("right shift down: " + rshift, 100, 260);
    g.drawString("space down: " + space, 100, 280);

    g.setColor(Color.white);
    g.drawString(message, 10, 50);
    g.drawString("" + container.getInput().getMouseY(), 10, 400);
    g.drawString(
        "Use the primary gamepad to control the blob, and hit a gamepad button to change the color",
        10,
        90);

    for (int i = 0; i < lines.size(); i++) {
      Line line = (Line) lines.get(i);
      line.draw(g);
    }

    g.setColor(cols[index]);
    g.fillOval((int) x, (int) y, 50, 50);
    g.setColor(Color.yellow);
    g.fillRect(50, 200 + ypos, 40, 40);
  }
 @Override
 public void render(Graphics g) {
   g.setColor(Color.orange);
   g.fillOval(transform.getX() - radius, transform.getY() - radius, radius * 2, radius * 2);
 }
 @Override
 public void draw(Graphics g) {
   g.fillOval(x, y, 10, 10);
 }