Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | User457654654 |
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)
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
jgodfrey | 2020-06-08 14:35