I want to move all instances (after being spawned) by some distance each time my player shoots a bullet.
var motion = Vector2(10,0)
var current_pos = self.global_position # saved current position
self.global_position = Vector2(85, 490)
#starting position when spawned
if Global.is_step == true:#true when player shoots a bullet
current_pos = self.global_position
# save current position each time for each instance
Global.is_step = false
if self.global_position.x < current_pos.x + 100:
self.global_position += motion
I wanted to spawn each instance one by one when the player shoots. But the above code works only for the first instance produced and the rest of them stay in the position where they were spawned. I tried using 'self' but it still doesn't work. I am a beginner godot game developer so I'd like you to help me out with this.