How to make the portal appear only when the boss is dead ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Scavex

Hello guys I wanted to know that how can I actually make a portal appear or function only when the boss dies. For example in my case I have a boss who the player can skip and go to portal to reach the next level and that’s not what I intend. I want the player to defeat he boss and only then he can use the portal.
Here’s the Portal Script :

extends Area2D

export(String,FILE,"*.tscn")var TargetScene

func _ready() -> void:

func _on_ChangeStage_body_entered(body: Node) -> void:
	if "Player" in

Here is the Boss Script :

extends KinematicBody2D
const GRAVITY =10
export(int) var SPEED =20
const FLOOR=Vector2(0,1)
var velocity=Vector2()
export(String,FILE,"*.tscn")var TargetScene

var direction=1

var is_dead=false
export(int) var hp=30

func _ready() -> void:
	pass # Replace with function body.

func dead():
	if hp<=0:

func _physics_process(delta):
	if is_dead==false:
		if hp<=15:
		if direction == 1:
		velocity=move_and_slide(velocity, FLOOR)
	if is_on_wall():
	if $RayCast2D.is_colliding()==false:
	if get_slide_count()>0:
			for i in range(get_slide_count()):
				if "Player" in get_slide_collision(i)

func _on_Timer_timeout() -> void:
func _on_Long_Jump_body_entered(body: Node) -> void:

I tried doing various things and got error every single time.

:bust_in_silhouette: Reply From: Mrwaffleman

I am not at all experienced but what I do know is that you might want to try a “disabled” script. Like $portal.disabled = true when the boss is alive and when it’s dead you do a false.
I not good at explaining but hope this helped

Thank you my friend. Even though I didn’t exactly followed this, your message helped me to solve my prob. I just made a Boolean in portal script and set it to false and changed it to true once the boss was dead. This Worked !

Scavex | 2020-05-27 16:32

Can you please send the script if I wanna use it for a Future project

Mrwaffleman | 2020-05-27 16:44