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?