Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Rymfire |
Hello world!
I just started using Godot Engine. Until here, I’m having fun during development of my game. I’ve been following this tutorial to do a very simple / first game.
During episode 4, I’ve encountered a compilation bug for my ‘Main.gd’ script concerning my Mob : “Identifier ‘Mob’ is not declared in the current scope”. Here is my code :
func _on_MobTimer_timeout():
$MobPath/MobSpawnerLocation.set_offset(randi())
var mob = Mob.instance()
add_child(mob)
var direction = $MobPath/MobSpawnLocation.rotation
mob.position = $MobPath/MobSpawnLocation.position
direction += rand_range(-PI/4, PI/4)
mob.rotation = direction
mob.set_linear_velocity(Vector2(rand_range(mob._minSpeed, mob._maxSpeed), 0).reatated(direction))
The line that causes the problem is this one :
var mob = Mob.instance()
It must be a beginner error but I can’t find it… Can someone save me?