Example #1
0
 public void init(Weather type) {
   this.type = type;
   RPG.global.weather = type;
   if (eff != null) eff.dispose();
   if (stage == null)
     stage =
         new Stage(
             new ScalingViewport(Scaling.stretch, 1024, 576, new OrthographicCamera()),
             GameViews.batch);
   if (type == Weather.rain) {
     eff = new ParticleEffect();
     eff.load(
         Gdx.files.internal(Setting.PARTICLE + "rainp.p"), Gdx.files.internal(Setting.PARTICLE));
     eff.start();
   } else {
     eff = null;
   }
   logic();
 }
Example #2
0
  private void init() {
    r = new Random();
    showedUp = false;
    start = new Vector2();
    target = new Vector2();
    setOrbitable(false);
    double x = calculatePosition();
    double alpha = r.nextDouble() * Math.PI * 2;
    target.set((float) (Math.cos(alpha) * x), (float) (Math.sin(alpha) * x));
    radius = RADIUS;
    setlifespan(BACKUPLIFESPAWN);

    AssetLoader loader = AssetLoader.get();
    enterSound = loader.getSound(AssetContainer.SOUND_HEMAN_ENTER);
    getSound = loader.getSound(AssetContainer.SOUND_HEMAN_GET);
    twinkle = loader.getSound(AssetContainer.SOUND_TWINKLE);
    sprite = new Sprite(loader.getTexture(AssetContainer.HEMAN));

    velocity = new Vector2(target);
    if (r.nextBoolean()) velocity.rotate90(1);
    else velocity.rotate90(-1);
    // TODO does this work? do it better with 'nextFloat' ?

    start = new Vector2(velocity);
    start.scl(10);
    start = start.add(target);
    velocity.scl(-1 * VELOCITIYMULTYPLY);

    ParticleEffect effect = new ParticleEffect(ESPGame.getLevel().particleContainer.heman);
    ESPGame.getLevel().addParticleSystem(effect);
    effect.setPosition(this.position.x, this.position.y);
    effect.start();
    particleEffect = effect;

    getEffect = new ParticleEffect(ESPGame.getLevel().particleContainer.hemanGet);

    setPosition(start);
    sprite.setSize(radius * 2, radius * 2);
    sprite.setOriginCenter();
    sprite.setCenter(position.x, position.y);
  }
Example #3
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();
  }