Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:59 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Toggling Sprite Images

Author Message
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 405
Posted: 09:30pm 27 Oct 2022
Copy link to clipboard 
Print this post

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 States
Posts: 197
Posted: 03:47am 28 Oct 2022
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 5091
Posted: 06:26am 28 Oct 2022
Copy link to clipboard 
Print this post

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: Germany
Posts: 1234
Posted: 07:19am 28 Oct 2022
Copy link to clipboard 
Print this post

  Volhout said  Martin H combines 2 sprites in one. This only works for symetrical prites though.
The left half is sprite 1, the right half is sprite 2.
Not sure if that helps in any way. He used it in "on the road".
Volhout

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 States
Posts: 405
Posted: 12:46pm 28 Oct 2022
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2567
Posted: 08:34pm 29 Oct 2022
Copy link to clipboard 
Print this post

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 States
Posts: 405
Posted: 12:44pm 04 Nov 2022
Copy link to clipboard 
Print this post

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.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025