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
http://www.twitch.tv/kiugetski
https://discord.gg/55R9Gbs

feel free to contact me of follow me :) i can give some advice
B
32
S
9
G
3
Posts: 145
Reputation: 3,895

Post » Wed Mar 23, 2016 9:02 pm

Can you please provide a screenshot of your events?
B
32
S
15
G
6
Posts: 166
Reputation: 5,965

Post » Wed Mar 23, 2016 9:23 pm

http://www.twitch.tv/kiugetski
https://discord.gg/55R9Gbs

feel free to contact me of follow me :) i can give some advice
B
32
S
9
G
3
Posts: 145
Reputation: 3,895

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
57
S
28
G
115
Posts: 1,714
Reputation: 65,176

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
32
S
15
G
6
Posts: 166
Reputation: 5,965

Post » Wed Mar 23, 2016 9:57 pm

UID ? how do you get its id
http://www.twitch.tv/kiugetski
https://discord.gg/55R9Gbs

feel free to contact me of follow me :) i can give some advice
B
32
S
9
G
3
Posts: 145
Reputation: 3,895

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
57
S
28
G
115
Posts: 1,714
Reputation: 65,176


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests