How do I Make my missile

Get help using Construct 2

Post » Wed Mar 23, 2016 8:45 pm

ok guyz here is my problem !
i spawn a missile then when it hit an other object it spawn let say 5 object a random angle ... and then destroy the missile
but then if i shoot more missile if one of them hit the object they all destroy

and then they all spawn 5 object and then also set angle of others object spawned wich make them looking really unreal
B
29
S
9
G
3
Posts: 138
Reputation: 3,804

Post » Wed Mar 23, 2016 9:02 pm

Can you please provide a screenshot of your events?
B
31
S
14
G
6
Posts: 160
Reputation: 5,804

Post » Wed Mar 23, 2016 9:23 pm

B
29
S
9
G
3
Posts: 138
Reputation: 3,804

Post » Wed Mar 23, 2016 9:40 pm

I believe you'll need a For Each condition.

When you don't use For Each, the event will run all actions for all picked objects at once. With For Each, the event will run once for each picked object individually.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Wed Mar 23, 2016 9:47 pm

On the screenshot you call a function without picking any missiles, so all of them are destroyed. I recommend not using function here (replace "call function" with the function actions). Or, if you want to use function, add a parameter and set it to UID of the missile. Then pick a missile by UID. I hope this makes sense to you.

Also, move the first action of event 4 just before the "destroy" action. It will get rid of every rock changing its angle every time.
B
31
S
14
G
6
Posts: 160
Reputation: 5,804

Post » Wed Mar 23, 2016 9:57 pm

UID ? how do you get its id
B
29
S
9
G
3
Posts: 138
Reputation: 3,804

Post » Wed Mar 23, 2016 10:05 pm

As Lasmelan said:

Best to not use a function.

Otherwise, you need a condition to pick the specific missile you want destroyed. There are a few ways to do this, including with uid, but again it is best to not use a function here.

To use UID - in the event where Missile on collision, you would add an action to set a variable to Missile.UID. Then in the function, you would add a condition to Pick by UID, and reference that variable.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 5 guests