remove redundant atlas id code
This commit is contained in:
parent
a103f080c6
commit
7047899f35
1 changed files with 1 additions and 4 deletions
|
|
@ -5,7 +5,6 @@ signal block_hit(tile_pos: Vector2i, hits_left: int)
|
|||
signal block_destroyed(tile_pos: Vector2i)
|
||||
|
||||
## Atlas in which the destructable blocks are stored.
|
||||
@export var block_source_id: int = 4
|
||||
@export var max_hits: int = 4
|
||||
|
||||
var hit_counts: Dictionary[Vector2i, int] = {}
|
||||
|
|
@ -14,8 +13,6 @@ var hit_counts: Dictionary[Vector2i, int] = {}
|
|||
## Returns true if block is destroyed.
|
||||
func hit_tile(coords: Vector2i) -> bool:
|
||||
var source_id: int = get_cell_source_id(coords)
|
||||
if source_id != block_source_id:
|
||||
return false # not destructible
|
||||
|
||||
var current_atlas: Vector2i = get_cell_atlas_coords(coords)
|
||||
var row: int = current_atlas.y
|
||||
|
|
@ -31,7 +28,7 @@ func hit_tile(coords: Vector2i) -> bool:
|
|||
else:
|
||||
# damage
|
||||
var new_atlas: Vector2i = Vector2i(hits, row) # column=hits, row=same color
|
||||
set_cell(coords, block_source_id, new_atlas)
|
||||
set_cell(coords, source_id, new_atlas)
|
||||
hit_counts[coords] = hits
|
||||
block_hit.emit(coords, max_hits - hits)
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue