--- GLOGIC 20 <[EMAIL PROTECTED]> wrote:
>
> hi its in 2d..
> this is what i have at the moment and it will do the
> job i suppose.
> Basically when a collsion occurs startexplosion is
> called to initialize the
> values needed, such as the position of the ship and
> random directions to
> move in, live span of each particle. each time
> updateexplosion is called
> from a timer it moves each bit in the velocity it
> has and decrements the
> live of the particle.
> any ideas of how to improve it? or a better way to
> tackle it even?
> oh and any idea how to stretch an image to set as
> background of the form?
> thanks
> gav
>
>
> void UpdateExplosion(){
>
>
> //move the explosion pieces for the next
> frame
> for (int i = 0;i<MAX_EXPLOSION_BITS;i++)
> {
>
>
> explode[i].position =
> Add(explode[i].position ,
> explode[i].velocity );
> explode[i].timetoLive--;
>
> if (explode[i].timetoLive ==
> 0)
> {
> explode[i].alive = false;
> }
> }
>
>
> }
> void DrawExplosion(){
> // draw each of the explosion bits
> vector pos;
> Form1->Canvas->Pen->Color = clGreen;
> for (int i = 0;i<MAX_EXPLOSION_BITS;i++)
> {
>
> if (explode[i].alive ==
> true)
> {
>
>
>
> Form1->Canvas->MoveTo(explode[i].position.x,
> explode[i].position.y);
>
> pos =
> Add(explode[i].position ,
> explode[i].velocity );
>
> Form1->Canvas->LineTo(pos.x, pos.y);
> }
>
> }
>
>
>
> }
>
=== message truncated ===
Its looks like your using c++ builder. If so there is
a component called TPaintBox that might be better
suited for simulating an explosion than using the
canvas property to draw direct to the form.
Check it out
Mickey M.
Construction Partner Inc.
http://www.constructionpartner.com
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html