;; ASSUMES PROJECTILE or BREAKER OBJECT is #$03
;;; SOLID
;;;This is how to inform a solid collision.
;;; You can also add this to the end of
;;; any tile type if you want it to have an effect AND
;;; be treated like solid.
;;; You could also check to see if it is a non-player object,
;;; and only return solid if it's a not player. This would
;;; cause monsters to treat things like spikes or ladder or fire
;;; as solid while the player is able to interract with it.
LDA #TILE_SOLID
STA tile_solidity
;; if you want it solid, declare it at the end
LDA Object_type,x
CMP #$03 ;; is a projectile? Change this is you want to use a different object #.
BNE dontBreakThisBlock
checkWithCollisionTileTop:
LDA collisionPoint0
ORA collisionPoint1
BNE continueWithCollisionTileBottom
;; collision with the tile from top
LDA tileY
ADC #$08
STA tileY
continueWithCollisionTileBottom:
LDA collisionPoint2
ORA collisionPoint3
BNE continueWithCollisionTileLeft
;; collision with the tile from bottom :
LDA tileY
SBC #$08
STA tileY
continueWithCollisionTileLeft:
LDA collisionPoint0
ORA collisionPoint3
BNE continueWithCollisionTileRight
;; collision with the tile from left
LDA tileX
ADC #$08
STA tileX
continueWithCollisionTileRight:
LDA collisionPoint1
ORA collisionPoint2
BNE continueBreakingThisBlock
;; collision with the tile from right
LDA tileX
SBC #$08
STA tileX
continueBreakingThisBlock:
;;ChangeTileAtCollision #$00, underStomp
ChangeTileAtCollision #$02, underSecret
PlaySound #SFX_BREAKABLE_BLOCK
dontBreakThisBlock: