Exemplo n.º 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();
  }
Exemplo n.º 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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 4
0
 /**
  * delets an Interface
  *
  * @param face the particle to be deleted
  */
 public void del(BaseInterface face) {
   interfaces.del(face);
 }
Exemplo n.º 5
0
 /**
  * adds an interface
  *
  * @param face the interface to be added
  */
 public void add(BaseInterface face) {
   interfaces.add(face);
 }