Unique IDs

0 favourites
  • 7 posts
From the Asset Store
Unique magic world sound effects you have to use in your game.
  • In the game i am doing there are different enemyes that are randomly generated, each one has its own shield attached to it like a different sprite.

    I have tryed doing this with every tick - set position of shield to enemy

    but when more than one enemy appears and you destroy the shield of another one, the shields start jumping from one to another

    i supose that the way to solve this is with unique ID, but i don't know how

    can anybody help me?

  • Sounds like you need to use a container, although I'm not sure about when you destroy the shield.. I'm sure the enemy would be destroyed to. You could just set shield to invisible if that's the case. Haven't used containers in C2, only in CC and that's how they worked there.

    Failing that, just set an instance variable on the shield to be that of the enemy UID. Then pick the enemy with the UID stored in the shield's variable and pin it using the pin behaviour.

  • Still there is something wrong, i think i havent made de events correctly

    postimage.org/image/rfryuehg1

  • That's because you're setting the ID variable to the ID variable ;p You need to do...

    Enemy3_Escudo Set ID to Enemy4.UID (you have Enemy4.ID)

  • You are right that was wrong, but it is still not working... i am not sure of the second event, can an event pick two instances at the same time?

  • it works now, thank you very much

    in the second event i put pin shield to shield, i changed to pin shield to enemy

    still it didnt work so i merged the two events into one and now it works

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah I didn't spot that. Was too busy spotting your other error ;)

    Glad you got it working!

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