News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] Enemy collision detection/hitboxes

Started by Qactis, December 24, 2011, 12:46:44 AM

Previous topic - Next topic

Qactis

I don't know anything about either one, which is stopping me from working on these doors. Can anyone point me to any documentation/notes or can help?


Qactis

#2
Specifically, this is for a "door" enemy, which will not be moving (or will it?), so the hitbox is a piece of cake (8-16 x 16-64px) and there is no enemy-block collision needed (I think?).

[spoiler=Guess you were referring to]
Enemy routines:
A0:9758 (JSR) Interaction with Samus, depends on $0F88,X's 2 bit. If set:(projectiles: JSR $9B7F, bombs: JSR $9D23, Samus: JSR $9A5A) Not set:(projectiles: JSR $A143, bombs: JSR $A236, Samus: JSR $A07A)

Samus shoots with said beam or bombs, set certain bit and JSR.

A0:9B7F (JSR) Check for collisions of all of the enemy's sprites/hitboxes in $0F8E with all projectiles. If there's a collision, JSL $A09D17 then RTS.
A0:9D17 Small routine, just JML to code for enemy/projectile detection. Address used is at (($0F8E,X),(8*n1)),(C*n2). n1 = sprite number, n2 = hitbox number
A0:9D23
A0:A07A
A0:A143 (JSR) Check for collisions of main hitbox with all projectiles. If there's a collision, JSL $A0A226 then RTS.
A0:A226 Small routine, just JML to code for enemy/projectile detection. Address used is projectile pointer in enemy rom ($0F78 + 32)
A0:A236
A0:A3AF Death animation
A0:A63D A common hit routine, I think. JSR $A6DE, display the 'hit' graphic if applicable. If enemy is at 0 health, set 7E:7002,X to the projectile type ($0C18,Y, AND #$0F00), and play the death animation (JSL $A0A3AF)
A0:A6DE (JSR) Handles beam damage, freezing, and sound.
[/spoiler]

Does anyone have any examples of how they set up an enemy?