Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | hectormarq |
Hi, i’m trying to increase the frequency enemies spawns, based on the quantity of points (that is increasing constantly). First i tried using While
but crashed my game, them i thought using _process(delta)
but the if statement requires a value (if doesnt have one says "invalid operands ‘Nil’ and ‘int’ in operator ‘>=’), so i set a value but since is in _process(delta)
it keeps coming back to that value.
func _process(delta):
score = 0
if score >= 0 and score < 50:
$EnemyTimer.set_wait_time(0.6)
elif score >= 50 and score < 150:
$EnemyTimer.set_wait_time(0.5)
elif score >= 150 and score < 200:
$EnemyTimer.set_wait_time(0.4)
else:
$EnemyTimer.set_wait_time(0.3)
print($EnemyTimer.wait_time)
func _on_ScoreTimer_timeout():
score +=1
$HUD.update_score(score)
func new_game():
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
$HUD.update_score(score)
$HUD.show_message("Get Ready!")
i hope i explain my self properly, if you could help me it would be awesome.