I want to make a turret that is shooting lazers and i watched a tutorial on it. The person in the video used (scenename).position(get.node("Position2D").get_global_pos())
in order to spawn a projectile on the potition 2d. When i run this code, the game freezes and the debugger says "Invalid call. Nonexistant function 'get_global_pos' in base 2D". In the comments someone said that the tutorial is using 2.0 godot and that in 3.0 you dont use get_ and instead of pos you put potition, so i tried changing get_global_pos
to global_position
but it didnt work. i am very new to this and if you want any further information please let me know
Asked
Active
Viewed 67 times
0

TheCrazy
- 1
- 1
1 Answers
1
As you already found out, global_position is the equivalent to get_global_pos.
The difference is, that global_position is no function but a member.
So instead of:
(scenename).position(get.node("Position2D").get_global_pos())
you have to write:
(scenename).position = get.node("Position2D").global_position

Bugfish
- 725
- 5
- 14