This might help if you're on 4.2.2

func shoot():
	var rocket_scene = preload("res://scenes/rocket.tscn")
	var rocket_instance = rocket_scene.instantiate()
	rocket_instance.rotation -= PI / 2  # Add 90 degrees (pi/2 radians)
	add_child(rocket_instance)

fixed for 4.2.2

2 Likes

I had this problem too. But it’s not a bug or a problem on 4.2.2.
This happened to me because I applied the rotation to the root player node instead of just the sprite.
This meant that every child added would also get rotated 90 degrees, and because the rocket is already sideways it would make it render vertically instead.
The real fix is to apply the rotation and the scale changes to the Sprite2D node instead of the root player node.

PS: This really ends up not being important after the next lesson. Where we move the rockets to be a child a base Node (RocketContainer) instead of directly being a child of the player.

Privacy & Terms