Digging

Hello all,

I was thinking on adding a shovel to dig with in my game and thought Hmm how would that work?

the Shovel would be and extra weapon (effect) then it would have to connect to a tile type so when you got the right tiles so I guys it could be used as a breakable block ? But I would like it where you can walk over it like in Legend of zelda strike it with your shovel to reveal a prize.

So you would have to turn solid collision off for the block? But then what issues would that create?

Thanks for reading
 

Bucket Mouse

Active member
You're on the right track. It would simply be a breakable block but both states would be non-solid. You'd map the shovel to a button; the code would say that if you pressed the button over that specific tile, the tile would change to the "Dug" version. This would take some ASM tinkering, especially if you want prizes to appear at random -- that'd be more complicated.

Note that the holes you dig would undo themselves if you walked offscreen, but that was the case in Zelda too.
 

TolerantX

Active member
just an idea. couldn't you make a block that is destroyed by weapon object maybe 3 for example. and have the weapon animate under the player (input that triggers on pressing down AND A or B which ever button you assign to it)?
 

mouse spirit

Well-known member
Right. A breakable block(tile) that you can walk on and only breaks if using shovel.
So maybe combine a breakable tile script, make that asset or tile walkable, also in the script say but
only break when using player object...3 or something.Now have player object 3 be the shovel and have it as you current weapon.


This is from a 4.1.5 script,just an example
Code:
;; 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
	
	
	ChangeTileAtCollision #$00, underStomp
	;PlaySound #SFX_BREAKABLE_BLOCK
	
	
dontBreakThisBlock:
 
Top Bottom