0 Favourites

Spriter and C2 questions

  • I am attempting to make the enemies in my game light up when they're hit. At any time, there are multiple instances on the screen. If I use the family of sprites to make the changes, it affects all of the zombies on the screen and not just the one I want it to. Does anyone know how to work around this?

  • If i'm understanding the question correctly. Shouldn't the family object take care of this already...?

    Condition: on EnemyFamily "Hit" (Picks the object in the family that was hit)

    Action: EnemyFamily "Light Up" (should only affect the enemy in the family that was hit)

  • Yes but there are multiple instances of the same family of sprites on screen at the same time. It makes all of that family light up, meaning all of them. See what I mean?

  • If your condition On Collision with EnemyFamily it will pick the sprite in the family that had the collision. so the action should only affect that sprite and not all of them. Can you post a screen shot of the condition action so I can see what you have?

    Check out manual entry for families. Seems like what your asking for is show here: https://www.scirra.com/manual/142/families

  • A Spriter character is composed of multiple images and a Spriter object. The object is invisible so you have to effect all of the sprites separately. The only way I know to do that is by using the family of sprites but that affects EVERY instance on the screen and not just the one that has been hit. I understand families and use them all of the time but I'm just trying to figure out how to distinguish between separate instances of the same family of sprites. I'm not sure if it is possible in this case. lucid - do you have any ideas about this?

  • Try adding a variable to the Spriter object that uses 0 for no collision and 1 for collision. Then have the child objects of the Sprite object check that variable. This should solve your problem, though I think you're doing something else wrong, otherwise you wouldn't have to do that (I don't in a similar situation). It's hard to be sure without seeing the code, though.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Here's the code I'm using:

    Here's the result:

    As you can see, the result is that all of the zombies light up, even the ones that aren't being hit. Since the runner family of objects contains all of the sprites used in every runner, I don't know how to affect the family without affecting all of them. Thanks.

  • I am on my phone so sorry I can't give you a more thorough example but...

    What you want is to call a function with the family UID as the parameter when a collision is detected.

    So it should look something like...

    Condition

    PsyAttacks on collision with ZombieFamily ---> Call function "zombieEffects"(ZombieFamily.UID)

    And then create that function

    On Function "zombieEffects"

    ZombieFamily pick by UID (function.param(0)) ---> do fancy effects

    Hope this helps

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