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()
newgame()
func onStartTimer_timeout():
$MobTimer.start()
$ScoreTimer.start()
func onScoreTimer_timeout():
score += 1
func onMobTimertimeout():
$MobPath/MobSpawnLocation.offset = randi()
var mob = Mob.instance()
addchild(mob)
var direction = $MobPath/MobSpawnLocation.rotation + PI / 2
mob.position = $MobPath/MobSpawnLocation.position
direction += randrange(-PI / 4, PI / 4)
mob.rotation = direction
mob.linearvelocity = Vector2(randrange(mob.minspeed, mob.maxspeed), 0)
mob.linearvelocity = 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!