Playing a sound when two cards match... 
Author Message
 Playing a sound when two cards match...

I am makeing a Match game and need to add a sound when the two cards match...
and a different sound when no matches..

Here is part of the code:

'compare the values
        If ChosenCard(0, 1) = ChosenCard(0, 2) Then         'MATCH
            'yippeeee - a match!  LOLOLOL

            'assigns a 1 to 'picCard()' that has come up with a match
            PicToggle(ChosenCard(1, 1)) = 1
            PicToggle(ChosenCard(1, 2)) = 1
        Else                                                'NO MATCH
            'set start of timer

Might even add some background music....

Thanks from an OLD new bigginer...



Wed, 18 Jun 1902 08:00:00 GMT  
 Playing a sound when two cards match...
You can use the PlaySound api.  Here is a sample:

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    (ByVal lpszName As String, _
    ByVal hModule As Long, _
    ByVal dwFlags As Long) As Long

Const SND_ASYNC = &H1

Private Sub Command1_Click()
    Static bChime As Boolean

    bChime = Not bChime
    If bChime Then
        PlaySound "c:\windows\media\chimes.wav", 0&, SND_ASYNC
    Else
        PlaySound "c:\windows\media\chord.wav", 0&, SND_ASYNC
    End If

End Sub



Quote:
> I am makeing a Match game and need to add a sound when the two cards
match...
> and a different sound when no matches..

> Here is part of the code:

> 'compare the values
>         If ChosenCard(0, 1) = ChosenCard(0, 2) Then         'MATCH
>             'yippeeee - a match!  LOLOLOL

>             'assigns a 1 to 'picCard()' that has come up with a match
>             PicToggle(ChosenCard(1, 1)) = 1
>             PicToggle(ChosenCard(1, 2)) = 1
>         Else                                                'NO MATCH
>             'set start of timer

> Might even add some background music....

> Thanks from an OLD new bigginer...

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Urgent, How to: Play sound using sound card?

2. Urgent, How to: Play sound using sound card?

3. Sound Card <-> Sound Card Via Data

4. Detecting sound card for playing WAV files

5. Playing *.wav file w/out sound card.

6. Playing WAV file in Win 95 with no sound card

7. Two sound cards?

8. Playing to a specific Sound Card?

9. Two sound cards in one system

10. Playing sounds even if other applications are playing sounds

11. Sample for play and record sound card ?

12. Access Playing Cards Images (CARDS.DLL)

 

 
Powered by phpBB® Forum Software