cosmic/scripts/misc/BaseMenuOpen.gd
2023-11-13 17:13:36 +03:00

25 lines
610 B
GDScript

extends Area2D
@export var menu : PackedScene
@onready var base_collider = $"../BaseCollider/BaseColliderDetector"
var menu_inst
func onbcbodyentered(body):
if body is MainShip:
body.engine.speed = 0
func _on_body_entered(body):
if body is MainShip:
body.allow_shooting = false
menu_inst = menu.instantiate()
menu_inst.modulate = get_parent().modulate
menu_inst.base = get_parent()
body.find_child("GUI").add_child(menu_inst)
body.minimap.visible = false
func _on_body_exited(body):
if body is MainShip:
body.allow_shooting = true
body.minimap.visible = true
menu_inst.queue_free()