How to position Static Body 2d

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By YuleTide

Hello I am sorry I am very new to Godot. I have created a static body 2d with a sprite and collision shapes and I want to add it to my level but whenever I add the scene with the static body in it just adds it to the center. That isnt where I want that sprite to be. There is a little move icon next to the mouse cursor at the top of the screen and I have tried selecting this to move the static body but it doesnt work. can someone tell me how I can move the body in the editor to the position I want?

Try

var staticbody_scene = preload("scene way")

func example():
  var a = staticbody_scene.instance()
  add_child(a)
  a.position = get_global_mouse_position()

ramazan | 2022-01-18 08:40

Thanks for your message. I eventually figured out what I was doing wrong, I had put a standard node at the root of the tree and I changed that to a node 2d. That seemed to allow me to move them.

YuleTide | 2022-01-18 10:52