21 lines
479 B
GDScript
21 lines
479 B
GDScript
extends Area2D
|
|
|
|
var overlapping : bool
|
|
var shift_tween : Tween
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if overlapping:
|
|
return
|
|
if body == Game.player:
|
|
overlapping = true
|
|
shift_tween = create_tween()
|
|
shift_tween.tween_property(self, "modulate:a", .5, .25)
|
|
|
|
|
|
func _on_body_exited(body: Node2D) -> void:
|
|
if !overlapping:
|
|
return
|
|
if body == Game.player:
|
|
overlapping = false
|
|
shift_tween = create_tween()
|
|
shift_tween.tween_property(self, "modulate:a", 1.0, .25)
|