Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Darkfloid |
Hey everybody I have problem in the Tutorial where I can make a game called dodge the creeps. I have already my entire code but when I want run the game, the debugger says that the start function isnt defined. I’ve searched everything through for a mistake but I cant find anything. I hope you can help me. Below is a screenshot of my screen and also my code.
Thanks for your help!
extends Node
export (PackedScene) var Mob
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():
$MobPath/MobSpwanPoint.offset = randi()
var mob = Mob.instance()
add_child(mob)
var direction = $MobPath/MobSpwanPoint.rotation + PI / 2
mob.position = $MobPath/MobSpwanPoint.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)
Your image is broken.
Regardless, if the error message is that start()
is not defined, the only place it is called is in new_game()
:
$Player.start($StartPosition.position)
start()
is defined on the player, so you need to look in the Player.gd script to see what the problem may be.
However, it could be something else. So please include the exact error message you received.
kidscancode | 2021-04-17 18:44