Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Liam Steyn |
I was following a tutorial on the godot website and came across this error
This is the code so far:
extends Node
export(PackedScene) var mob_scene
var score
func _ready():
randomize()
new_game()
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():
var mob_spawn_location = get_node(“MobPath/MobSpawnLocation”);
mob_spawn_location.offset = randi()
var mob = mob_scene.instance()
add_child(mob)
var direction = mob_spawn_location.positon + PI / 2 #This is where the error
mob.position = mob_spawn_location.position #occurs.
direction += rand_range(-PI / 4, PI / 4)
mob.rotation = direction
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
mob.linear_velocity = velocity.rotated(direction)