Exemplo n.º 1
0
  public Giant(
      World world,
      RayHandler rh,
      BulletHandler bh,
      Color aColor,
      float rad,
      float critSize,
      float xPos,
      float yPos,
      String particlePath,
      EntityHandler eh,
      float facingDirection,
      float velocity,
      float angularVel,
      boolean isDynamic) {
    super("data/particle-fire.png", aColor, rad);

    bulletHandler = bh;
    criticalRadius = critSize;
    canChangeColor = false;
    canChangeSize = true;
    lightSize = 10 * radius;
    ignoreSize = true;
    ignoreExistence = true;

    originalDirection = facingDirection;
    originalVelocity = velocity;
    angularVelocity = angularVel;

    entityHandler = eh;
    rayHandler = rh;
    originalRadius = rad; // Used for exploding

    BodyDef circleDef = new BodyDef();

    if (isDynamic) circleDef.type = BodyType.DynamicBody;
    else circleDef.type = BodyType.StaticBody;

    circleDef.position.set(xPos, yPos);

    Body circleBody = world.createBody(circleDef);

    CircleShape circleShape = new CircleShape();
    circleShape.setRadius(rad);

    FixtureDef circleFixture = new FixtureDef();
    circleFixture.shape = circleShape;
    circleFixture.density = 1.0f;
    circleFixture.friction = 1.0f;
    circleFixture.restitution = 0.0f;
    circleFixture.filter.categoryBits = LightGameFilters.CATEGORY_ENTITY;
    circleFixture.filter.maskBits = LightGameFilters.MASK_ENTITY;

    circleBody.createFixture(circleFixture);

    // Lights
    ArrayList<Light> blueGiantLights = new ArrayList<Light>();
    PointLight pl = new PointLight(rayHandler, 400, aColor, rad * 10, 0, 0);
    pl.setXray(true);
    pl.attachToBody(circleBody, 0, 0);
    blueGiantLights.add(pl);

    // Set the variables in Entity
    entityBody = circleBody;
    lights = blueGiantLights;

    giantEffect = new ParticleEffect();
    giantEffect.load(Gdx.files.internal(particlePath), Gdx.files.internal("data"));
    giantEffect.setPosition(entityBody.getPosition().x, entityBody.getPosition().y);
    giantEffect.start();
  }
Exemplo n.º 2
0
 public LightComponent(float distance, int rays, Color color) {
   light = new PointLight(Main.getWorldManager().getRayHandler(), rays, color, distance, 0, 0);
   light.setSoft(false);
   light.setXray(true);
 }