Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

unit app_particle_crystalshards;

interface

uses sux_constant, sux_object, app_constant, resource_texture,
     resource_list, app_particle_main, app_particle_part;

type
  TShards=record
  end;
  SAPCrystalShards=class(SAParticle)
    shards: TShards;

    procedure createShards(const pos: SXVertex2D; const texture: SRTexture);

    procedure onTimer; override;

    procedure initialize; override;
    constructor Create(const parent: TObject);
    destructor Destroy; override;
  end;

implementation

uses main, gl_main, OpenGL;


// --- SAPCrystalShards


procedure SAPCrystalShards.createShards(const pos: SXVertex2D; const texture: SRTexture);
var p: SXInt;
    part: SAPPart;
    partpos: SXVertex2D;
    partmove: SXVertex2D;
    partrot: SXFloat;
begin
  settings.texture := texture;
  for p := 0 to 8 do
  begin
    partpos.x := pos.x + sx.math.random.getRandomFloat(-15, 15);
    partpos.y := pos.y + sx.math.random.getRandomFloat(-15, 15);
    partrot := sx.math.random.getRandomFloat(0, 360);
    part := addParticle(0, partpos, partrot, sx.math.random.getRandomFloat(3, 10));
    part.setDensity(1.0);

    partmove.x := sx.math._sin(partrot);
    partmove.y := sx.math._cos(partrot);
    partmove := sx.math.multiplyVertex(partmove, sx.math.random.getRandomFloat(10, 60));

    part.setAnimation(partmove, sx.math.random.getRandomFloat(-400, 400), 0,
      sx.convert.ColorRGBOf(0, 0, 0), -0.6);
  end;
end;




procedure SAPCrystalShards.onTimer;
begin
  onTimerParts;
  deleteIfEmpty;
end;




procedure SAPCrystalShards.initialize;
begin
end;


constructor SAPCrystalShards.Create(const parent: TObject);
begin
  inherited Create(parent);

  setupAppearance(nil, 1);
  setBlending(SX_GL_BLEND_AVERAGE);
end;


destructor SAPCrystalShards.Destroy;
begin
  inherited;
end;


end.