The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 5 of 5

Thread: desperate

  1. #1

    desperate

    ok so im in desperate need of some help. it should be pretty easy but in 24 hours i need to have a "game." all it has to do really is play a random sound file after a key is pressed 4-5 times. i have cs3 and i realllly need help on tihs because it has to be done in the next 20ish hours. ill pay for help even.

  2. #2
    u are leave homework last minute! hahaaha

  3. If it can be AS2, copy this to an empty fla, then import 5 sound and set their linkage identifiers sound0 to sound4. I'd be happy to explain the code to you if this is what you need. If it can't be AS2 and has to be AS3, good luck. You can probably learn from this and change it to AS3 though.
    Code:
    var keyListener:Object = new Object();
    keyListener.onKeyUp = function ()
        {
        playSound();
        }
    Key.addListener(keyListener);
    
    function playSound():Void
        {
        var sound:Sound = new Sound();
        sound.attachSound("sound" + getRandomNumber(0, 4));
        sound.setVolume(100);
        sound.start();
        }
        
    function getRandomNumber(min:Number, max:Number):Number
        {
        return (Math.floor(Math.random()*(max-min+1)) + min);
        }
    Good luck.

  4. #4
    actually this isn't homework. its for a children's charity in which we have a game that needs this. that code helped ALOT but it actually has to be a little more complicated. if you could help me further that would be amazing.

  5. #5
    what do you mean by "more complicated"....that will do what you wanted, but if you want something else, you should say exactly what you want.
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012