I am currently working on a 2d platformer, and my player can shoot projectiles horizontally. The game also contains vertically moving platforms.
I realized when my player is standing on the platform and it moves upwards, the projectiles shot by my player hit the platform after some meters. It is actually logical, because the projectile goes horizontally, and the platform goes up, so they HAVE to collide (since the projectile’s speed is not that fast).
So I was wondering if I should add the velocity of the platform to the projectiles velocity, so it would move in parallel to the platform. But then actually if the player wants to shoot something which is not standing on the platform, he has to estimate (and add) the platforms velocity before he shoots, which is kind of weird somehow.
So I have two behaviors which are not really 100% satisfying, but no solution to this. Does someone understand what I mean and has maybe an approach to that issue?
If the projectile is slow for a reason then logically the player would have to aim up & fire before he was parallel to it & that would fit in with the logic of the game world. I would start by asking a few questions:
- does the player have to shoot those objects?
- is there time for the player to see the object appear on screen & move closer to it (by moving across their platform) so they can shoot it as they go past?
- could you introduce a ‘power-up’ mechanic to assist the player e.g. Could the shot become guided by the other joystick or different keys on the keyboard? Could the shot be allowed to bounce off the platform (maybe it has a special non stick, Non static, rubber coating)?
Depending on your answers there may be no need to do anything or the need to find a way to have the shots behaviour change to suit that situation (assuming you are happy with the way the shot behaves for the rest of the levels).
1 Like
Hi tedthebug, very interesting questions, which at the end led me to the conclusion that it is ok as it is now. Yes, the player can move to the end of the platform to shoot the object, so it is fine i guess. Apart from that, making the projectile a bit faster and the platform a bit shorter also does not hurt my gameplay.
Actually your third question is also a very interesting thought and tempts me to try it out 
Many thanks!
No worries. I’m just starting out myself & one of the things I have to keep reminding myself to do is ask those type of questions before I go down the rabbit hole of possibilities & solutions that then leads me away from what I actually wanted the player to do in the first place.
Good luck & have fun.
1 Like
Thanks. You are right, keeping the focus is important…I tend to get lost in the details.
BTW: For someone who is just starting out, you have a lot of posts already 