Breakable dirt tiles based on player collision

grhmhome

New member
Hello again. I was thinking of making a digger style arcade game and wonder what would be the best way of making a new object type that gets destroyed based on player collision? I was thinking of making a dirt object that would act like a solid for anything that is not a player, like enemies, or rocks, but a player colliding with the dirt would delete/destroy that tile.

Thanks for your time,
grhmhome
 

dale_coop

Moderator
Staff member
Yeah, you could make a custom DiggerTile.asm script, something like:
Code:
;;; SOLID until the player touchs it, it becomes null (understomb in "Graphic Bank/Special Tiles")

	LDA #TILE_SOLID
	STA tile_solidity
	
	;; if player :
	CPX player1_object
	BNE dontBreakThisDirtTile
	
	; BREAK the TILE :
	LDA #$00
	STA tile_solidity

	ChangeTileAtCollision #$00, underStomp
	;; PlaySound #SFX_DIRT_TILE

dontBreakThisDirtTile:

And assign it to an unused tile collision type in he Project Settings > Script Settings.
 
Top Bottom