Package rtype.entity

Examples of rtype.entity.Entity


  private void checkCollisons()
  {
    // Check bullets with enemies
    ArrayList<Entity> bulletsArray = bullets.entities;
    ArrayList<Entity> enemiesArray = enemies.entities;
    Entity currentBullet = null;
    Entity currentEnemy = null;
    for (int i = 0; i < bulletsArray.size() ; i++)
    {
     
     
      for (int j= 0 ; j < enemiesArray.size(); j++ )
      {
        if (j < 0)
          continue;
        if (i<0)
          break;
        currentBullet = bulletsArray.get(i);
        currentEnemy = enemiesArray.get(j);
       
        if (Collision.boxBoxOverlap(currentBullet,
                      currentEnemy
                      ))
        {
          player1.hiscore++;
         
          if (currentBullet.collided(currentEnemy))
          i--;
         
          if (currentEnemy.collided(currentBullet))
          j--;
        }
       
      }
    }
    textHisCore.setString("HISCORE:"+player1.hiscore);
   
    // Check players with bonuses
    ArrayList<Entity> bonusArray = bonus.entities;
    Entity currentBonus = null;
    for (int j= 0 ; j < bonusArray.size(); j++ )
    {
      currentBonus = bonusArray.get(j);
      if(
        Collision.boxBoxOverlap( player1,
                     currentBonus
                    )
         
        )
      {
        if (currentBonus.collided(player1))
          j--;
        player1.collided(currentBonus);
      }
    }
  }
View Full Code Here


      }
  }

  public void update()
  {
    Entity e = null;
   
    for (int i=0 ; i < entities.size() ; i++)
      {
        e = entities.get(i);
        e.updateTick();
        e.update();
       
      }
  }
View Full Code Here

TOP

Related Classes of rtype.entity.Entity

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.