Ok... let's say the breakable tile type is #$0E (Tile Collision 14).
Your BreakableBlock.asm script assigned to your "Tile Collision 14" should be:
Code:
LDA #TILE_SOLID
STA tile_solidity
;; if you want it solid, declare it at the end
LDA Object_type,x
CMP #OBJECT_PLAYER_PROJECTILE ;; is a projectile? Change this is you want to use a different object #.
BNE dontBreakThisBlock
ChangeTileAtCollision #$00, underStomp
PlaySound #SFX_BREAKABLE_BLOCK
dontBreakThisBlock:
(breaks the blocks with projectiles object in this case, but you could check for others objects if you have different ones).
Now for the Sprite weapon... modify the script assigned to the "Handle Sprite Weapon" in the "Project Settings > Script Settings", at the end, just after the
"skipSpriteWeaponCheck" line (it might be currently the last line of your script), add this block of code:
Code:
;; CHECK FOR Breakable Blocks collisions
GetCurrentActionType player1_object
CLC
CMP #$03 ;; player currently attacking?
BEQ +
JMP skipSpriteWeaponCheckBreakableTiles
+
LDA selfRight
SEC
SBC selfLeft
LSR
ADC selfLeft
STA tileX
LDA selfBottom
SEC
SBC selfTop
LSR
ADC selfTop
STA tileY
JSR GetTileAtPosition
LDA Object_scroll,x
AND #%00000001
BNE +
LDA collisionTable,y
JMP ++
+
LDA collisionTable2,y
++
CLC
CMP #$0E ;; <-- HERE: the breakable tile type (for this example, I use the 14)
BNE skipSpriteWeaponCheckBreakableTiles
ChangeTileAtCollision #$00, underStomp
PlaySound #SFX_BREAKABLE_BLOCK
skipSpriteWeaponCheckBreakableTiles:
This code checks if the drawn weapon (sprite) collides with a breakable tile (cf the comment "HERE" at the end for the tile type comparison). I used the type 14 for my test, so I check against #$0E.
If collision, the code executes the same code than the breakable tile script (the same ChangTtileAtCollision and the PlaySound).
I hope it will help your project.