Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:39 25 Nov 2024 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 : Checking for Sprites being hidden or displayed?

Author Message
MarkF
Regular Member

Joined: 01/08/2023
Location: Australia
Posts: 47
Posted: 06:19am 16 May 2024
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 4223
Posted: 07:10am 16 May 2024
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9110
Posted: 07:48am 16 May 2024
Copy link to clipboard 
Print this post

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: Australia
Posts: 47
Posted: 12:59am 17 May 2024
Copy link to clipboard 
Print this post

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


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

© JAQ Software 2024