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
27
S
9
G
3
Posts: 136
Reputation: 3,750


Post » Wed Mar 23, 2016 9:23 pm

B
27
S
9
G
3
Posts: 136
Reputation: 3,750

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
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

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
29
S
14
G
6
Posts: 160
Reputation: 5,752

Post » Wed Mar 23, 2016 9:57 pm

UID ? how do you get its id
B
27
S
9
G
3
Posts: 136
Reputation: 3,750

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
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: wizdigitech and 17 guests