Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Akluan |
I have a projectile being fired, and previously used a timer to make it disappear, but I’m working on having different stats like speed and range. I’ve changed to using the following code to make my projectile only go a set distance from where it starts:
func range_check():
traveled = (self.global_position-origin)
if traveled.x >= bulletRange:
queue_free()
elif traveled.y >= bulletRange:
queue_free()
elif traveled.y <= -bulletRange:
queue_free()
elif traveled.x <= -bulletRange:
queue_free()
this results in a square basically, as shooting diagonally goes further. I would like it to feel like more of a circle and I’m not quite sure how to go about this.