Shoot at the same distance

Hello everyone! I have a spaceship that shoots to the right

If I stand still and shoot I get the effect I want, one shot after another at the right distance.

The problem comes when I shoot while going forward or backward.

Forwards the bullets are closer together, backwards much further apart.

This obviously depends on the proximity or distance of the spacecraft from the first shot to the moment of the second.

However, this is usually not noticed in games, but I couldn't figure out how to fix this effect. Is there any magic trick I'm missing?

Comments

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    The behavior you are describing makes sense. If your projectile launches at a constant speed and you're moving, then you will close or increase the distance between player and then projectiles.

    Watching some walkthroughs of old an new games I notices a few things.

    • If projectiles are really fast, they move significantly faster than you do, your movement doesn't affect spacing as much. Combine that with blurred projectiles (cuphead), and the gap doesn't change that much (but it does slightly).
    • Limited number of projectiles. If you can only have 3 or 4 projectiles on the screen at a time, the gap doesn't show up as much.
    • Locked to player. Contra does this with the standard weapon, it looks like. The projectile has the player's movement added to it to match the player. You can sort of see this with the standard gun, combining the first condition (limited projectiles), with added player velocity. The bullet arrangement acts more like a sword than a stream of bullets.

    So I suggest you can do one of two things. Shoot burst or blurred shots (cuphead) that move quickly or add the player's velocity to the bullets and limit their lifetime.

    I'm not sure if this will work, but try creating a player velocity game level attribute(s) and constrain it to the player's velocity. Then make movement speed an equation that adds the player's velocity? It's will be weird physics wise, but it should get your desired effect.

  • UltraLionBluUltraLionBlu Member Posts: 157

    Thanks adent42 my solution for now has been to adjust the firing frequency differently according to the movements of the spaceship, maybe you could also get a more precise and better effect, but I'm very close to what I was looking for :)

  • UltraLionBluUltraLionBlu Member Posts: 157

    In any case, the effect I wanted would have been the precise one, such as in X Out

    https://www.youtube.com/watch?v=r7Q9vKjPSNY

    If anyone has a better idea, to make it happen precisely ..: D

Sign In or Register to comment.