Bombs game ending, and debugging.
This commit is contained in:
@ -4,14 +4,25 @@ var follower = false
|
||||
|
||||
func _ready() -> void:
|
||||
follower = true
|
||||
if name.contains("Mine"):
|
||||
get_node("CharacterBody2D/AnimatedSprite2D").connect("animation_finished", Callable(self, "Remove_Mine"))
|
||||
set_process_input(true)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if follower:
|
||||
position = get_viewport().get_mouse_position()
|
||||
|
||||
func get_if_moving_state():
|
||||
return follower
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
if abs(position) <= get_viewport().get_mouse_position():
|
||||
follower = false
|
||||
|
||||
func Explode_Mine() -> void:
|
||||
get_node("CharacterBody2D/AnimatedSprite2D").scale = Vector2(1,1)
|
||||
get_node("CharacterBody2D/AnimatedSprite2D").play("Explode")
|
||||
|
||||
func Remove_Mine() -> void:
|
||||
queue_free()
|
||||
|
Reference in New Issue
Block a user