NNKL.COM
welcome to my space
X
Search:  
 HOME   add in sound clips to games
add in sound clips to games
Published by: admin 2010-03-16
Welcome to:nnkl.com

  • hi..
    anyone willing to help me..to put in some sound clips for the actions in my games. i have 12 games..altogether... anyone?


  • how do i use masking to combine all my sub games to the mail flash file?


  • if u already have the sounds, import them to the library, then right click them and select linkage and check export for actionscript, give it an identifier in there too.

    then create the sound instance:
    onClipEvent(load){
    explosion=new Sound()
    explosion.attachSound("explosion_sound") //put the identifier u gave
    }

    and for playing it say when a hittest happens

    onClipEvent(enterFrame){
    if(this.hitTest(_parent.some)){
    explosion.start()
    }
    }


  • //this game something like a magic crystal ball which gives responses every time the user clicks on it.

    //where do i attach the sound script in this game when the response appear in the crystal ball??



    on (release) {
    // all possible responses to appear in the ball
    responses = new Array();
    responses.push("Yes");
    responses.push("No");
    responses.push("Never");
    responses.push("It is certain");
    responses.push("Doubtful");
    responses.push("Maybe");
    responses.push("Definitely");
    responses.push("No way!");
    responses.push("Certainly!");
    responses.push("Looks positive");
    responses.push("Looks negative");

    // get number of responses
    n = responses.length;

    // pick one random response
    r = Int(Math.random()*n);

    // to place the response in text area
    Garrett Dutton - Sound clips::
    IMDb > Garrett Dutton > Sound clips. Add/Change Photo Add Resume. at IMDb Resume. Contact Info News | My Movies | Games | Boards | Help | US Movie
    http://www.imdb.com/name/nm1637641/soundsites
    HOME
    Luke Goss - Sound clips::
    IMDb > Luke Goss > Sound clips. Add/Change Photo Add Resume. at IMDb Resume. Contact Info Playing | News | My Movies | Games | Boards | Help | US Movie
    http://www.imdb.com/name/nm0331577/soundsites
    HOME
    fortune = responses[r];

    // to start the animation
    gotoAndPlay(2);
    }


  • //game function would be, a rat will pop-out from the a whole randomly and the player has to whack the rat.

    i need to insert a sound clip whenever the user "whacks". where do i insert the sound clip script for this action.


    onClipEvent (load) {
    // how much time between rat appearances
    timeBetweenRats = 2000;

    // to calculate time until next rat
    nextRat = getTimer() + timeBetweenRats;

    // init scores
    score = 0;
    numRats = 0;
    }

    onClipEvent (enterFrame) {
    // to see if it is time for the next rat
    if (getTimer() >= nextRat) {

    // to shorten wait next time
    timeBetweenRats -= 10;

    // to see if the game is over
    if (timeBetweenRats < 1800) {
    _root.gotoAndPlay("End");

    // a new rat
    } else {

    // to increase count and update score
    numRats++;
    _root.showScore = score + "/" + numRats;

    // to loop until a rat is found that is
    // not in use
    while (true) {
    rat = Int(Math.Random()*18);
    if (_root["rat "+rat]._currentFrame == 1) break;
    }

    // to tell rat to pop up
    _root["rat "+rat].gotoAndPlay("popup");

    // set time for next rat to appear
    nextRat = getTimer() + timeBetweenRats;
    }
    }
    }


    onClipEvent (mouseDown) {
    // get the location of the click
    x = _root._xmouse;
    y = _root._ymouse;

    // loop through all 18 rats to see which was clicked
    for (i=0;i<18;i++) {

    // look only at clips that are doing thepop up animation
    if (_root["rat "+i]._currentFrame > 24) {

    // to see whether this was the one clicked
    if (_root["rat "+i].hitTest(x,y,false)) {

    // play the clip "whack" animation
    _root["rat "+i].gotoAndPlay("whack");

    // increase score and show it
    score++;
    _root.showScore = score + "/" + numRats;
    }
    }
    }
    }


  • thanks for the message. I tried with the scripts but it's not workin. do u want to have a look on the codings? perhaps mayb you can suggest me the right scripts for my games...what do you think?


  • post the sound code that didnt work so we can take a look at it

    (tip: dont post the .fla most people, or at least me, are too lazy to download stuff, correct it, and upload it):pleased:


  • Easy you don't need any code.
    In the rat MovieClip select the frame with the "whack" label and add the sound as event sound.

    :)





  • Get Smart About Monitoring Virtual Machines
    Microsoft Gets Ex-Streamly Cozy with U.K.'s MediaWave

    You are looking at:nnkl.com's add in sound clips to games, click nnkl.com to home
     
     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 nnkl.com        Site made:CFZ