Hello Godot community,
I've been following a Godot 3.5 tutorial to create a game, but I'm using Godot 4. I'm facing an issue where I don't see any output in the debug console, and no obstacles are being spawned in my game.
Expected behavior: When the game starts, I expect to see three random numbers printed in the debug console, and an obstacle should be spawned at a random y position on the screen every time the timer expires.
Debug Console Output Issue:
I have enabled the "Print" flag in the debug console.
When running the game, the output is empty.
Obstacle Spawning Issue:
My script is attached to the correct node in my scene.
The "timer" node is set to call the "_on_timer_timeout()" function.
The obstacle scene is preloaded correctly.
Error Messages:
E 0:00:01:0415 load: res://obstacle_spawner.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://ObstacleSpawner.gd
E 0:00:01:0415 _load: Failed loading resource: res://obstacle_spawner.tscn. Make sure resources have been imported by opening the project in the editor at least once.
E 0:00:01:0416 set_path: Another resource is loaded from path 'res://obstacle_spawner.tscn' (possible cyclic resource inclusion).
Here's my script:
extends Node2D
@onready var timer = $Timer
var obstacle = preload("res://Enviorment/obstacle.tscn")
func _ready() -> void:
randomize()
print(randi() % 4)
print(randi() % 4)
print(randi() % 4)
func _on_timer_timeout() -> void:
spawn_obstacle()
func spawn_obstacle() -> void:
var new_obstacle = obstacle.instance()
add_child(new_obstacle)
new_obstacle.position.y = randi() % 400 + 150
I think the differences between Godot 3.5 and 4 might be causing the issue. I'd appreciate any insights and guidance on resolving the debug console and obstacle spawning issues in Godot 4. Thanks in advance!
iv been using chatgpt to help me get past this tutorial but so far im just running in a loop,
the tutorial im following is https://www.udemy.com/course/flappy-bird-godot/
any help and ideas will be appreciated as im hung up on this part of the tutorial and am struggling to make it past