How to spawn an instance of a scene at the player's current location.
I'm new to Godot - making the switch from Gamemaker Studio 2. I'm having a problem spawning an instance at just below the location of the player.
I'm making a side-scrolling platformer. If the player hits the "jump" button when in the air, a cloud should spawn just below the player sprite.
I've got player movement working, I've worked out how to create a new Cloud scene and create a new instance of the "cloud' when jump is pressed. but I just can't get my head around how to set the newly instanced cloud beneath the player's current location.
I should add that after the cloud has been created, it should be free to drift away from the player, so I can't add it as a child to the player.
Here is the relevent code so far:
if Input.is_action_just_pressed("jump") and is_on_floor(): velocity.y = JUMPFORCE elif Input.is_action_just_pressed("jump") and !is_on_floor(): var new_cloud = load("res://Cloud.tscn") var spawn_cloud = new_cloud.instance()
Could anyone help me with this, please?