Parser Error: Identifier not found: Mouse

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Noob_Maker
:warning: Old Version Published before Godot 3 was released.

I’m making a script so that I can have the ability to have all of my nodes to know if the mouse is hovering. The way I’m planning to do this is to have a script for the main node to be checking for a child node(I named it Cursor) that will follow the mouse throughout the game and that node will be entering into Area2Ds of other nodes to allow interactions for only for the nodes that are being hovered by the mouse.
The problem that I have is that for some weird reason the main node’s code cannot find that “Cursor” node. The error is this:

Parser Error: Identifier not found: Mouse

I dunno what’s wrong. Here’s the code, btw:

extends Node2D

var Click = Input.is_action_pressed("Interaction")

func _ready():
	Mouse = get_node("Crusor")
	Block = get_node("Block")
	areaBlock = get_node("Block/Area2D")
	set_fixed_process(true)
func MouseHover():
	if areaBlock.body_enter(Mouse):
		return true
	else:
		return false
func _fixed_process(delta):
	if MouseHover() == true:
		#this is where I'll put a command on send a Broadcast/Signal 
		#I dunno what it's called on Godot but it's a thing that sends a message to all of the nodes
		#and once the nodes recieve the message will make them do stuff
		#For example"if message 'Bla-Bla!' is recieved, do Bla-Bla"

Hi there! I noticed that in your code, you may have misspelled Cursor.

It is possible that is how you chose to spell your Node, but I figured I would confirm with you to be sure since I usually spell it “cursor”. :smiley:

You typed it as:

func _ready():
    Mouse = get_node("Crusor")

maybe this is what is causing the error?

EsterD | 2018-09-16 00:44

:bust_in_silhouette: Reply From: eons

You have put

Mouse = get_node("Crusor")
Block = get_node("Block")
areaBlock = get_node("Block/Area2D")

But you never said what Mouse, Block and areaBlock are.

If these are variables for the instance, you need to define them like you defined Click (that will almost always be false, by the way).
If are variables that belongs to a specific function or block, define them inside that function or block.