Package net.mdked.Jrachgame.world

Examples of net.mdked.Jrachgame.world.Animal


      }
    }
    //jivotnii
    int jiv = 45;
    for (int num = 0; num < jiv; num++) {
      Animal prdmt = new Animal(0, deerAttack.copy(), deerDyin.copy(),deerWalk.copy());
      prdmt.x = (float) ((map.length * 32) * Math.random());
      prdmt.y = (float) ((map.length * 32) * Math.random());
      World.objecz.add(prdmt);
      World.animalz.add(prdmt);
    }
    int jiv2 = 10;
    for (int numa = 0; numa < jiv2; numa++) {
      Animal prdmts = new Animal(1, bearAttack.copy(),bearDyin.copy(),bearWalk.copy());
      prdmts.x = (float) ((map.length * 32) * Math.random());
      prdmts.y = (float) ((map.length * 32) * Math.random());

      World.objecz.add(prdmts);
      World.animalz.add(prdmts);
 
View Full Code Here


    }
    //System.out.println(" pl= " + obj1r.getCenterX() +"x"+ obj1r.getCenterY());

    if (obj instanceof Animal) {
      anical = true;
      Animal chk = (Animal) obj;
      obj1r = chk.getBounds();
    }

    if (obj instanceof MousePoint) {
      ismouse = true;
      MousePoint ms = (MousePoint) obj;
      obj1r = ms.getBounds();
    }

    if (obj instanceof Missile) {
      misile = true;
      Missile mis = (Missile) obj;
      inittr = mis;
      obj1r = mis.getBounds();
    }


    for (Entity chCol : World.objecz) {
      if ( chCol instanceof StaticObj) {
        StaticObj ob = (StaticObj) chCol;
        obj2r = ob.getBounds();
        if (ismouse) {
          statObj = true;
        }
        if (misile) {
          tgt = chCol;
        }
      }
      if ( chCol instanceof Animal && !chCol.equals(obj) && !player) {
        animal = true;
        Animal an = (Animal) chCol;
        if (!an.dead) {
          obj2r = an.getBounds();

          if (misile || ismouse) {
            tgt = chCol;
          }
        }
      }
      if ( chCol instanceof Missile) {
        Missile an = (Missile) chCol;
        if (an.stuck && !anical) {
          misileget = true;
          obj2r = an.getBounds();
        }

      }
      if (obj1r.intersects(obj2r)) {

        if (misile) {
          Missile mis = (Missile) inittr;
          if (!mis.stuck && animal) {
            //System.out.println("olen ranen");
            Animal an = (Animal) tgt;
            tgt = an;

            mis.stuck = true;
            //            kopie
            playSound(5,getDRX(an.x),getDRY(an.y));

            an.criticalWound = true;
            an.hp -= 50;
            an.attacked(mis.host);
            switch (an.type) {
            case 0:
              playSound(9,getDRX(an.x),getDRY(an.y));
              break;
            case 1:
View Full Code Here

          stone.draw(wtdX - (32*xScale), wtdY - (64*xScale), xScale);
          break;
        }
      }
      if (obj instanceof Animal) {
        Animal anim = (Animal) obj;
        if (anim.type == 0) {
          if (anim.moving &&  !anim.faceRight) anim.moveani.draw(wtdX-(16*xScale), wtdY-(32*xScale), 32*xScale ,32*xScale);
          else if (anim.moving && anim.faceRight) anim.moveani.draw((wtdX-16*xScale)+(32*xScale), wtdY-(32*xScale), -32*xScale ,32*xScale);

          else if (anim.attacking &&  !anim.faceRight) anim.atani.draw(wtdX-(16*xScale), wtdY-(32*xScale), 32*xScale ,32*xScale);
 
View Full Code Here

    if (wtdY >= ((128 * 32) - xm)*xScale ) wtdY -= ((128 * 32)*xScale) ;
    if (wtdY < scrHe+ ((xm - (128 * 32))*xScale)  ) wtdY = wtdY + ((128 * 32)*xScale);
    return wtdY;
  }
  public static void spawnMob(int type) {
    Animal prdmt;
    switch (type) {
    case 0:
      prdmt = new Animal(type, deerAttack.copy(), deerDyin.copy(),deerWalk.copy());
      prdmt.x = (float) ((128 * 32) * Math.random());
      prdmt.y = (float) ((128 * 32) * Math.random());
      World.objecz.add(prdmt);
      World.animalz.add(prdmt);
      break;
    case 1:
      prdmt = new Animal(type, bearAttack.copy(), bearDyin.copy(),bearWalk.copy());
      prdmt.x = (float) ((128 * 32) * Math.random());
      prdmt.y = (float) ((128 * 32) * Math.random());
      World.objecz.add(prdmt);
      World.animalz.add(prdmt);
      break;
 
View Full Code Here

TOP

Related Classes of net.mdked.Jrachgame.world.Animal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.