• Flash 8 hitest
    11 replies, posted
In my flash 8 platformer- When Object 'player' falls into box i want it to play a noise. [code] onClipEvent (enterFrame) { if (_root.player.hitTest(this)) { _root.player._x = -504.0; _root.player._y = -300.0; _root.score -= 5; } } [/code] Now, the code above is what i already have on the box. how can i make it so once the object 'play' hits it, then sound (example) awesome.wav plays from library (p.s the current codes i have on it work fine) thanks :D (real quick- just in case someone is wondering, its as2)
Make a movie clip, put sound on one frame and set it to event. Name the frame like your sound and then when you want to play it just use movieclip.gotoAndStop("soundname") I think there is a way to do it from actionscript but I found this method to be the most practical.
[QUOTE=Darwin226;21085749]Make a movie clip, put sound on one frame and set it to event. Name the frame like your sound and then when you want to play it just use movieclip.gotoAndStop("soundname") I think there is a way to do it from actionscript but I found this method to be the most practical.[/QUOTE] Thanks! but i cant get it to play when 'player' touches it ): [editline]11:21PM[/editline] i really need some help- if anyone could reply i would love it [editline]12:09AM[/editline] Hello?
[CODE]onClipEvent (enterFrame) { if (_root.player.hitTest(this)) { _root.player._x = -504.0; _root.player._y = -300.0; _root.score -= 5; _root.mysoundPlayer.gotoAndStop("myepicsound"); } }[/CODE]
[QUOTE=Darwin226;21095090][CODE]onClipEvent (enterFrame) { if (_root.player.hitTest(this)) { _root.player._x = -504.0; _root.player._y = -300.0; _root.score -= 5; _root.mysoundPlayer.gotoAndStop("myepicsound"); } }[/CODE][/QUOTE] Still nothing , i just teleport and hear no sound. anything special i have to do to get 'myepicsound'?
Ok, follow this steps: Download the sound you want Drag it into Flash so it will be in the library Make a rectangle Convert it to movieClip Name that movieclip mySoundPlayer (not the symbol name, instance name) Double click it and delete everything in Press F9 and type stop(); Go to frame 2 and press F6 Down, in the properties, in the Sound drop down menu put your sound Set sync to Event Press F9 (open the code for frame 2) and type gotoAndStop(1); After that, the code I gave you before should work.
Still no cigar- any other methods. (note- i did it all, checked it three times and got no results.) i just fall in, hear nothing- then teleport back.
[url]http://flak-games.com/devblog/?p=108[/url]
Nothing- May i please have some help- if someone could just try to insert the codes above this comment ^ into my original code
Now you're asking someone to do it for you. If you actually read the tutorial you'd know how to do it. Or of course you could look up other resources. But I'm guessing that maybe it's just too complex, in which case you should get a beginners book and start reading.
well, ive read my book, programmed a platformer and Written bunches of code- i just suck at sounds players and things of that nature. i have never really comprehended why i can do other peices of code, but not sounds. [editline]11:36AM[/editline] but if someone could write combine the orginal code, and the new one, that would be aweosme
I would send you a .fla but I only have CS4 and if won't save below CS3. [URL=http://www.kirupa.com/developer/actionscript/sound.htm]Try this[/URL]
Sorry, you need to Log In to post a reply to this thread.