0 votes

The tutorial got me totally lost at the part of Main script.

Says

drag mob.tscn from filesystem panel and drop it in the mob property under the script variables of the main node.

I can't see any window that is named script variables, but could see one tab listing function, so dragged there, which basically listed my Mob script. Not sure if that was the goal. Mob property(missing this meaning? Properties are on the right side), under script variables(the window middle bottom with function?) of the main node(everything here is related to main node, since that is the scene I am currently in?).

Next, click on the Player and connect the hit signal. So clicked, pressed connect, then the window appears, press connect again and it drops function

func _on_Player_hit():
    pass # Replace with function body.

Then it just carries on: we want to make new function named game_over(). So I just leave that there and continue writing code below it?

I understand the next parts, but those two mentioned just went pass me, can't understand what I don't understand.

asked Dec 30, 2019 in Projects by Gato (12 points)

1 Answer

0 votes

"Script variables" appear in the Inspector when your script has export variables defined. You would have seen this earlier in the project when you first made the player's script and did export var speed, as shown in the screenshot in that section:

https://docs.godotengine.org/en/latest/_images/export_variable.png

Since our main script contains the line export (PackedScene) var Mob, we'll see a "Mob" property appear there in the Inspector when the "Main" node is selected.

For the second thing, it told you here:

Type “game_over” in the “Method In Node” box at the bottom of the “Connecting Signal” window.

But you clicked "Connect" before doing that. Since you didn't tell it to name the new function game_over it used the default name which is _on_Player_hit.

answered Dec 30, 2019 by kidscancode (13,244 points)

Then what should be included in the script so that variable is visible in the inspector tab.

I just wrote it in the answer above. export (PackedScene) var Mob, which is the second line of the main script.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.