Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | crabcrabcam | |
Old Version | Published before Godot 3 was released. |
I’m making a Skiing game and I need to spawn an infinite load of the snow I have. It’s under a single node. I’ve looked at the Flappy Bird code but it just says to add_child(tube)
. That doesn’t say where to put the object. How can I set the position so that it is always exactly under the last one?
Then I need to set the flags for the player to go through (like flappy bird except they get closer together) I have a World
node with a script I think I should use to control all this. I was going to have an overall node for “flags”, spawn that in and then move the flags as far apart from the centre (where the overall node will sit) as they should be for the current difficulty.
So the flags will be a set distance from each other, but it will change the higher the players score, and at the same time they will be in a random distance but can’t be off the screen on either side. I’m not quite sure how I’d do this.
It’s probably something really stupid I’m not thinking of but thanks for help in advance
In order to control the node’s position before placing it(or after) you can use this:
var nodeInstance = node.instance()
nodeInstance.set_pos(//Vector2 position)
that way the instance position of the node is set to something you decide and not (0,0)…
rustyStriker | 2017-05-07 12:24
Ah thanks. Is that relative to what the parent is or to the overall world?
crabcrabcam | 2017-05-07 14:13