Jump to content





pixel perfect collision detection

Posted by SpiceWare, in Frantic 14 August 2011 · 1,405 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).
Attached Image

Touching
Attached Image

Evil Otto collides with humanoid
Attached Image

Evil Otto collides with 3 sprites
Attached Image

Humanoid collides with 3 sprites
Attached Image

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.

Attached Image

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
Attached File  frantic_harmony20110814.bin (32KB)
downloads: 145

ROM w/Time Remaining
Attached File  frantic_harmony20110814_TR.bin (32KB)
downloads: 99

Source
Attached File  Frantic20110814.zip (525.51KB)
downloads: 144




Sweet. :thumbsup:
  • Report
That looks really gorgeous!
  • Report

Search My Blog

Recent Entries

Recent Comments

Latest Visitors

1 user(s) viewing

0 members, 1 guests, 0 anonymous users