コード例 #1
0
ファイル: Instructions.java プロジェクト: puffluff/Supson
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   Instructions.draw(0, 0);
   move.draw(450, 120);
   slash.draw(450, 200);
   baddy.draw(450, 300);
   if (slash.getFrame() == 1) {
     g.drawImage(new Image("res/Link/Sword (right 2).png"), 490, 200);
   }
 }
コード例 #2
0
ファイル: Player.java プロジェクト: mohd874/Projects
 @Override
 public void render(GameContainer gc, Graphics g2d) throws SlickException {
   if (!isAlive) {
     animationDead.draw(x, y);
   } else if (isJumping) {
     animationJump.draw(x, y);
   } else {
     if (x < 34) {
       animationRunLeft.draw(x, y);
     } else {
       animationRunRight.draw(x, y);
     }
   }
 }
コード例 #3
0
ファイル: RollingBall.java プロジェクト: Hugheth/dizgruntled
  @Override
  public void render(Graphics g, long time) {

    // Render the position of the ball
    renderPosition(time, 20);

    // Draw the ball
    _animation.draw(_screen.x(), _screen.y());
  }
コード例 #4
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    camera.centerOn((int) Player.x, (int) Player.y);

    camera.drawMap();

    camera.translateGraphics();

    // it helps to add status reports to see what's going on

    // but it gets old quickly

    // System.out.println("Current X: " +player.x + " \n Current Y: "+ y);

    sprite.draw((int) Player.x, (int) Player.y);

    // g.drawString("x: " + (int)player.x + "y: " +(int)player.y , player.x, player.y - 10);

    g.drawString("Health: " + Player.health, camera.cameraX + 10, camera.cameraY + 10);

    g.drawString("speed: " + (int) (Player.speed * 10), camera.cameraX + 10, camera.cameraY + 25);

    // g.draw(player.rect);

    g.drawString("time passed: " + counter / 1000, camera.cameraX + 600, camera.cameraY);
    // moveenemies();

    for (itemwin w : stuffwin) {
      if (w.isvisible) {
        w.currentImage.draw(w.x, w.y);
        // draw the hitbox
        // g.draw(w.hitbox);

      }
    }

    for (Enemy e : monster) {

      // System.out.println("The current selection is: " +e.currentanime);

      e.currentanime.draw(e.Bx, e.By);
    }
  }
コード例 #5
0
ファイル: SlickCallableTest.java プロジェクト: MWisBest/Slick
  /**
   * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.Graphics)
   */
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    g.scale(2, 2);
    g.fillRect(0, 0, 800, 600, back, 0, 0);
    g.resetTransform();

    g.drawImage(image, 100, 100);
    image.draw(100, 200, 80, 200);

    font.drawString(100, 200, "Text Drawn before the callable");

    SlickCallable callable =
        new SlickCallable() {
          @Override
          protected void performGLOperations() throws SlickException {
            renderGL();
          }
        };
    callable.call();

    homer.draw(450, 250, 80, 200);
    font.drawString(150, 300, "Text Drawn after the callable");
  }
コード例 #6
0
 @Override
 public void render(GameContainer gc, StateBasedGame sb, Graphics gr) {
   Vector2f pos = owner.getPosition();
   anim.draw(pos.x, pos.y);
 }
コード例 #7
0
ファイル: PhotoState.java プロジェクト: JostCrow/NRG
  @Override
  public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics)
      throws SlickException {
    background.draw(0, 0);
    tandwiel1.draw(
        -tandwiel1.getWidth() / 2,
        AsaGame.SOURCE_RESOLUTION.height / 2 - tandwiel1.getHeight() / 2);
    tandwiel2.draw(
        tandwiel1.getWidth() / 2 - tandwielOffset - 40,
        AsaGame.SOURCE_RESOLUTION.height / 2 - tandwiel2.getHeight());

    graphics.setFont(fontBlack);

    if (baseImage != null) {
      webcamFeed
          .getSubImage(80, 0, 480, 480)
          .draw(center.getWidth() - ((500) / 2), center.getHeight() - (500 / 2), 500, 500);
      background_spinner_half.draw(
          center.getWidth() - background_spinner.getWidth() / 2, center.getHeight() + 45);
    } else {
      background_spinner.draw(
          center.getWidth() - background_spinner.getWidth() / 2,
          center.getHeight() - background_spinner.getHeight() / 2);
    }

    if (mode == 1) {
      spinner.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      spinneroverlay.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      selectImage.draw(center.getWidth() / 2 - 20, 60);
      choise.draw(
          choise.getWidth() * 0.15f,
          center.getHeight() * 2 - choise.getHeight() * 1.6f,
          pulseScale);
      for (int i = 0; i < wheelOptions.size(); i++) {
        float offsetDegree = 360 / wheelOptions.size();
        float degrees = (270 + ((rotation + rotationDelta) % 360 + offsetDegree * i) % 360) % 360;
        if (degrees < 0) {
          degrees = degrees + 360;
        }
        float rad = (float) (degrees * (Math.PI / 180));
        float radius = 313;

        float x = (float) (center.getWidth() + radius * Math.cos(rad));
        float y = (float) (center.getHeight() + radius * Math.sin(rad));

        WheelOptionYesNo option = wheelOptions.get(i);
        Image optionIcon = option.getIcon();

        float biggerThanDegrees = 270 + (offsetDegree / 2);
        if (biggerThanDegrees > 360) {
          biggerThanDegrees = biggerThanDegrees - 360;
        }

        if (degrees >= 270 - (offsetDegree / 2) && degrees < biggerThanDegrees) {
          x = x - (float) (optionIcon.getWidth() * 1.3 / 2);
          y = y - (float) (optionIcon.getHeight() * 1.3 / 2);
          option.getIcon().draw(x, y, (float) 1.3);
        } else {
          x = x - (float) (optionIcon.getWidth() * 1 / 2);
          y = y - (float) (optionIcon.getHeight() * 1 / 2);
          option.getIcon().draw(x, y);
        }

        if (degrees >= 270 - (offsetDegree / 2) && degrees < biggerThanDegrees) {
          selectedOption = i;
        }
      }
    } else {
      lens.draw(center.getWidth() - (550 / 2), center.getHeight() - (550 / 2));
      spinner.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      spinneroverlay.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      if (drawCountdown) {
        countdown.draw(center.getWidth() - 75, center.getHeight() + 75, 150, 150);
      }
    }
  }
コード例 #8
0
ファイル: Animation.java プロジェクト: davoodinator/StarMade
/*     */   public void draw(float x, float y, float width, float height)
/*     */   {
/* 349 */     draw(x, y, width, height, Color.white);
/*     */   }
コード例 #9
0
ファイル: Animation.java プロジェクト: davoodinator/StarMade
/*     */   public void draw(float x, float y, Color filter)
/*     */   {
/* 337 */     draw(x, y, getWidth(), getHeight(), filter);
/*     */   }
コード例 #10
0
ファイル: Animation.java プロジェクト: davoodinator/StarMade
/*     */   public void draw(float x, float y)
/*     */   {
/* 326 */     draw(x, y, getWidth(), getHeight());
/*     */   }
コード例 #11
0
ファイル: Animation.java プロジェクト: davoodinator/StarMade
/*     */   public void draw()
/*     */   {
/* 316 */     draw(0.0F, 0.0F);
/*     */   }
コード例 #12
0
ファイル: Creature.java プロジェクト: EricEidel/Game3
  // This method draws when player is still
  public void drawMovingNoPlayerMov(int x_tile_dist, int y_tile_dist, Graphics g) {
    // System.out.println(getMoving());
    // System.out.println(inputDelta);

    float part = (float) getInputDelta() / (float) getSpeed();
    int offset = (int) (part * Map.SIZE_OF_TILE);

    // System.out.println(part);
    // System.out.println(offset);

    int x_move = ((Player.getPlayerXCenter() + x_tile_dist) * Map.SIZE_OF_TILE) + Map.X_OFFSET;
    int y_move = ((Player.getPlayerYCenter() + y_tile_dist) * Map.SIZE_OF_TILE) + Map.Y_OFFSET;

    int tile = Map.SIZE_OF_TILE;

    int actual_x = 0;
    int actual_y = 0;
    switch (getMoving()) {
      case 1:
        // anim.draw(x_move+tile-offset, y_move+offset-tile);
        actual_x = x_move + tile - offset;
        actual_y = y_move + offset - tile;
        break;
      case 2:
        // anim.draw(x_move, y_move+offset-tile);
        actual_x = x_move;
        actual_y = y_move + offset - tile;
        break;
      case 3:
        // anim.draw(x_move-tile+offset, y_move+offset-tile);
        actual_x = x_move - tile + offset;
        actual_y = y_move + offset - tile;
        break;
      case 4:
        // anim.draw(x_move+tile-offset, y_move);
        actual_x = x_move + tile - offset;
        actual_y = y_move;
        break;
      case 6:
        // anim.draw(x_move-tile+offset, y_move);
        actual_x = x_move - tile + offset;
        actual_y = y_move;
        break;
      case 7:
        // anim.draw(x_move+tile-offset, y_move+tile-offset);
        actual_x = x_move + tile - offset;
        actual_y = y_move + tile - offset;
        break;
      case 8:
        // anim.draw(x_move, y_move+tile-offset);
        actual_x = x_move;
        actual_y = y_move + tile - offset;
        break;
      case 9:
        // anim.draw(x_move-tile+offset, y_move+tile-offset);
        actual_x = x_move - tile + offset;
        actual_y = y_move + tile - offset;
        break;
    }

    anim.draw(actual_x, actual_y);

    if (attacked) {
      g.setColor(RED);
      g.drawRect(actual_x, actual_y, Map.SIZE_OF_TILE, Map.SIZE_OF_TILE);
      g.setColor(BLACK);
    }

    getStatus().drawMoveMonster(actual_x, actual_y);
  }
コード例 #13
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    camera.centerOn((int) Player.x, (int) Player.y);

    camera.drawMap();

    camera.translateGraphics();

    // it helps to add status reports to see what's going on

    // but it gets old quickly

    // System.out.println("Current X: " +player.x + " \n Current Y: "+ y);

    sprite.draw((int) Player.x, (int) Player.y);

    // g.drawString("x: " + (int)player.x + "y: " +(int)player.y , player.x, player.y - 10);

    // g.drawString("Health: " + Player.health/1000, camera.cameraX + 10,
    //		camera.cameraY + 10);

    g.drawString("speed: " + (int) (Player.speed * 10), camera.cameraX + 10, camera.cameraY + 25);
    // doesn't actually count HELP
    g.drawString("bone: " + (int) (Player.Counter * 1), camera.cameraX + 10, camera.cameraY + 10);

    // g.draw(player.rect);

    g.drawString("time passed: " + counter / 1000, camera.cameraX + 600, camera.cameraY);
    // moveenemies();

    // for (Item i : stuff) {
    //	if (i.isvisible) {
    //		i.currentImage.draw(i.x, i.y);
    // draw the hitbox
    // g.draw(i.hitbox);

    //		}
    //	}

    /* for (Ninja n : dojo) {
    	if (n.isvisible) {
    		n.currentImage.draw(n.x, n.y);
    		// draw the hitbox
    		g.draw(n.hitbox);

    	}
    }
                  */
    for (Bone b : doghouse) {
      if (b.isvisible) {
        b.currentImage.draw(b.x, b.y);
        // draw the hitbox
        // g.draw(b.hitbox);

      }
    }

    // stormy.currentImage.draw(stormy.x,stormy.y);
    // daniel.currentImage.draw(daniel.x,daniel.y);

    //	for (Item1 h : stuff1) {
    //		if (h.isvisible) {
    //			h.currentImage.draw(h.x, h.y);
    // draw the hitbox
    // g.draw(h.hitbox);

    //		}
    //	}

    for (Enemy e : bonez) {
      if (e.isAlive) {
        e.currentanime.draw(e.Bx, e.By);
        // draw the hitbox
        // g.draw(e.hitbox);

      }
    }
    //		for (Itemwin w: stuffwin) {
    //			if (w.isvisible) {
    //				w.currentImage.draw(w.x, w.y);
    // draw the hitbox
    // g.draw(w.hitbox);

    //			}
    //		}

  }