The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Apologies for the newbie question. I just started working on Godot, and this happened to me twice. I was working on the tut "Your First Game" in the docs. I made it up to the point where I was working on the Main Node, and was about to start the HUD. I tested the game, as instructed, and I get a blank screen? I removed that project yesterday, and redid it today and got the same result. No Player, no Mobs. I am using the latest stable release of Godot. Here is the code for Main, as this one is most likely the issue.I wish I could tell you more, but I don't have a clue what I did. Any help, please? Thanks.

extends Node


export (PackedScene) var Mob
var score


# Called when the node enters the scene tree for the first time.
func _ready():
    randomize()
    new_game()


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#   pass


func game_over():
    $ScoreTimer.stop()
    $MobTimer.stop()

func new_game():
    score = 0
    $Player.start($StartPosition.position)
    $StartTimer.start()

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)
in Engine by (26 points)

Are you sure you're starting the correct scene? You can start either the scene designated as the "Main" scene via F5 or the Play button, or you can start the current scene via F6 or the Play Scene button.

I'd guess that you're starting the wrong scene, either because you've designated the wrong scene as Main or you're starting some other (incomplete?) scene via F6.

You can see/change the designated Main scene via:

Project | Project Settings | Application | Run | Main Scene

1 Answer

0 votes

Jgodfrey, you were right. Thanks. For some reason, when I pressed Play, it kept starting Player.

by (26 points)
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 Frequently asked questions and 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 [email protected] with your username.