[SOLVED] Double bullet when my player is walking

I have changed my events like Mr.Men suggested. That was my 1st post. Now my move events are at the end of script.

I can’t see the problem in your second video. Do you mean the bullets are closer together when firing and moving?

Yes, that’s why I had 2 timers. But That didn’t solve it.

If I understand your problem, then it’s down to real life physics (as in real life, not the engine):

When the player stands still, bullets are fired every 0.3 seconds and at a speed of 250 pixels/seconds. They have a gap of 75 (250 * 0.3) pixels.

The player moves at 16 pixels every 0.1 seconds (or 160 pixels per second), which is the same as 48 pixels every 0.3 seconds.

So, when a bullet is fired, it moves 75 pixels before the next one is fired 0.3 seconds later. However, during this 0.3 seconds gap, the player has also moved 48 pixels. So the distance between the two bullets will be 27 pixels (75-48). They will appear closer together, but only because your player is moving.

I hope this answers what you’re seeing.

Yes! exactly! I was trying to solve it by changing the timer taking the speed in account. I don’t know if it’s possible though!

Gotcha. Two ways you can possibly fix that (though I personally wouldn’t use either) :

  1. Increase the delay between firing when moving to 0.9 seconds (this will change the gap to 71 pixels (27 pixel difference * 3). This also has the side effect of slowing down the fire rate.
  2. Increase the bullet speed to 350 when moving (this will create a gap of about 75 pixels after player movement is taken into account). The side effect is that firing while moving produces faster bullets.

An alternative is to ditch the auto-fire, and have the player press the space bar for each bullet. Then the close bullet effect won’t be noticeable.

1 Like

Thank you. I had increased the bullet speed to 370 while moving. (by my math). But thinking better, I’ll leave as it is and change a triger once for pressing space bar, because even though, increasing bullet speed is satisfactory, I still can see a ghost bullet when moving. By using trigger once, the game looks better stetically. Many thanks!