Jump to content


Photo

problem with playing sound


  • Please log in to reply
11 replies to this topic

#1 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 19 April 2011 - 10:32 PM

Hi every one...
in one of the events in my game (in step event)I have a check on the value of score, so every time it reaches a value I need a sound to be playing one time. I did all of that, but the problem is that the game is keep playing the sound over and over again. So how can I make the sound play one time only from the step event ??? :whistle:

Edited by _195314, 19 April 2011 - 10:39 PM.

  • 0

#2 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14392 posts
  • Version:GM:Studio

Posted 20 April 2011 - 12:21 AM

create
played = false;

if(score>1000 and played == false)
{
played = true;
sound_play(sound);
}

or every 1000 points
create
playat = 1000;

if(score>playat)
{
playat+=1000;
sound_play(sound);
}
  • 0

#3 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 20 April 2011 - 01:05 AM

I know how to make the score thing, but when it checks that the score is larger than a number it keeps playing the sound over and over, I need it to play the sound one time only
see what I have in the picture:
http://img8.imagesha...444/unledjb.png
  • 0

#4 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2747 posts
  • Version:GM:Studio

Posted 20 April 2011 - 03:19 AM

Looks like you want a sound to play, the subimage of the sprite changed and the bullet upgraded by 1 every 300 points. Take icuurd12b42's second set of code:

Creation:
next_event_at = 300;

Step:
if (score > next_event_at) {
  next_event_at += 300;
  bullet += 1;
  sound_play(powerup);
  //This is for the change-sprite icon, I can't see what exactly is inside it
  image_index += 1;
}

GameGeisha

PS: When you use code, make sure that all resource names are unique and valid. If there is another sprite or object named powerup, this might not work until you change the names to something else. A good practice is to prefix your resource names, like spr_powerup and obj_powerup, in order to avoid name conflicts.
  • 0

#5 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 20 April 2011 - 04:23 AM

Looks like you want a sound to play, the subimage of the sprite changed and the bullet upgraded by 1 every 300 points. Take icuurd12b42's second set of code:

Creation:

next_event_at = 300;

Step:
if (score > next_event_at) {
  next_event_at += 300;
  bullet += 1;
  sound_play(powerup);
  //This is for the change-sprite icon, I can't see what exactly is inside it
  image_index += 1;
}

GameGeisha

PS: When you use code, make sure that all resource names are unique and valid. If there is another sprite or object named powerup, this might not work until you change the names to something else. A good practice is to prefix your resource names, like spr_powerup and obj_powerup, in order to avoid name conflicts.

I do not want to have a new code for what I have already. I want a code that can play a sound one time from step event
  • 0

#6 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14392 posts
  • Version:GM:Studio

Posted 20 April 2011 - 06:36 AM

Me brain tilts again...
  • 0

#7 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 20 April 2011 - 08:27 AM

Me brain tilts again...

what ?
  • 0

#8 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14392 posts
  • Version:GM:Studio

Posted 20 April 2011 - 06:48 PM

We answered your question, see it or not, we did...
  • 0

#9 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 20 April 2011 - 11:19 PM

We answered your question, see it or not, we did...

no you did not because the code that the other guy gave me will keep play the sound over and over
  • 0

#10 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2747 posts
  • Version:GM:Studio

Posted 21 April 2011 - 02:14 AM

no you did not because the code that the other guy gave me will keep play the sound over and over

Did you remove all the icons you already have in your Step event and replace it with my code? If you didn't, I can tell you that it's the icons you already have that plays the sound over and over, not my code. Alternatively, it could be that your score is constantly increasing and you don't see it.

Either way, it's your code that is at fault.

GameGeisha
  • 0

#11 _195314

_195314

    GMC Member

  • New Member
  • 82 posts

Posted 22 April 2011 - 07:19 AM


no you did not because the code that the other guy gave me will keep play the sound over and over

Did you remove all the icons you already have in your Step event and replace it with my code? If you didn't, I can tell you that it's the icons you already have that plays the sound over and over, not my code. Alternatively, it could be that your score is constantly increasing and you don't see it.

Either way, it's your code that is at fault.

GameGeisha

Of course I did when I tried your code
  • 0

#12 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2747 posts
  • Version:GM:Studio

Posted 22 April 2011 - 06:05 PM

OK, how about posting the source then? As of now, there's nothing much for anyone to do other than guessing.

GameGeisha
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users