Be a Supporter!

Simple Sound Question...

  • 365 Views
  • 6 Replies
New Topic Respond to this Topic
MidnightEscapeArtist
MidnightEscapeArtist
  • Member since: Dec. 29, 2005
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Simple Sound Question... 2006-07-29 18:44:10 Reply

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
Response to Simple Sound Question... 2006-07-29 18:45:56 Reply

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
Response to Simple Sound Question... 2006-07-29 18:47:32 Reply

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
Response to Simple Sound Question... 2006-07-29 18:48:19 Reply

Well, might as well answer is question...try this...

onClipEvent(load){
if (Key.isDown(Key.RIGHT) && sound=false)
// actions
}

something like that....


Hello, from the past!
[ PHP: Main ]

BBS Signature
MidnightEscapeArtist
MidnightEscapeArtist
  • Member since: Dec. 29, 2005
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Simple Sound Question... 2006-07-29 18:51:01 Reply

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
Response to Simple Sound Question... 2006-07-29 18:51:43 Reply

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 ]

BBS Signature
MidnightEscapeArtist
MidnightEscapeArtist
  • Member since: Dec. 29, 2005
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Simple Sound Question... 2006-07-29 19:02:30 Reply

At 7/29/06 06:51 PM, elbekko wrote: You shouldn't figure, you should read.

Oh shut up...