How do I perfect these scatter bullets ?

Get help using Construct 2

Post » Sat Jul 18, 2015 4:44 am

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.

Image

How can I make them launch at the same time making a nice curve?
B
5
Posts: 8
Reputation: 243

Post » Sat Jul 18, 2015 5:26 am

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.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Sat Jul 18, 2015 5:55 am

paulscottrobson wrote: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.
Image

Or do you mean I should write 5 function of each bullet and call them separately?
B
5
Posts: 8
Reputation: 243

Post » Sat Jul 18, 2015 8:50 am

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.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Sat Jul 18, 2015 10:50 am

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.
B
5
Posts: 8
Reputation: 243

Post » Sat Jul 18, 2015 4:49 pm

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)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Sat Jul 18, 2015 5:46 pm

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.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sun Jul 19, 2015 12:27 pm

@linkman2004 , yep that's the smart's man way of doing it :) Damn, I need to learn how the loops work :)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829


Return to How do I....?

Who is online

Users browsing this forum: David181, dop2000, namaewayukidesu and 14 guests