Why is the appeared screen black when I start the scene?

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

I’m currently learning to use Godot. I am following the tutorial on their website. While making the game called “dodge the creeps” I ran into a problem. I’m almost done, I just finished the “main” scene and almost starting the part about HUD. The only problem is when I start the “main” scene, the resulting screen is black. I think this has to do with the error I get “The method “new_game” isn’t declared in the current class”. I don’t get what this means. Here is my current code of my “main” scene:

extends Node

export (PackedScene) var Mob
var score

func _ready():
randomize()
new_game()

func _on_StartTimer_timeout():
$MobTimer.start()
$ScoreTimer.start()

func _on_ScoreTimer_timeout():
score += 1

func _on_MobTimer_timeout():
$MobPath/MobSpawnLocation.offset = randi()
var mob = Mob.instance()
add_child(mob)
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
mob.position = $MobPath/MobSpawnLocation.position
direction += rand_range(-PI / 4, PI / 4)
mob.rotation = direction
mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
mob.linear_velocity = mob.linear_velocity.rotated(direction)

So the 2 questions are: why does my screen go black? and what does the error mean? Thanks in advance!

Edit:
I fixed it! The problem was that I didn’t have a function called “new_game” in my “main” scene. After I added that both of my problems were fixed!