Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Rectangle.intersects()


      g.setColor(Color.red);
      g.draw(rect);
      for (int i = 0; i < MonsterHandler.monster_array.size(); ++i)
      {
        Monster mob = MonsterHandler.monster_array.get(i);
        if ((rect.intersects(mob.hitbox) || rect.contains(mob.hitbox)) && mob.state != MS.DEAD && mob.state != MS.NULL)
        {
          util_knife = (byte) (40-Elements.extractLevel(ITEM.P_UPG_KNIFE)*5);
          Particle.addNew(PT.KNIFE, (int) GameplayState.player.pl_center.getX(), (int) GameplayState.player.pl_center.getY());
          mob.onDamage(25+Elements.extractLevel(ITEM.P_UPG_KNIFE)*8, true, false);
          break;
View Full Code Here


      if (mob_state != MS.DEAD && mob_state != MS.NULL)
      {
        Rectangle mob_hitbox = list.get(i).hitbox; 
        for (float j = 0; j < radius; j += 3)
        {
          if (mob_hitbox.intersects(new Circle(x, y, j)) && mobNotDamaged(list.get(i), dmg_list))
          {
            float knockback = power; //calculate knockback
            knockback += (pc?2+pc_lvl:0);
            knockback += (th?4+th_lvl*0.8f:0);
            knockback += km_lvl*0.8f;
 
View Full Code Here

    Rectangle collision = new Rectangle(me.getX()+x,me.getY()+y,ENTITY_SPRITE_SIZE,ENTITY_SPRITE_SIZE);
   
    //me.setBounds( me.getX()+x, me.getY()+y,ENTITY_SPRITE_SIZE/2,ENTITY_SPRITE_SIZE/2);
   
    //him.setBounds( other.getX()*32 , other.getY()*32 ,other.ENTITY_SPRITE_SIZE/2,other.ENTITY_SPRITE_SIZE/2);
    if (collision.intersects(him)){
      this.collidedWith(other);
      return true;
    } else {
      return false;
    }
View Full Code Here

    Rectangle collision = new Rectangle(me.getX()+x,me.getY()+y,ENTITY_SPRITE_SIZE,ENTITY_SPRITE_SIZE);
   
    //me.setBounds( me.getX()+x, me.getY()+y,ENTITY_SPRITE_SIZE/2,ENTITY_SPRITE_SIZE/2);
   
    //him.setBounds( other.getX()*32 , other.getY()*32 ,other.ENTITY_SPRITE_SIZE/2,other.ENTITY_SPRITE_SIZE/2);
    if (collision.intersects(him)){
      this.collidedWith(other);
      return true;
    } else {
      return false;
    }
View Full Code Here

      }
     
      public void squashGrunt(Grunt g, GridCoordinate xy) {
        if (g == null) return;
        Rectangle r = new Rectangle(Grunt.COLLISION_RECT.getX() - (fPosition.x - g.position().x), Grunt.COLLISION_RECT.getY() - (fPosition.y - g.position().y), Grunt.COLLISION_RECT.getWidth(), Grunt.COLLISION_RECT.getHeight());
        if (r.intersects(COLLISION_RECT)) g.squash();
      }
    };
  }

  private void updateAnimation() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.