Jump to content
Sign in to follow this  
Eisengrim

Logic of HIT_BACKGROUND

Recommended Posts

I need help understanding how IntyBasic's HIT_BACKGROUND works. I thought that for any individual screen card, the 'on' bits are the foreground and 'off' bits are the background. When I experiment with HIT_BACKGROUND I get inconsistent results - sometimes a sprite hits what I think of as background, sometimes it doesn't. I've looked at nanochess's Barzack game, where the rooms are drawn with DATA statements, and it looks like HIT_BACKGROUND is detecting the 1s in the data blocks, not the 0s. Can someone explain how HIT_BACKGROUND determines what is really the background, and if it differs in FGBG vs Color Stack modes?

  • Like 1

Share this post


Link to post
Share on other sites

The BACKGROUND in  HIT_BACKGROUND refers to BACKTAB, aka. the grid of 20 × 12 tiles. (BACKTAB stands for background table. It's the name either GI, APh, or Mattel gave it.)

 

It doesn't mean "pixels assigned a background color," but I can see how you might have thought it would.

 

The hardware collision detection looks for on pixels (1 in the bitmap) in the BACKTAB. IntyBASIC just reports the hardware collision info. If you use any colored-squares pixels, colors 0 through 6 count as on, and 7 counts as off.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, that helps me understand how it's supposed to work. I'm drawing my screen with data statements, most of which is a black screen with value $0000. What I'm seeing is Sprite 0 will detect with HIT_BACKGROUND if it hits most screen elements other than $0000, but will cruise right through a screen element with value $0200 (a blue block). Is that because the block is considered full of 'off' pixels?

Edited by Eisengrim
typo

Share this post


Link to post
Share on other sites

Yes, $0200 will plot a blank space with blue background so all pixels are "off". If you are using Color Stack mode, I believe you have an entirely filled character at \095. If you are working in BG/FG mode, you need to define your own $FFFFFFFFFFFFFFFF character and plot it with blue foreground in order for it to work.

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...