I’m working on a 2D side-scroller type game for mobile. At this moment, I have a flying enemy character with a droppable bomb-type actor attached. My goal is to set up a targeting system to make my enemy character drop the bomb so that if the player character is either standing still or maintains its movement at the current speed/direction, the bomb will pretty much bullseye the player character (small margin of error is the goal, but some slop is fine for playability reasons).
I haven’t yet started scripting the release timing, but my current idea revolves around using 2 box collision components attached to the flying character to act as triggers, whose position forward of the flying character is scaled by the forward velocity of the parent flying character. The further trigger would either trigger a drop event right away or a delay (depending on player character direction, speed, is moving status) and the second would be essentially the same. I can’t help but feel like there’s a much nicer/cleaner way to implement this kind of targeting, but I’m still learning and haven’t been able to find tutorials for this sort of thing.
Also, my bomb is a simple physics object that upon release has physics simulation, gravity, and collision enabled and is then given a small impulse based on the dropping character’s forward velocity. It has no movement component of its own, as it’s intended to be just a falling object.
I posted this in the AnswerHub, just putting it up here for more visibility.
Thoughts, anyone? Am I on the right track here?