Simple pick question (hopefully)

0 favourites
  • 3 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 getting back into C3 after a few months and I'm definitely rusty. I'm getting some inconsistency in my new code and I think I may be picking objects incorrectly...

    Each enemy in my platformer used to just be a sprite, but to make things smoother I'm adding logic for an enemyBox 'anchor' sprite used for positioning and smooth movement. Each enemy sprite will now have a corresponding enemyBox object. The enemy and enemyBox sprite objects both have an instance variable called uniqueID, and it's this variable that ties them together.

    What's the best way to pick the enemy and enemyBox objects that have the same uniqueID? For instance I want the following code to position the enemy where its enemyBox is, but in certain situations enemies are placed on the wrong enemyBox. I believe this code may sometimes be picking the wrong enemyBox or just picking one at random. Is this the right/best way to pick an enemy object AND enemyBox object that have the same uniqueID instance variable?

  • Add a system for each enemybox and you're good to go.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)