Advertisement
rubixcuber

Custom Sprite Hitboxes

Jan 23rd, 2020
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. To do custom hitboxes, check "Don't use default interaction with Mario" in the cfg editor.
  2. Note that this means the sprite will no longer damage the player on contact or anything like that, so you'll have to manually call the hurt Mario function upon detecting collision.
  3.  
  4. Then basically you just call these 3 functions like this
  5.  
  6. JSL $03B664 ;get player hitbox
  7. JSL $03B69F ;get sprite's hitbox
  8.  
  9. ;Here you can change the values like $06 and $07 listed below to manipulate the hitbox
  10.  
  11. JSL $03B72B ;compare hitboxes
  12. BCC NoContact
  13.  
  14. ;stuff to do when touching here
  15.  
  16. NoContact:
  17.  
  18. $03B664 59 bytes Subroutine (JSL) "Get player clipping" subroutine. Stores the clipping X displacement low byte to $00, the clipping X displacement high byte to $08, the clipping width to $02, the clipping Y displacement low byte to $01, the clipping Y displacement high byte to $09, and the clipping height to $03.
  19.  
  20. $03B69F 70 bytes Sprite subroutine (JSL) "Get sprite clipping A" subroutine. Stores the clipping X displacement low byte to $04, the clipping X displacement high byte to $0A, the clipping width to $06, the clipping Y displacement low byte to $05, the clipping Y displacement high byte to $0B, and the clipping height to $07.
  21.  
  22. $03B72B 49 bytes Sprite subroutine (JSL) "Check for contact" subroutine. Uses the values in scratch RAM set by $03B69F and either $03B6E5 or $03B664 (or occasionally custom values) to determine whether two sprites, or a sprite and the player, are in contact. If the carry flag is set after calling this, they are in contact.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement