I think I know where your mistake is but I’m not completely sure as your question is missing a lot of information and the provided code is formated horribly (and thus extremely hard to read). Please improve this for future questions.
Now to my possible explaination. Am I right guessing that this script is running in a map? Because if this is the case you would add the new map as a child of the exiting one and therefor the new map moves every time the parent map moves. After the parent has moved itself and the child the child moves itself as well. => Double movement every frame
To fix this try replacing “add_child (alphainstance)” with “get_parent ().add_child (alphainstance)”. If this doesn’t help then we need more information about your code and file structure.
ok, I have (for while) 3 scenes (I did with tilemaps but this doesn’t matter).
I got to create them randomly .
the problem is:
when a new scene is created, it comes faster then previous one.
I don’t know why if I declare all the scenes with the same value:
“var speed = 400”
is there any way to reset this variable somewhere?
I believe it is adding up or multiplying each time I create a new scene.
CB | 2019-03-01 20:38
As I said. This is probably due to you adding every map as a child of the previous map. Change you add_child line to
get_parent().add_child(alphainstance)
If this doesn’t help then we’ll see further.
MagnusS | 2019-03-02 18:43
Hello Magnus, perfect!! Thank you. Now the scenes are created at same speed.