Package com.tankz.components

Examples of com.tankz.components.Health


    healthMapper = world.getMapper(Health.class);
  }

  @Override
  protected void process(Entity e) {
    Health health = healthMapper.get(e);
   
    if(!health.isAlive()) {
      world.deleteEntity(e);
    }
   
  }
View Full Code Here


    }
    g.translate(-container.getWidth()+minimapWidth+20,-20);
  }

  private void renderHealth() {
    Health health = healthMapper.get(player);
    g.translate(35, container.getHeight()-45);
    {
      font.drawString(-26, 8, "Health");
      g.rotate(0, 0, -90);
      float healthStatus = health.getHealthStatus();
      g.setDrawMode(Graphics.MODE_ADD);
      statusBar.draw(0,0,statusBar.getWidth()*healthStatus, statusBar.getHeight(), 0,0,statusBar.getWidth()*healthStatus, statusBar.getHeight(), healthStatus<0.25?Color.red:healthStatus<0.6?Color.yellow:Color.green);
      statusBar.draw(statusBar.getWidth()*healthStatus,0,statusBar.getWidth(), statusBar.getHeight(), statusBar.getWidth()*healthStatus,0,statusBar.getWidth(), statusBar.getHeight(), new Color(0.15f,0.15f,0.15f));
      g.setDrawMode(Graphics.MODE_NORMAL);
      g.rotate(0, 0, 90);
View Full Code Here

    g.translate(-cameraSystem.getStartX(), -cameraSystem.getStartY());
  }

  @Override
  protected void process(Entity e) {
    Health health = healthMapper.get(e);
    Physics physics = physicsMapper.get(e);

    float xo = physics.getX()-25;
    float yo = physics.getY()-30;
    g.translate(xo,yo);
    {
      int healthIterations = Math.round(health.getHealthStatus()*10f);
      int i = 0;

      for (i = 0; healthIterations > i; i++) {
        bar.draw(i * 5, 0, healthColor);
      }
View Full Code Here

    world.deleteEntity(bullet);
  }
 
  private void addDamageToTarget(Entity crate) {
    Health h = crate.getComponent(Health.class);
    if(h != null)
      h.addDamage(10f);
  }
View Full Code Here

  }

  public static Entity createCrate(World world, float x, float y, float angleDeg) {
    Entity e = world.createEntity();
    world.getManager(GroupManager.class).add(e, "crates");
    e.addComponent(new Health(100, 160));

    SpatialForm form = new SpatialForm("crate");
    e.addComponent(form);

    Body b = new Body(new Box(50, 50), 0.3f);
View Full Code Here

    e.addComponent(new SpatialForm("mammothTank"));
    e.addComponent(new Velocity());
    e.addComponent(new TurnFactor());
    e.addComponent(new Tower());
    e.addComponent(new Health(110, 150));
    e.addComponent(new Ammo(78, 150));

    Body b = new Body(new Box(125, 104), 1f);
    b.setUserData(e);
    b.setPosition(x, y);
View Full Code Here

TOP

Related Classes of com.tankz.components.Health

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.