Simple Sound Question...
- MidnightEscapeArtist
-
MidnightEscapeArtist
- Member since: Dec. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
I have a basic side scrolling ship game going (just for programming practice, don't worry, you'll never see this crap in the portal) and I have attached a thrusting sound to the right key.
The problem is the condition for the if statement is simply (Key.isDown (Key.RIGHT)), and that is constantly true...
You probably know what happens. The sound just plays over itself at whatever speed one's computer can check conditions I suppose.
I want to add another clause in the conditions. Something along the lines of:
if (Key.isDown (Key.RIGHT)) , sound.thrust = false)
Of course that doesn't have a hope of working, but you see how I'm trying to work around it with logic...
In actionscript I want the code equivalent to:
"If the right key is down AND the sound "thrust" is not playing, then play sound "thrust" "
Any help is much appreciated, and I'm sure it's fairly simple...
- Jessii
-
Jessii
- Member since: Feb. 10, 2005
- Offline.
-
- Forum Stats
- Member
- Level 36
- Movie Buff
Am I right to assume that you're creating this in flash? If so, you may have better luck asking in the flash forum.
- JeremysFilms
-
JeremysFilms
- Member since: Feb. 18, 2005
- Offline.
-
- Forum Stats
- Member
- Level 18
- Blank Slate
ActionScript related questions belong in the flash forum.
- Momo-the-Monkey
-
Momo-the-Monkey
- Member since: Oct. 15, 2005
- Offline.
-
- Forum Stats
- Member
- Level 45
- Musician
Well, might as well answer is question...try this...
onClipEvent(load){
if (Key.isDown(Key.RIGHT) && sound=false)
// actions
}
something like that....
- MidnightEscapeArtist
-
MidnightEscapeArtist
- Member since: Dec. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
At 7/29/06 06:48 PM, Momo_the_Monkey wrote: Well, might as well answer is question...try this...
onClipEvent(load){
if (Key.isDown(Key.RIGHT) && sound=false)
// actions
}
something like that....
Thanks for the answer :) I'll give it a try in a sec.
I just figured AS fit under programming. I'll be sure to post further AS qestions in the flash forums.
- elbekko
-
elbekko
- Member since: Jul. 23, 2004
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
You shouldn't figure, you should read.
"My software never has bugs. It just develops random features. " - Unknown
[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]
- MidnightEscapeArtist
-
MidnightEscapeArtist
- Member since: Dec. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 06
- Blank Slate
At 7/29/06 06:51 PM, elbekko wrote: You shouldn't figure, you should read.
Oh shut up...

