Board index » cppbuilder » Animate tiles

Animate tiles

Hi,
I am about to write a realtime-strategy-game. I have a great editor for my
levels, and I can scroll and all that things. I have levels with many tiles,
like gras, water, trees, houses a.s.o...and I want to animate the trees,
gras, water, so as if the wind blows through them, or animate the smoke
coming out of the houses, animating the units.... But how can I do that?
I'd like an easy code, short and synoptical.

Thanks Willy

 

Re:Animate tiles


Cleanest way is to use an ImageList.

Re:Animate tiles


Can u give me more information please?

            Willy

Pete Pedersen schrieb in Nachricht <7db33i$o...@forums.borland.com>...

Quote
>Cleanest way is to use an ImageList.

Re:Animate tiles


Drop a TImageList on your Form, and add your animation images to it.
Then use a Timer to perform the animation by Draw(ing) from the
ImageList to the desired Canvas at specified intervals...

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
    ImageList1->Draw(Canvas, 5, 5, index);
    if (index < 6) index++;  //ImageList1 has 6 images
    else index = 0;

Quote
}

//Damon

Re:Animate tiles


That's ok, but how can I do it with n fields on my map together?

Willy

Damon Chandler schrieb in Nachricht <36FB17D8.71254...@cornell.edu>...

Quote
>Drop a TImageList on your Form, and add your animation images to it.
>Then use a Timer to perform the animation by Draw(ing) from the
>ImageList to the desired Canvas at specified intervals...

>void __fastcall TForm1::Timer1Timer(TObject *Sender)
>{
>    ImageList1->Draw(Canvas, 5, 5, index);
>    if (index < 6) index++;  //ImageList1 has 6 images
>    else index = 0;
>}

>//Damon

Re:Animate tiles


Krois,  
        Use n Timers and the same methodology, painting each animated section
with a different Timer.  You might consider using a Threaded Timer.

//Damon

Re:Animate tiles


Hey, thanks all, I got it.
                Willy

Other Threads