How do I associate specific sound to each sprite in a family

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello,

    I try to make a little game and I have some problem due to lack of knowledge (I'm a beginner), so I really hope you can help me, and in advance thanks for your time and conseideration.

    Well let's go I have a family of "enemies" set:

    -enemytype1

    -enemytype2

    -enemytype3

    ....

    I have imported in "sound" some m4a files:

    -enemytype1sound.m4a

    -enemytype2sound/m4a

    ....

    I want to spawn a random enemy each type so i've did each 2 seconds spawn "enemies" on layer 2

    "enemies" is the family group.

    So my question is when the game random pick an enemytype from the "enemies" family how do I play the corresponding sound when the sprite spawn on screen ?

    Thanks again I hope I'm clear

    NG

  • I don't know much about Families

    but you can always use something like...

    On created enemytype1 .Play -enemytype1sound.m4a..

    On created enemytype2 .Play -enemytype2sound.m4a......

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • store the sound name in a variable on the sprite, then play the sprite variable name when you want to.

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