How do I pick by "On Created"

0 favourites
  • 8 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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?

  • Maybe like this?

  • 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.

  • Can you post your .capx. ome6a1717?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Doc Ai - it's too large too post, this is the best I can do :

    If this were to work, this is what I would be trying to do.

  • 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

  • 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.

  • - 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)