'Random' Question

Fal01Fal01 Member Posts: 460
edited April 2012 in Working with GS (Mac)
HI All,

In my game I have 7 coloured Blocks that randomly spawn from the top and land on the bottom(Tetris style). However i also need to have a random (of 7) sound playing for the duration that the block is falling.

I'm not sure where to put the rules.ie in the blocks,the spawner or the sounds.

Hope this makes sense!

It’s not a bug – it’s an undocumented feature

Best Answer

  • tenrdrmertenrdrmer Posts: 9,934
    Accepted Answer
    Ok a little forum etiquette man. Why are you rejecting answers that solve your problem. Yes you may have more answers but that doesn't mean reject the answer that helps you. you just keep posting your questions.

    And dont loop the sound or have a long sound file and it will just play once. If you must though build a rule around the entire sound rule that say something like when linearvelocity.Y is < 0 or something.

Answers

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    If its a sound each indivudual block will make then I would put it in the block itself. have a self attribute called sound and then place a change attbribute at the top of your rule list in the block that says

    Change self.sound to random(1,7)

    then a rule

    When self.sound = 1
    play sound 1
    -Otherwise
    -When self.sound = 2
    -Play sound 2
    --Otherwise
    --When self.sound = 3
    --play sound 3
    ---Otherwise
    --- And so on all the way to 7
  • Fal01Fal01 Member Posts: 460
    Cheers tenrdrmer,
    How can I make it so the sound only plays when the block is falling?

    It’s not a bug – it’s an undocumented feature

  • Fal01Fal01 Member Posts: 460
    Jeez, no need to get cranky!

    I asked in the original question for the duration that the block is falling. This wasn't answered so I chose not to press 'accept' so people wouldn't think that my problem was solved and not bother looking, OK
    I n what way is this bad etiquette?
    I mean I thanked you for you answer and all.
    Cheers

    It’s not a bug – it’s an undocumented feature

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    not accepting is much different than hitting Reject. Rejecting sending a completely different message and really should only be used when the answer in no way applies or is some sort of spam.
  • Fal01Fal01 Member Posts: 460
    Oh right, sorry about that! This new forum bullies you into either pressing accept or reject and I
    panicked!
    I didn't mean to brand you as a reject or anything. :-\"

    It’s not a bug – it’s an undocumented feature

Sign In or Register to comment.