+1 vote

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():

func onStartTimer_timeout():

func onScoreTimer_timeout():
score += 1

func onMobTimertimeout():
$MobPath/MobSpawnLocation.offset = randi()
var mob = Mob.instance()
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
mob.position = $MobPath/MobSpawnLocation.position
direction += randrange(-PI / 4, PI / 4)
mob.rotation = direction
velocity = Vector2(randrange(mob.minspeed, mob.maxspeed), 0)
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!

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!

Godot version 3.2.3
in Engine by (13 points)

Please log in or register to answer this question.

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.