uid link dummy sprites leaving their child behind

This forum is currently in read-only mode.
From the Asset Store
1463 files of +850 unique phrases of a cheerful female hero child for FPS, RPG, Action, Adventure, Survival, games etc.
  • I have a feature i am working on in my game where the enemy is destroyed, and a coin shoots out and homes in on the player for auto collection.

    the problem is, I am using a dummy sprite on a bullet behaviour to rotate to the player object at a rapid speed of 400.

    each enemy, before it is set to destroy, creates a dummy sprite with the bullet behaviour, then immediately after a coin sprite is spawned that takes the UID of that dummy and stores it as a private variable. and the matching coin variable is used to pair the coin with the dummy..

    which I believe is the correct way of doing things..right?

    problem is, a singular destroyed enemy is fine and works as it should, but if i destroy enemies in rapid succession, the parent dummies are moving as they should to the player, but are leaving some (not all) of the paired coin sprites behind...

    I'm using:

    (event)

    Always

    coin value = to dummy UID

    (action)

    coin sprite set x to dummy .x

    coin sprite set y to dummy .y

    can anyone help?

  • Replace the always with a "for each dummy".

  • Amazing! thankyou so much - should I be using this for any multiple instance of anything? for example, particle fading or scaling?

  • Ah, maybe not so amazing.. It's still doing it....this one is really vexing me

  • after a bit more experimentation, it seems it is actually the spawning event is causing the trouble (?)

    it seems the graphic that follows the parent dummy gets left behind when objects are overlapping, so I stacked a bunch of static enemies on top of each other and killed them in game, and all the child graphics were left sitting there, while the dummies all did what they were supposed to do..

    heres a snap of the event i'm using to spawn the dummies and child overlay

    dropbox.com/s/o8j8pu7roo5lvix/event.png

    could it be a family issue or a UID issue?? I'm stumped..

    thanks for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your event will work fine when there is only one enemy with destroyed=0. If there is more than one enemy with destroyed=0 then only the last created gem and gemcollide will get modified. This is because create/spawn actions pick only the object being created.

    The solution is to handle the enemies one at a time by adding a "for each enemy" condition to the bottom of that event.

  • Thank you so much.. Is there a guide anywhere for each condition and what they do? I guess I need to learn a bit more about the conditions I don't know about or use..

    Thanks again, you got me moving forward with my game!

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