Jump to content
  • entries
    657
  • comments
    2,692
  • views
    898,493

pixel perfect collision detection


SpiceWare

2,337 views

The routines now report a collision only when sprite pixels overlap.

 

I've modified the joystick routines to use the right joystick to move Evil Otto. When he's moved the score will turn green to denote that his collisions are the ones being displayed.

 

 

Not touching (technically this should be touching - but the revolving eye is not stored as part of the sprite image).

blogentry-3056-0-15880700-1313340078_thumb.png

 

Touching

blogentry-3056-0-40609300-1313340086_thumb.png

 

Evil Otto collides with humanoid

blogentry-3056-0-93539800-1313340091_thumb.png

 

Evil Otto collides with 3 sprites

blogentry-3056-0-04248800-1313340098_thumb.png

 

Humanoid collides with 3 sprites

blogentry-3056-0-05107000-1313340104_thumb.png

 

For those experimenting with the source, I've finished the OPTIMIZE routines. Set OPTIMIZE = 1 and the time remaining (value in INTIM) for Vertical Blank(blue) and Over Scan(red) will be displayed below the score. E(14 in decimal) is left for VB while 16 (22) remains for OS. VB must have at least 7 left (it's the time required to refill the Digital Sample Buffer), so theres really only 7 available for VB.

 

blogentry-3056-0-86027300-1313341117_thumb.jpg

 

Note: OPTIMIZE isn't helpful with Stella as Stella doesn't emulate the time required to run ARM code. Stella reports 1A (26) and 16 (22) for VB and OS. The difference between Stella and actual hardware can be used to tell us how long the ARM routines take to run. For VB 1A-0E = C, so the ARM code is taking 12x64*=768 cycles (6507 cycles that is) of time, or about 10 scan lines.

*we're using TIM64T so each tick of INTIM represents 64 cycles.

 

 

 

Next up will be detecting collisions with the playfield. After that I'll work on the missile collisions - they should work using the current collision routines, I just need to create "sprite images" that are shaped like the missiles.

 

ROM

frantic_harmony20110814.bin

 

ROM w/Time Remaining

frantic_harmony20110814_TR.bin

 

Source

Frantic20110814.zip

2 Comments


Recommended Comments

Guest
Add a comment...

×   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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...