|Topic was automatically imported from the old Question2Answer platform.
I’m currently programming an enemy who can use an attack that fires bullets from the left and right sides of the screen. Unfortunately, while the bullets firing from the left are able to move to the right. The right-spawning ones can’t move to the left. Depending on how I try to alter my code they either stand still like their movement is being cancelled out, or they move to the left and off the screen.
Is there a way to easily fix this, or am I going to have to revamp my movement code? I’m using an Area2D for the bullets, so I can’t use move_and_slide.
Apologies if the answer is obvious, I’m tired and haven’t been on Godot for a month.
How is the
on_right variable being set / controlled?
jgodfrey | 2022-08-13 15:35
Oh, it’s being controlled by it’s parent, the enemy. I have two functions for whether the bullet’s spawning on the left or right, and only the left-spawning function switches the
on_right variable to false, so it moves in the right direction.
uncannyvilla | 2022-08-13 18:35