How do I pick by "On Created"

Get help using Construct 2

Post » Sun Apr 06, 2014 7:20 am

I'm noticing that when doing an "On Created" event, it's not actually picking that specific instance. Is there a way to do this?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sun Apr 06, 2014 8:38 am

Maybe like this?
You do not have the required permissions to view the files attached to this post.
It's time for me to return the favor :)
B
32
S
9
G
9
Posts: 132
Reputation: 5,370

Post » Sun Apr 06, 2014 8:52 am

@ikke2902 - Hmm, it was a good idea, but it's not working for what I need it to do.

In order to save hundreds of lines of code, I need to check if a variable is = to something, and if so, when "sprite1" is created, create an additional sprite on top of it. I tried using what you did, ikke, but it only worked for the first sprite created until all of them were destroyed (I needed to add a trigger once to the variable check). I tried taking away the trigger once and it worked, but instead created the new sprite every tick which isn't what I want, either.

I'm quite stumped on this one.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sun Apr 06, 2014 9:23 am

Can you post your .capx. @ome6a1717?
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Apr 06, 2014 6:18 pm

@Doc Ai - it's too large too post, this is the best I can do :

Image

If this were to work, this is what I would be trying to do.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sun Apr 06, 2014 7:39 pm

It is a bit hard. I am guessing what you want to do and what your problem is. Hopefully I am close to what you are looking for =/
I think your game is spawning many BulletFX simultaneously. For me, the On create condition becomes a bit troublesome. C2 seems to be confused which one to pick during the On Create event when more objects are created in the same tick.

What I do is adding an instance variable to BulletFX, let's call it TriggerCheck. TriggerCheck has value zero when BulletFX is spawned.
Instead of On Create condition, I would do the following
BulletFX TriggerCheck=0 | System create object etc.
Wait 0 seconds
Set BulletFX.TriggerCheck to 1
It's time for me to return the favor :)
B
32
S
9
G
9
Posts: 132
Reputation: 5,370

Post » Sun Apr 06, 2014 7:59 pm

Can't you just create a function for the "Create BulletFX3 and assign settings" stuff and just call the function whenever a regular BulletFX is created? What I'm trying to get at is - if "On Created" is causing issues, can you get by without using it and doing something else? There's almost always more than one way to do a program.
B
33
S
7
G
8
Posts: 312
Reputation: 8,528

Post » Sun Apr 06, 2014 8:28 pm

@Manley23 - I can, I'm just trying to simplify my code instead of going through and finding each time something like this is created (which happens on multiple separate events/sheets)

@ikke2902 - I think I see what you're saying. I'll give it a shot.

Thanks everyone.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 19 guests