Dodge the creeper tutorial

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

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


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.

:bust_in_silhouette: Reply From: kidscancode

“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:

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.

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

DylFar 25 | 2020-01-01 21:13

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

kidscancode | 2020-01-01 21:18