Prepared Movement behaviour. Fixed multi-tile placement bug
This commit is contained in:
parent
62eef907d3
commit
397082f966
17 changed files with 395 additions and 75 deletions
|
|
@ -15,6 +15,8 @@ var is_moving: bool = false
|
|||
|
||||
var map_reference: HexGrid
|
||||
|
||||
var is_active: bool = true
|
||||
|
||||
const BUILD_GHOST = preload("res://InsectTiles/BuildGhost.tscn")
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
|
@ -28,14 +30,17 @@ func _ready():
|
|||
GameEvents.insect_placed.connect(_on_insect_placed)
|
||||
|
||||
func _on_insect_tile_moved(tile: InsectTile, to: Vector4i) -> void:
|
||||
is_active = false
|
||||
queue_free()
|
||||
|
||||
func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) -> void:
|
||||
is_active = false
|
||||
queue_free()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if Input.is_action_just_pressed("place_tile"):
|
||||
#func _process(delta):
|
||||
func _input_event(camera, event, position, normal, shape_idx):
|
||||
if Input.is_action_just_pressed("place_tile") and is_active:
|
||||
if hovered:
|
||||
if is_moving:
|
||||
GameEvents.insect_tile_moved.emit(insect_tile, coordinates)
|
||||
|
|
@ -50,10 +55,8 @@ func _on_mouse_entered():
|
|||
tile.is_black = is_black
|
||||
tile.map_reference = map_reference
|
||||
|
||||
|
||||
add_child(tile)
|
||||
|
||||
|
||||
func _on_input_event(camera, event, position, normal, shape_idx):
|
||||
pass # Replace with function body.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue