0 votes

The game sometimes does not load at the beginning. I'm sure this is due to the while cycle, but I don't know how to fix this problem.
project link: https://drive.google.com/file/d/1AH9ojG7YO9AWBuzBFCmbxX6mtIyYmysB/view?usp=sharing

Godot version 3.2.2.stable.official
in Engine by (135 points)

2 Answers

–2 votes

I solved it.
In your spatial u use physics process and it has a if statement. That statement's result is reloaidng the scene. I moved it to input(event) and now it's working well.

To specify you have this

func _physics_process(_delta):
    if Input.is_action_just_pressed('space'):
        get_tree().reload_current_scene()

And you must change it like this

func _input(event):
    if Input.is_action_just_pressed('space'):
        get_tree().reload_current_scene()
by (16 points)

hey I solved why someone gave me -1

I said that the game sometimes does not load at the BEGINNING and directed saying that probably because of the while cycle, where does this function?

In spatials code

0 votes

You have infinite loop condition in your setWordsOnField function.
During initial words placement you can place words in way they overlap each other (one of the examples is [алтей, граб, астра] [[0, 3], [2, 3], [2, 5]], so граб overlaps астра by one symbol. In second loop you check that there is no words crossing. Since there is words crossing, wordCrossingCheck(words, wordsPositions, way) will always return true and it will be infinite cycle.

by (1,188 points)

I have a choosePosition function in the loop that moves the word to an empty space, why doesn't it work?

As I already said in my previous answer to your question, you need to change your words placement algorithm to avoid calls to randi (because it might freeze a little even correct algorithm). I still don't understand how you want to place your words, so probably it will be easier if you write me in discord (written in "about" of my profile).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.