Afterwarp Development  

Go Back   Afterwarp Development > Software/Game Development > Programming and Graphics
Programming and Graphics Discuss any issues related to programming using Borland Delphi and computer graphics.


Reply
 
Thread Tools Display Modes
  (#1) Old
Ermol Ermol is offline
Visitor
Ermol is on a distinguished road
 
Posts: 4
Join Date: Nov 2009
04-Feb-2010, 14:20

After some time I come back to Particles. The decision was not difficult and will be possible interesting to someone. We create function which under the formula of cubic Bezier curve counts a point finding:

Code:
function TMainForm.Points(P0, P1, P2, P3: TPoint;
  Count, Index: Integer): TPoint;
var
  T, C0, C1, C2, C3: Extended;
begin
  T := Index / Count;
  C3 := T * T * T;
  C0 := C3 * -1 + T * T * 3 + T * -3 + 1;
  C1 := C3 * 3 + T * T * -6 + T * 3;
  C2 := C3 * -3 + T * T * 3;
  Result.X := Trunc(C0 * P0.X + C1 * P1.X + C2 * P2.X + C3 * P3.X);
  Result.Y := Trunc(C0 * P0.Y + C1 * P1.Y + C2 * P2.Y + C3 * P3.Y);
end;
In FormCreate we set four points (they can be set during program performance):

Code:
  A := Point(763, 310);
  A1 := Point(100, -300);
  B1 := Point(-100, 1500);
  B := Point(763, 0);

In RenderEvent we cause function and Particles:

Code:
   begin
    if (i < 200) then
    begin
      inc(i);
      Count:=200;
      if i mod 3=0 then
      begin
      P := Points(A, A1, B1, B, Count, i);
      XPS:=XPM.Launch('poem2',point2(p.x, p.y));
      XPS.FSettings.ColorStart:= cRGB1(0,0,255,55);
      end;
    end;
They are obediently sprayed, moving on a curve.


The task is solved.. But I in a silly condition once again. I can include particles only on standard events of the form, such as FormClick or FormCreate. Prompt, please, as I can to cause them on Collision. In Hasteroids example collisions are described separately in HAObjects.pas

P.S. to Aegis: Good day and should I begin a new thread?
Attached Thumbnails
Click image for larger version

Name:	shot.jpg
Views:	27
Size:	35.9 KB
ID:	1550  

Last edited by Ermol; 04-Feb-2010 at 14:52.
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
Line thickness in Asphyre Extreme 3.1.0 neobusy Development 4 21-Nov-2009 12:29
[?] How use ashpyre in command line application, not VCL arthur Technical Support 11 09-Aug-2007 19:07
How do I draw a simple antialiased line? sofakng Development 1 15-Mar-2007 17:53
Rounded polygons, bezier curves and cubic curves holypodi Published Resources 4 20-Dec-2006 13:47
Line with weight Gugle Development 0 19-Sep-2006 11:57



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