Database.gd
player.gd
slot.gd
âAttempt to call function [âŚ] on a null instanceâ means the variable the function is called on is null. In your case the player
variable is null. This can happen for several reasons.
You are setting player @onready var player = get_tree().current_scene.find_child("player")
to the result of find_child
and that is not giving an error, but it is returning null. This usually means the node you are looking for could not be found by name. Make sure the name matches and the node exists when this Button is created. You may want to make this call deferred or otherwise called later in the process.
âInvalid call to funcion [âŚ] Expected 0 argumentsâ means you called a function with the wrong amount of arguments. In this case, your use_item()
function takes no arguments, but you called it with an argument, so it tells you that either youâre calling the wrong function or youâre calling the correct function with the wrong data.
Just about the last mistake. I decided to create another test project where I did everything according to the video from scratch, but instead of sprite2d FX I added Node2D Database with my own code. I canât figure out which function to use instead of fx
Here are two scripts from the video about this function and can be compared with my screenshots:
Player - player - Pastebin.com
Slot - slot - Pastebin.com
Oh, yes! I was able to fix it! Thanks
However, I would like to know how to separate them?
I have an idea