Afterwarp Development  

Go Back   Afterwarp Development > Software/Game Development > Published Resources
Published Resources Post any source code, images and tools here that you want to share with the community.


Reply
 
Thread Tools Display Modes
  (#11) Old
2morrowMan 2morrowMan is offline
Administrator
2morrowMan is on a distinguished road
 
2morrowMan's Avatar
 
Posts: 238
Join Date: Oct 2005
Location: Ukraine
16-Mar-2006, 02:06

Quote:
Originally Posted by wagenheimer
I hava a particle explosion effect (2 seconds long), what is the best way to spawn (random amount) explosions at same time (some little time differenct between it)? How to do to the "explosions already played" to die?
At first dowload new versions of XParticles
Use
Code:
TXParticleSystem.Stop(KillParticles: boolean = false);
procedure to stop emission of a particles and leave already emissed particles or to stop and remove all Sytems particles.

Quote:
Originally Posted by wagenheimer
If i need to play another kind of "particles" at the same time, a need to create a TXParticleSystem to every kind of particle animation that i did use?
Use ParticleManager and you need to have ParticleSystemSetting to every kind of your particle animation.
For example:
Code:
XParticleManager.SpawnPS(Pss_Explode1, Images[0], X, Y);
XParticleManager.SpawnPS(Pss_Explode2, Images[0], X2, Y2);
...

Last edited by 2morrowMan; 16-Mar-2006 at 02:12.
Reply With Quote
  (#12) Old
wagenheimer wagenheimer is offline
Honoured
wagenheimer is on a distinguished road
 
wagenheimer's Avatar
 
Posts: 329
Join Date: Dec 2005
Location: Brazil
Send a message via ICQ to wagenheimer Send a message via MSN to wagenheimer Send a message via Skype™ to wagenheimer
18-Mar-2006, 22:01

That was exactally what i was needing! Thanks a Lot!

This XParticles Engine is the Best Thing that happend, only after Asphyre Engine itself! Ah, SprinteEngine for Asphyre is one of the best thing also.

I will creditate you, LifePower, DraculaLin, and everyone else that did help me in making my first Indie Game. I Will be always gratifull for everyone that did help me here!

Thanks a lot everybody!
Reply With Quote
  (#13) Old
wagenheimer wagenheimer is offline
Honoured
wagenheimer is on a distinguished road
 
wagenheimer's Avatar
 
Posts: 329
Join Date: Dec 2005
Location: Brazil
Send a message via ICQ to wagenheimer Send a message via MSN to wagenheimer Send a message via Skype™ to wagenheimer
19-Mar-2006, 00:05

I´m have some Access Violations problems, in

Quote:
if (FParticlesAlive <= 0) then
Exit;
of the procedure TXParticleSystem.Render(Canvas: TAsphyreCanvas);

When i have "a lot" o explosions on my screen, this access violation happens!

Thanks.
Reply With Quote
  (#14) Old
2morrowMan 2morrowMan is offline
Administrator
2morrowMan is on a distinguished road
 
2morrowMan's Avatar
 
Posts: 238
Join Date: Oct 2005
Location: Ukraine
19-Mar-2006, 18:23

Quote:
Originally Posted by wagenheimer
I´m have some Access Violations problems, in

of the procedure TXParticleSystem.Render(Canvas: TAsphyreCanvas);

When i have "a lot" o explosions on my screen, this access violation happens!

Thanks.
I think it's happens because application trys to render not existing ParticleSystem... More about I'll write tomorrow!
Reply With Quote
  (#15) Old
2morrowMan 2morrowMan is offline
Administrator
2morrowMan is on a distinguished road
 
2morrowMan's Avatar
 
Posts: 238
Join Date: Oct 2005
Location: Ukraine
20-Mar-2006, 19:17

Can you post the code part where you use Particle system?
Reply With Quote
  (#16) Old
wagenheimer wagenheimer is offline
Honoured
wagenheimer is on a distinguished road
 
wagenheimer's Avatar
 
Posts: 329
Join Date: Dec 2005
Location: Brazil
Send a message via ICQ to wagenheimer Send a message via MSN to wagenheimer Send a message via Skype™ to wagenheimer
30-Mar-2006, 23:08

Hi...

I did create a class to do multiple explosions, which is working fine to me!

Code:
        TParticleExplosions = class
        private
          FExplosionsList: TObjectList;
        public
          constructor create;
          destructor destroy;
          procedure Add(Tipo, X, Y: Integer);
          procedure draw;
          procedure update;
          class function GetInstance: TParticleExplosions;
          class var
             FInstance: TParticleExplosions;
          end;

{ TParticleExplosions }

constructor TParticleExplosions.create;
begin
  FExplosionsList := TObjectList.Create;
  FExplosionsList.OwnsObjects := True;
end;

destructor TParticleExplosions.destroy;
begin
  FExplosionsList.Free;
  FExplosionsList := nil;
  FInstance := nil;
end;

procedure TParticleExplosions.Add(Tipo, X, Y: Integer);
var
  temp: TXParticleSystem;
  PSS: TXParticleSystemSettings;
  Stream: TFileStream;
begin
  try
    temp := TXParticleSystem.Create(PSS);

    case Tipo of
      1: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\gota-spark.pss', fmOpenRead);
      2: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\book-spark.pss', fmOpenRead);
      3: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\fire-spark.pss', fmOpenRead);
      4: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\green-spark.pss', fmOpenRead);
      5: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\red-spark.pss', fmOpenRead);
      6: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\black-spark.pss', fmOpenRead);
      7: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\pearl-spark.pss', fmOpenRead);
      8: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\cristal-spark.pss', fmOpenRead);
      9: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\spawn.pss', fmOpenRead);
      10: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\mapexplosion.pss', fmOpenRead);
      11: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\forcefield-orange.pss', fmOpenRead);
      12: Stream := TFileStream.Create(ExtractFilePath(Application.ExeName) + 'Images\forcefield-blue.pss', fmOpenRead);
    end;

    if (not temp.SettingsLoadFromStream(Stream)) then ShowMessage('Unable to load ParticleSystem settings');
    Stream.Free();
    temp.Texture := Main.Images[2];
    temp.AddEmitters([point(0, 0)]);
    temp.StartAt(x, y);
    FExplosionsList.Add(temp);
  except
    Temp.Free();
  end;
end;

procedure TParticleExplosions.draw;
var i: integer;
  temp: TXParticleSystem;
begin
  for i := 0 to FExplosionsList.count - 1 do
  begin
    temp := (FExplosionsList.items[i] as TXParticleSystem);
    if temp.ParticlesAlive > 0 then
      temp.Render(Main.Canvas);
  end;
end;

class function TParticleExplosions.GetInstance: TParticleExplosions;
begin
  if FInstance = nil then
  begin
    FInstance := TParticleExplosions.Create;
  end;
  Result := FInstance;
end;

procedure TParticleExplosions.update;
var i: integer;
  temp: TXParticleSystem;
  FDeadList: TObjectList;
begin
  try
    FDeadList := TObjectList.Create;
    FDeadList.OwnsObjects := False;

    for i := 0 to FExplosionsList.count - 1 do
    begin
      temp := (FExplosionsList.items[i] as TXParticleSystem);
      temp.Update(Ceil(1000 / Main.Timer.Speed));

      if (temp.ParticlesAlive <= 0) and (temp.age < 1.9) then
      begin
        FDeadList.Add(temp);
      end;
    end;

    for i := 0 to FDeadList.count - 1 do
    begin
      temp := (FDeadList.items[i] as TXParticleSystem);
      FExplosionsList.Remove(FDeadList.items[i]);
    end;
  finally
    FDeadList.Free;
  end;
end;
Here is my old code that was with randoms "access violations"....

Code:
  
GameParticleManager: TXParticleManager;
GameParticleSystem: TXParticleSystem;
FGotaExplosion: TXParticleSystemSettings;

GameParticleManager := TXParticleManager.Create;
GameParticleManager.Canvas := Canvas;
FGotaExplosion := LoadParticleFromASDB('gota-explosion.pss');

GameParticleManager.Update(FDelta); //In TimerProcess

GameParticleManager.Render; //In AsphyreRender

GameParticleSystem := GameParticleManager.SpawnPS(Main.FGotaExplosion, Main.Images[2], X, Y); //To Spawn a new Explosion
Using this way, it was happenings random access violatios in XParticles code.
Reply With Quote
  (#17) Old
2morrowMan 2morrowMan is offline
Administrator
2morrowMan is on a distinguished road
 
2morrowMan's Avatar
 
Posts: 238
Join Date: Oct 2005
Location: Ukraine
03-Apr-2006, 12:11

XParticles and XParticleEditor updated.
Attached in the first post.
Reply With Quote
  (#18) Old
Cervajz Cervajz is offline
Professional
Cervajz is a glorious beacon of lightCervajz is a glorious beacon of lightCervajz is a glorious beacon of lightCervajz is a glorious beacon of lightCervajz is a glorious beacon of lightCervajz is a glorious beacon of light
 
Cervajz's Avatar
 
Posts: 76
Join Date: Nov 2005
Location: Czech Republic
Send a message via MSN to Cervajz Send a message via Skype™ to Cervajz
Lightbulb 25-Apr-2006, 14:30

Hi 2morrowMan,

I have small suggestion to your XParticles editor. Please, might have been in new version make it, that if I minimize editor, stop "render timer".
I often works with yours editor and at the same time with some project (e.g. when I fine-tuning some effects), but editor " take down " considerable achievement of processor and that is why project starts/compiles slower. And shut off editor every time is impractical.

Cervajz

P.S: GuiDesigner this "function" supports.


Smile into life !

Athlon 6400+ Black Edition, 4096 GB RAM, ATI HD 2600 XT 512 MB, Xi-Fi, Vista x64, Delphi 2007
Reply With Quote
  (#19) Old
2morrowMan 2morrowMan is offline
Administrator
2morrowMan is on a distinguished road
 
2morrowMan's Avatar
 
Posts: 238
Join Date: Oct 2005
Location: Ukraine
26-Apr-2006, 14:48

Quote:
Originally Posted by Cervajz
Hi 2morrowMan,

I have small suggestion to your XParticles editor. Please, might have been in new version make it, that if I minimize editor, stop "render timer".
I often works with yours editor and at the same time with some project (e.g. when I fine-tuning some effects), but editor " take down " considerable achievement of processor and that is why project starts/compiles slower. And shut off editor every time is impractical.

Cervajz

P.S: GuiDesigner this "function" supports.
Done!
You can download a new version of XParticle Editor from first post!
Reply With Quote
  (#20) Old
huasoft huasoft is offline
Reputable
huasoft is on a distinguished road
 
huasoft's Avatar
 
Posts: 174
Join Date: Nov 2005
Location: ChangSha China
27-Apr-2006, 08:08

suggestion:can you set Vsybc=true in xpEditor,because it took much CPU time and look tremble


Program,I like to,I live on! http://www.huosoft.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sprite Engine (Asphyre eXtreme v3.x) DraculaLin Published Resources 87 08-Sep-2009 21:18
Sprite Engine question Andrew Technical Support 16 16-Jan-2006 21:08
AsphyreObjects2D in Asphyre eXtreme ? BaziX Development 2 07-Nov-2005 15:00
Mixing Asphyre eXtreme lifepower Development 4 17-Oct-2005 03:57



vBulletin® is copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 2000 - 2008 Afterwarp Development. All rights reserved.