Melee Block (Breakable) in 4.1.5 Basic Adventure Module

I'm trying to make use of two types of breakable blacks, one breakable by projectiles and one by melee attacks. I am using Tile script "MagicBlock" for projectiles and it works great, but I am trying to make a "MeleeBlock" code using the MagicBlock as my base. Does anyone know how I'd get the MeleeBlock to detect melee attacks (horizontal and vertical)? In my attempts, I've only been able to make the block breakable by my character by just walking into the block. Thanks.
 

Attachments

  • Breakable Block.JPG
    Breakable Block.JPG
    102 KB · Views: 896

dale_coop

Moderator
Staff member
Is your melee an game object (using the OBJECT_PLAYER_MELEE user constant)? or is it the sprite based sword?
 

dale_coop

Moderator
Staff member
If your weapon is the Mele game object, I think something like that should work (checking the type/id of the object):

Code:
	LDA #TILE_SOLID
	STA tile_solidity
	
	LDA Object_type,x
	CMP #OBJECT_PLAYER_MELEE ;; is it player Melee weapon?
	BNE + 
	;; destroy this block.
	ChangeTileAtCollision #$00, #$00
	PlaySound #SND_BREAK
	; TriggerScreen screenType
+
 

dale_coop

Moderator
Staff member
If your weapon is the sprite based sword, maybe something like that:
http://nesmakers.com/viewtopic.php?p=18078#p18078
 
Thanks Dale. Yeah saw the sprite based version but my game is melee. I'll try your code for melee tonight. If it works it'll cut down on some back tracking in my game and open up possibilities for more levels or secret dungeons. Actually. I think I've tried that and thats what makes block breakable by just walking into it. I'll check tonight.
 
dale_coop said:

SO, I actually did have sprite based weapons. I tired the sprite based code in the link you sent, but it is not working for me. At least now that I know I'm using sprite base, and I can continue working with the code and hopefully find a solution. Thanks Dale.

Here's a though, I am currently using the MagicBlock asm for blocks breakable by projectiles and that works fine. How would I change the "AND #%00000100" to check if it's melee attack rather than player magic?

Code:
;;; 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
	
	LDA Object_flags,x
	AND #%00000100 ;; is it player magic?
	BEQ +
	;; destroy this block.
	ChangeTileAtCollision #$00, #$00
	PlaySound #SND_BREAK
	; TriggerScreen screenType
+
	
	;; if you want it solid, declare it at the end
 
Top Bottom