Exemple #1
0
 @Override
 public void sprint(Graphics g, float fsX, float fsY) throws SlickException {
   kunai.setAlpha(1);
   if (this.getAnim() == this.getWalkingDown()) {
     kunai.setCenterOfRotation(0, 0);
     kunai.setRotation(94 - (System.currentTimeMillis() % 8));
     g.drawImage(kunai, fsX + 12, fsY + 24);
   }
   if (this.getAnim() == this.getWalkingUp()) {
     kunai.setCenterOfRotation(0, 0);
     kunai.setRotation(-(94 - (System.currentTimeMillis() % 8)));
     g.drawImage(kunai, fsX + 20, fsY + 24);
   }
   if (this.getAnim() == this.getWalkingLeft()) {
     kunai.setCenterOfRotation(0, 0);
     kunai.setRotation(184 - (System.currentTimeMillis() % 8));
     g.drawImage(kunai, fsX + 12, fsY + 32);
   }
   if (this.getAnim() == this.getWalkingRight()) {
     kunai.setCenterOfRotation(0, 0);
     kunai.setRotation(4 - (System.currentTimeMillis() % 8));
     g.drawImage(kunai, fsX + 16, fsY + 18);
   }
 }
Exemple #2
0
  @Override
  public void attack(Graphics g, float fsX, float fsY) throws SlickException {
    // g.drawOval(fsX-32, fsY-32, 64+32, 64+32);

    // Image kunai = new Image("res/ninja/kunai.png");

    long time2 = 8 + (System.currentTimeMillis() / 15) % (32 - 8);
    for (int i = 360; i > 0; i -= 45) {
      kunai.setCenterOfRotation(0, 0);
      kunai.setRotation(i);
      float alp = (32 - (time2));
      kunai.setAlpha((float) Math.pow((alp) / 32, 0.1));
      g.drawImage(
          kunai,
          (float) ((fsX + 16) + (1 * time2 * Math.cos(i * 0.0174532925))),
          (float) ((fsY + 16) + (1 * time2 * Math.sin(i * 0.0174532925))));
    }

    // g.drawImage(kunai, fsX-time2, fsY+8);
    // this.setAnim(Ninja.getAttack());
  }