Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Bitplane collision detect
Posted by: Simon Sunnyboy / Paradize Jul,27.2010-18:41 

Today I thought about how to detect a collision while drawing a sprite. E.q. have a bitplane (nr 4) in the background set and use this to indicate a collision (drawinging over color 8-15 should trigger a collision detection)

While drawing the sprite, the onscreen bitplane is obviously read and masked with AND. Now I wondered if there was a simple thing to implement as a sideeffect to detect a set pixel that is masked away.

A clumsy approach might look like this but it takes way too many cycles...
assume a0 points to screen, a1 to mask data

move.w (a0),d0 ; fetch bitplane and store temporarily
move.w (a1)+,d1 ; fetch mask data (pixels to keep are 1, pixels to clear to OR the sprite in are 0)
and.w d1,0(a0)+ ; mask onscreen
; now:
neg.w d1 ; flip mask bits
and.w d1,d0 ; and the negated mask with the bitplane
bne collision_found ; if any bit is still set we found a pixel based collision



Any ideas or suggestions? I am thinking of a generic approach here...

cheers,
ssb







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
Bitplane collision detect Simon Sunnyboy / Paradize Jul,27.2010-18:41
  Re: Bitplane collision detect Simon Sunnyboy / Paradize Jul,27.2010-18:57
    Re: Bitplane collision detect ggn Jul,28.2010-20:10
      Re: Bitplane collision detect Simon Sunnyboy / Paradize Jul,29.2010-18:56
        Re: Bitplane collision detect ggn Jul,30.2010-18:53


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson