![]() |
Forum Index : Microcontroller and PC projects : Toggling Sprite Images
Author | Message | ||||
William Leue Guru ![]() Joined: 03/07/2020 Location: United StatesPosts: 405 |
I have looked through the manuals, including Peter's graphics posts, but can't seem to find a solution for this: I have a large number of sprites (more than 50) in a game I am writing, and I need to do simple animation in which each sprite has two different images, and they need to periodically switch back and forth between the 2 images. The obvious way to do this is to have 2 sets of sprites and toggle back and forth between show and hide. But sadly I have too many sprites for this to be possible. Any clues for an efficient way to do this up to a few times per second? -Bill |
||||
bar1010 Senior Member ![]() Joined: 10/08/2020 Location: United StatesPosts: 197 |
Mauro’s Gauntlet has animated sprites. Take a look at his code. Also animated GIFs is a possibility. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
Martin H combines 2 sprites in one. This only works for symetrical prites though. The left half is sprite 1, the righ half is sprite 2. Not sure if that helps in any way. He used it in "on the road". Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1234 |
that does just work, if the Sprites are Symmetic then you can use half of the Sprite and mirror it, when needed.. But you'll still need the same Number of Sprites, so I think it would'nt help in Bills case. (50 or more) If the "Protagonists" (or some of them) are monochrome, you might use GUI BITMAP Instead of SPRITE/BLIT. these are stored in Strings and uses just one Bit/Pixel. if you store these "Sprites" in a 2 dimensional StringArray, you are able to animate them, by chousing a different dimension. (as I've done in PicoVaders) Cheers Mart!n Edited 2022-10-28 17:25 by Martin H. 'no comment |
||||
William Leue Guru ![]() Joined: 03/07/2020 Location: United StatesPosts: 405 |
Thanks to bar1010, Volhout, and Martin H. for suggestions! I think those ideas will be very helpful. -Bill |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2567 |
I used a counter that reset and chose a "sprite" of 2 blits https://www.youtube.com/watch?v=eqhvg-39tgY |
||||
William Leue Guru ![]() Joined: 03/07/2020 Location: United StatesPosts: 405 |
I solved it another way: I separated the image generation and management from the collision detection. The images are now just blitted from an offscreen page, and the sprites' only job is to handle collision detection. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |