BBC BASIC for Windows
Programming >> Graphics and Games >> Sprite detection
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1502106006
Sprite detection
Post by CliveB on Aug 7th, 2017, 11:40am
I have 16 sprites each of a different colour and non-rectangular shape. I can detect the location of each by checking x & y coordinates but this does not distinguish between visible and transparent regions of the sprite. I want to be able to detect the sprite by clicking on the visible part. Detection must not occur (as it does with x & y coords) if I click on the transparent part. I have noticed that POINT(x,y) and TINT(x,y) both return the colour underneath the sprite, not the colour of the sprite. How can I do this?
Re: Sprite detection
Post by michael on Aug 7th, 2017, 3:37pm
If you prefer a sprite only condition then you will need to speak to Richard to see if there is a solution.
http://bbcbasic.conforums.com/
You may consider using *DISPLAY if you choose to allow BBC to see the color. There is also *SCREENSAVE
(But then you would have to keep doing captures and overlays. which would be inefficient)
I'm sure there are many techniques, like my introduced way of detection called Echo Detection. If you look at buttonz in the RETROLIB 10 in TOOLS, you can see how this can work. Echo the known colors of your sprite when the mouse enters the work area and make the sprite react depending on the mouse conditions.
The correct active color will always be active using this method and it can be done efficiently.
I don't quite see why you would want to detect the sprite color though, as it should be known once you enter its borders and can be defined in an echo style programming technique.