Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Daboy

Image List

This topic is 6029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, since no one answers me im gonna ask if this is how...If i add 3 images into an imagelist is that how i flip through them?

Share this post


Link to post
Share on other sites
Advertisement
Well the imagelist itself won''t do the flipping, but you can store three images in the imagelist and then setup a picturebox or other graphical component that you can use to display the image in the imagelist you want. Then all you need to do is display them in the sequence you want, to create a simple animation.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Can u explain how i can get it to flip through it??? Thx

Share this post


Link to post
Share on other sites
You can use mod to cycle through a series of numbers (if that''s what you mean). This gives you the remainder of a division, so the values can only ever be in the range [0..number-1]. Much like this:

SomeIndex := (SomeIndex + 1) mod 3; // cycles 0,1,2 inclusive

You can add in code like this:

ImageList1.GetBitmap(SomeIndex, MyBitmap);
SomeIndex := (SomeIndex + 1) mod 3;
// etc. (draw MyBitmap, whatever)

The next time you do a GetBitmap, SomeIndex will be the next number in the sequence. If it''s two (i.e. the last one, zero based) then it will become 0 again. Therefore, you can cycle through the images.

You can optimise mod when it''s a power of two. Replace it with an "and" with the power minus one. So for example,

SomeIndex := (SomeIndex + 1) mod 4;
becomes...
SomeIndex := (SomeIndex + 1) and 3; // much faster!

Btw, here''s a really cool and unrelated link: Blah.

Alistair Keys

"There are two kinds of people, those who finish what they start and so on."
-- Robert Byrne

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
For some reason thats throwing up alot of errors....and what do i put for the timer''s event handler???

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Crap wrong post.... Ok dude...where do i put this code in?? and what do i put for some Index??? Thx

Share this post


Link to post
Share on other sites
I''ve created a small web page giving example code (with a downloadable project for you). Hop over to:

Animation

Alistair Keys

"There are two kinds of people, those who finish what they start and so on."
-- Robert Byrne

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ok cool ...Thx man but one more thing now...how can i get that to work in a timage??? and how can i activate that on a button click? Thx ALOT!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!