Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ShivamS28 |
Hi im new and i have a global autoload script which has a variable called player health
and in my enemy script when the player collides with it -= the player_health var in the global script.
and in the global script it has process function which has a if player_health <= 0:
get_tree.reload_current_scene()
so the issue is when the health reaches 0 it reloads the scene but the player and enemies cant move and the fps drops to 22
Also theres no errors in the console
Heres the code
extends Node
var crosshair = load('res://assets/cursor.png')
var player_health = 100
func save():
pass
func load_game():
pass
func _ready():
Input.set_custom_mouse_cursor(crosshair)
func _process(delta):
if player_health <= 0:
get_tree().reload_current_scene()
plz help,