Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


    bullet_iter = 12;
    if (GameplayState.player.gun.opt_distance_is_power)
      power_add = -10;
   
    /* Searching for player-mouse line angle and setting bullet fly vector */
    vector_pl = new Vector2f(this.x, this.y);
    vector_mouse = new Vector2f(Util.MouseX(), Util.MouseY());
    vector_mouse.sub(vector_pl);
    vector_mouse.normalise();
    float spread = GameplayState.player.gun.opt_spreading-GameplayState.player.gun.opt_spreading_add;
    float rand = new Random().nextFloat()*6-3; //[-3..3]
    vector_mouse.setTheta(vector_mouse.getTheta()+rand/5*spread); //rand/spread_max*(spread-spread_add)
 
View Full Code Here


        curr_y = 1;
      }
      this.rule = rule;
     
      /* Searching for player-mouse line angle and setting bullet fly vector */
      vector_pl = new Vector2f(this.x, this.y);
      vector_mouse = new Vector2f(Util.MouseX(), Util.MouseY());
      vector_mouse.sub(vector_pl);
      vector_mouse.normalise();
      float recoil = GameplayState.player.gun.opt_recoil;
      vector_mouse.setTheta(vector_mouse.getTheta()+new Random().nextFloat()*5-recoil/2);
      n_x = vector_mouse.x;
View Full Code Here

      if (curr_x[i] == 0 && curr_y[i] == 0) //game freeze prevention
      {
        curr_x[i] = 1;
        curr_y[i] = 1;
      }
      vector_pl = new Vector2f(this.x, this.y);
      vector_mouse = new Vector2f(Util.MouseX(), Util.MouseY());
      vector_mouse.sub(vector_pl);
      vector_mouse.normalise();
      float recoil = GameplayState.player.gun.opt_spreading;
      float rand = new Random().nextFloat()*22-11; //[-11..11]
      vector_mouse.setTheta(vector_mouse.getTheta()+rand/7*(recoil+2f));
 
View Full Code Here

    this.y[2] = (short) (y - 4);
    this.x[3] = (short) (x-18 + 4);
    this.y[3] = (short) (y - 4);
    this.x[4] = (short) (x-18 + 4);
    this.y[4] = (short) y;
    Vector2f vector;
    for (int i = 0; i < 5; i++) //[10..90] - 75/5
    {
      rotation[i] = (short) new Random().nextInt(360);
      direction[i] = new Random().nextBoolean();
      vector = new Vector2f(x,y);
      vector.normalise();
      vector.setTheta(new Random().nextInt(32)-170+32*i);
      x_off[i] = vector.getX();
      y_off[i] = vector.getY();
    }
  }
View Full Code Here

   
    util_img = Util.loadImage("particle/thorn.png");
    rotation = (short) new Random().nextInt(360);
    util_img = util_img.getFlippedCopy(true, false);
    util_img.rotate(rotation);
    vector = new Vector2f(x,y);
    vector.normalise();
    vector.setTheta(rotation);
    x_incr = vector.getX();
    y_incr = vector.getY();
    this.x = x;
View Full Code Here

 
  public void update(GameContainer gc)
  {
    /* GUN ROTATION UPDATE */
    boolean b = GameplayState.player.util_facing; //get player facing
    vector_gun = new Vector2f(GameplayState.player.getX()+((b)?9:16),
        GameplayState.player.getY()+13); //get vector of gun
    vector_mouse = new Vector2f(Util.MouseX(), Util.MouseY()); //get vector of mouse
    vector_mouse.sub(vector_gun);
    vector_mouse.normalise(); //subtract and normalise
    gun_point.setLocation(GameplayState.player.getX()+((b)?9:16)+gun_dist*vector_mouse.x,
        GameplayState.player.getY()+13+gun_dist*vector_mouse.y); //sets the location of gun point

View Full Code Here

    bullet_iter = 50;
    curr_x[0] = (int) gun_point.getX();
    curr_y[0] = (int) gun_point.getY();
    boolean direction = new Random().nextBoolean();
    boolean size_penalty_annigilator = false; //to prevent ray stuck intro the ground
    vector_pl = new Vector2f(curr_x[0], curr_y[0]);
    vector_end = new Vector2f(Util.MouseX(), Util.MouseY());
    vector_end.sub(vector_pl);
    vector_end.normalise();
    for (int i = 0; i < 2; i++)
    {
      float rand;
View Full Code Here

  public void pointExcluded(float x, float y) {
  }

  public void pointIntersected(float x, float y) {
    intersections.add(new Vector2f(x, y));
  }
View Full Code Here

  public void pointIntersected(float x, float y) {
    intersections.add(new Vector2f(x, y));
  }

  public void pointUsed(float x, float y) {
    used.add(new Vector2f(x, y));
  }
View Full Code Here

    colors.add(new ColorRecord(0, Color.white));
    colors.add(new ColorRecord(1, Color.red));

    ArrayList curve = new ArrayList();
    curve.add(new Vector2f(0.0f, 0.0f));
    curve.add(new Vector2f(1.0f, 255.0f));
    alpha = new LinearInterpolator(curve, 0, 255);

    curve = new ArrayList();
    curve.add(new Vector2f(0.0f, 0.0f));
    curve.add(new Vector2f(1.0f, 255.0f));
    size = new LinearInterpolator(curve, 0, 255);

    curve = new ArrayList();
    curve.add(new Vector2f(0.0f, 0.0f));
    curve.add(new Vector2f(1.0f, 1.0f));
    velocity = new LinearInterpolator(curve, 0, 1);

    curve = new ArrayList();
    curve.add(new Vector2f(0.0f, 0.0f));
    curve.add(new Vector2f(1.0f, 1.0f));
    scaleY = new LinearInterpolator(curve, 0, 1);
  }
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Vector2f

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.