Package game.entities

Examples of game.entities.Bullet


    double offsetTheta, newX, newY;
   
    switch(weapon) {
    case PISTOL:
      bullets.add(
          new Bullet(parent.x, parent.y,
          weapon.shotSize, weapon.shotSize, Color.CYAN, approxDest.x,
          approxDest.y,  weapon.shotSpeed, parent));
   
      break;
    case SHOTGUN:
      offsetTheta = Math.toRadians(20);
      //System.out.println("DIST FROM DEST: " + distFromDest);
      for(int i = -1; i <= 1; i++) {
        newX = (distFromDest * Math.cos(origAngle + offsetTheta*i));
        newY =  -(distFromDest * Math.sin(origAngle + offsetTheta*i));
        //System.out.print("X: " + x + " Y: " + y);
        //System.out.println("DIST FROM DEST: " + distFromDest);
        bullets.add(
            new Bullet(parent.x, parent.y,
            weapon.shotSize, weapon.shotSize, Color.RED,(int)
            newX + parent.x,
            (int)newY + parent.y, weapon.shotSpeed, parent));
      }
      break;
    case FRAG_GRENADE:
      offsetTheta = Math.toRadians(15);
      for(int i = 0; i < 24; i++) {
        newX = (distFromDest * Math.cos(origAngle + offsetTheta*i));
        newY =  (distFromDest * Math.sin(origAngle + offsetTheta*i));
        bullets.add(
            new Bullet(parent.x, parent.y,
            weapon.shotSize, weapon.shotSize, Color.BLUE,
            (int)newX + parent.x,
            (int)newY + parent.y, weapon.shotSpeed,  parent));
      }
     
View Full Code Here

TOP

Related Classes of game.entities.Bullet

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.