How do I keep consistent bullet speed in a scrolling shooter

Get help using Construct 2

Post » Tue Mar 10, 2015 5:45 pm

I'm working on a vertical scrolling shooter and I've gotten my ship to move and shoot, but I think I need some kind of formula to keep the bullet pacing consistent with the ship speed...

For example, if the ship is moving forward, it can keep in pace with the bullets. If it's moving backward, the bullets seem spaced out more.

I'm sure there's a simple solution to this, but I'm not sure what the exact syntax is.
B
5
S
2
Posts: 37
Reputation: 699

Post » Tue Mar 10, 2015 7:49 pm

Something along these lines should work, which is just the difference between the normal speed of your bullet and the Y speed of your ship.

Code: Select all
adjustedSpeed = BulletSpeed - ship.8Direction.VectorY

Assumes the ship object has the 8Direction behavior and is facing the top of the screen. This speed should be given to the bullet upon firing.
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

Post » Tue Mar 10, 2015 8:02 pm

Makes sense. I'll give it a shot when I get home, thanks!
B
5
S
2
Posts: 37
Reputation: 699

Post » Wed Mar 11, 2015 12:03 am

Alright, I gave that a shot, but it's not quite right...moving forward makes them shoot much quicker and back makes them go much slower.
B
5
S
2
Posts: 37
Reputation: 699


Return to How do I....?

Who is online

Users browsing this forum: MadSpy, xanxion and 20 guests