Example #1
0
  /** gets called when Level is initialized */
  public void init() {
    Log.info("initializing level...");

    interfaces.add(score);

    entities.add(new AbilityLogic(this), TickEvent.class);
    entities.add(new BasicLogic(this), TickEvent.class, DeathEvent.class, DamageEvent.class);
    entities.add(new Building(this), TickEvent.class);
    entities.add(new DestroyedOnContact(this), CollisionEvent.class);
    entities.add(new EnemyDeath(this), DeathEvent.class);
    entities.add(new EnergizerLogic(this), TickEvent.class);
    entities.add(new ProjectileLogic(this), DeathEvent.class, CollisionEvent.class);
    entities.add(new TimeToLife(this), TickEvent.class);

    CollisionChecking collision = new CollisionChecking(this);
    collision.addCollisionRule(CollisionGroup.H, CollisionGroup.A);
    collision.addCollisionRule(CollisionGroup.H, CollisionGroup.B);
    collision.addCollisionRule(CollisionGroup.A, CollisionGroup.B);
    collision.addCollisionRule(CollisionGroup.B, CollisionGroup.A);

    collision.dellCollisionRule(CollisionGroup.B, CollisionGroup.B);
    collision.dellCollisionRule(CollisionGroup.A, CollisionGroup.A);
    collision.dellCollisionRule(CollisionGroup.H, CollisionGroup.H);

    entities.add(collision, TickOnceEvent.class, EntityAddEvent.class, EntityDelEvent.class);

    entities.updateEntityList();
    entities.logicHandler.updateLogics();
  }
Example #2
0
  /**
   * gets called every logic tick
   *
   * @param delta the time in ms since the last logic tick
   */
  public void logic(int delta) {

    particles.logic(delta);

    entities.logic(delta);

    interfaces.logic(delta);
  }
Example #3
0
  /**
   * gets called evey render
   *
   * @param g the graphics object on which should be drawn
   */
  public void render(Graphics g) {

    g.translate(camX, camY);

    particles.render(g);

    entities.render(g);

    interfaces.render(g);
  }
Example #4
0
 /**
  * delets an entity
  *
  * @param entity the entity to be deleted
  */
 public void del(BaseEntity entity) {
   entities.del(entity);
 }
Example #5
0
 /**
  * ads an entity to the level
  *
  * @param entity
  */
 public void add(BaseEntity entity) {
   entities.add(entity);
 }