How to play random sound Fx ?

JaxterJaxter Member, PRO Posts: 398
edited March 2012 in Working with GS (Mac)
How to play random sound fx when i click on actor.. ( i will have 6 different sounds )

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make an attribute called randomSound

    when touch is pressed change attribute randomSound to random(1,6)

    then have rules when randomSound=1
    -play sound 1

    When randomSound=2
    -play sound 2

    ect.

    Cheers
  • JaxterJaxter Member, PRO Posts: 398
    but atribute must be integer? ( i dont know meaning of those all )
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yep interger
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    Attributes: are created to define the characteristics of an object/element
    the computer uses attributes to store the values of those characteristics

    Attribute Types: tell the computer how many bits/bytes to allocate in RAM for the storage of that dataValue

    Number Attribute Types:
    Index: stores whole numbersValue; positive (unsigned); least RAM
    Integer: stores whole numbersValue; positive or negative: medium RAM
    Real: stores whole and/or fractional/decimal numbers: positive or negative; most RAM

    any numberValue can be manipulated with the operants: +, -. /(divide), *(multiply)
    any numberValue can interact with any other numberValue
    the computer will round-off fractional/decimal values for index and integer types

    EX:
    index: Score when 0 = gameOver
    Integer: a value to subtract from score -3
    Real: anytime a number may have to store a fractional/decimal value: $12.89 … X = 54.5 … Color.Alpha = 0.25

    ===
    Text type attributes can store numbers … but the number can not be manipulated as they are ascii
    Angle type attributes can be manipulated but they are a handled differently by the computer within their specified numberValue range
    Enumeration type attributes (this type you can not select when adding an attribute) also store a numberValue (whole positive)

    @};- MH
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    but atribute must be integer? ( i dont know meaning of those all )
    http://cookbook.gamesalad.com/tutorials/2/parts/8

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.