How do I perfect these scatter bullets ?

  • I try to make bullet in my game scatter by duplicating them and set different angle for them. The problem is...

    If I set them without using wait command, all bullet will overlapped and go to the same angle. (Look like there is only 1 bullet)

    If I use wait command, all bullet scatter in a curve except the last one. It come a bit late. I tried to swap the sequence and it seem to be only the last bullet in the queue that come late.

    How can I make them launch at the same time making a nice curve?

  • Have you tried setting them all initially to disabled and then enabling them seperately ? It may be another problem, I just tried out putting a sprite in the middle of the screen and spawning bullets in different directions simultaneously (e.g. your code without the Wait 0 seconds) and it seems to work fine.

  • Have you tried setting them all initially to disabled and then enabling them seperately ? It may be another problem, I just tried out putting a sprite in the middle of the screen and spawning bullets in different directions simultaneously (e.g. your code without the Wait 0 seconds) and it seems to work fine.

    No, not working. Here is what happen without wait command.

    Or do you mean I should write 5 function of each bullet and call them separately?

  • That is very strange - all I did was basically create a sprite in the middle of the screen, and fire bullets in 8 different directions on a keyboard press - exactly the same as yours without the waits, alternating spawn and set angle of bullets ; it seemed to work fine. Are you sure there's not other events firing that affect these bullets ? I think the effect of the wait 0 is effectively to allow other condition/event stuff to be checked while its waiting.

    It seems very strange. My (not that extensive) experience is when something like this happens, it's not a bug, it's some other thing happening in C2.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The only thing I can think of is my turret is not stay still. When the player touches, it turns. When the player releases, it fires and then turns back to its original position. It may happen that the the middle of shooting sequences, the turret also rotate back at the same time and change the angle a couple degree or even less. So the reference angle change continuously. But considering the fire speed and rotate speed, it should not be so noticeable like this. And it should not affect at all, it is similar to a moving/jumping character shooting scatter bullets.

  • I don't understand why you have to use the wait action. You do want the bullets to fire simultaneously and spread out, like a shotgun, right?

    Try this out (you'll need the latest beta), perhaps you can build upon it.

    http://www.eli0s.com//Tests/Spread.capx (right click and choose Save Link As)

  • Modified version of eli0s's example using a loop: Loop Spread. This will avoid any picking issues that may or may not be causing the problem in the first place. Also, it's a great way to reduce redundancy.

  • linkman2004 , yep that's the smart's man way of doing it

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)