So if I shoot an object on the left side of the gun, let’s say if the object shows up on the x-axis from 0-200 and another object shows up from 210-570, how can I trigger a transition/animation effect based on which location on the x-axis the object gets hit with a bullet? For example, I shoot a bird on the left side, I trigger an animation showing the bird falling but moving offscreen to the left. The same goes when I shoot the bird on the right side of the screen but it’s moving to the right offscreen.
I can easily do this by creating two different functions and a math.random code for the x axis (0, 200 or 210, 570) but I prefer one object and one function. Any help will be appreciated!