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 : Checking for Sprites being hidden or displayed?
Author | Message | ||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Hi all. Is there any command that allows to check if a sprite is hidden or being displayed? I have a complex graphic screen with multiple sprites moving around. Occasionally, my program will unexpectedly exit with an "sprite already hidden" error. It would be great to check if a sprite is already hidden, before executing the Sprite hide command. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4223 |
Hi MarkF, I don't know of any command that you can use for this purpose. Since sprites do not hide autonomously, it is the code that hides the sprite. So keep track of the sprites visibility in an array "visible%(nbr_of_sprites)". When writing a sprite, set the cell to 1, when hiding it, set the cell to 0. Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9110 |
You can use the sprite function with X or Y. They return 10000 if the sprite is not being displayed Edited 2024-05-16 19:18 by matherp |
||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Thank you Volhout and Mather for your recommendations. As you mentioned this is a good solution.... SPRITE(X, [#]n) Returns the X-coordinate of sprite n. This function is only active when the sprite is currently displayed (active). Returns 10000 otherwise. |
||||
Print this page |