cosmic/scripts/StarterBaseMenu.gd
Алкесей Мирнеков 3411c5796d
Initial commit (1/2)
2023-11-05 16:23:18 +03:00

24 lines
631 B
GDScript

extends Area2D
@export var Menu : PackedScene
@onready var BaseCollider = $"../BaseCollider/BaseColliderDetector"
var MenuInst
func onbcbodyentered(body):
if body is MainShip:
body.MSEngine.Speed = 0
func _on_body_entered(body):
if body is MainShip:
body.AllowShooting = false
MenuInst = Menu.instantiate()
#get_tree().current_scene.add_child(MenuInst)
body.find_child("GUI").add_child(MenuInst)
#MenuInst.global_position = body.global_position# - Vector2(640, 360)
MenuInst.modulate = get_parent().modulate
func _on_body_exited(body):
if body is MainShip:
body.AllowShooting = true
MenuInst.queue_free()