Sounds problem need help.

  • hello people am new to construct 2.

    am making a shooter game and i want to make a gunshot sound to work correctly.

    so i made it when i have left click down to shoot and spawn a bullet.

    am trying to put a sound when the bullet is created, i achieved that but the problem is that when the game starts the sound is played once how i can stop this?

    i have the bullet on the layout, please tell me what i can do, or some opinions. thank you

  • Ahh ok I had the exact same problem.

    I solved it this way.

    Make a Global variable called "Game_loaded = 0" or something, so if this is 0 you know the game "haven't" loaded yet.

    Next, and think this is a good idea to do no matter what, as it will remove a lot of potential problems later on.

    Make a "start of layout" and here you destroy all objects that are not needed. Like enemies, rewards, bullets and so on. And stuff like HUDs, background, that should be permanently visible you don't destroy.

    At the end of this event when all objects have been destroyed you set "Game_loaded = 1"

    And then in the "Bullet fired" event you just check if "Game_loaded = 1"

    Another way is that you might be able to just mute the sound before you destroy it, and then just unmute afterwards. In a "Sound finished playing" or what its called, think that might work as well.

  • hello people am new to construct 2.

    am making a shooter game and i want to make a gunshot sound to work correctly.

    so i made it when i have left click down to shoot and spawn a bullet.

    am trying to put a sound when the bullet is created, i achieved that but the problem is that when the game starts the sound is played once how i can stop this?

    i have the bullet on the layout, please tell me what i can do, or some opinions. thank you

    I usually have 'Objects' layout or something similar, where I place 1 copy of every object. This layout is never used in game, just holds the objects. Now I don't have to place any extra objects outside layouts etc. on my actual layouts.

  • I thank both of you, i think both ways are good thanks a lot i been trying to solve this for a week!

  • These tips belong to my favorite category: So simple, yet so effective. Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • it doesn't work none of the ways <img src="smileys/smiley11.gif" border="0" align="middle" />

  • See if you can post a trimmed down example of the problem. Either of those methods should have worked, so something else is probably causing it.

  • what is a trimmed down example?

  • If you don't want to post your whole game, then remove bits until just the sound problem exists, or, make a new file but do the same sound logic.

  • am uploading it

  • you will notice that when the game starts a single shot is sound, this is what i want to stop.

  • Sorry, my fault. We need the CAPX file uploaded to somewhere like dropbox.com so we can review the code, and offer help.

  • wait i am making the whole folder a rar file to send it

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