Weekly Qbasic and Qb64 Lesson Topics
April 26, 2025, 12:43:00 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

PacMan2f This one moves with arrow keys

Pages: 1 [2] 3 4
  Print  
Author Topic: PacMan2f This one moves with arrow keys  (Read 4363 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #15 on: March 08, 2011, 01:44:39 am »



    You have to poll for soundplaying.

The _SNDPLAYING function returns whether a sound is being played. Uses a handle from the _SNDOPEN or _SNDCOPY functions.

Syntax:
playing% = _SNDPLAYING (handle&)

Description:
Returns 0 if a sound is not playing or -1 if it is.
If a sound is paused, _SNDPLAYING will return 0.


Code:
         '-----------------------------------------------------code for sound
volume = 1 '                                               full volume
gamestart = False '                                        no game yet
intromusic = _SNDOPEN("munchies.mid", "VOL") '           open intro music
_SNDVOL intromusic, volume '                               set music volume
_SNDLOOP intromusic '
PRINT "This is my Music"           
OK, This works too, my error was not includeing the _soundloop , that is why it was only playing once, the other thing, the high_hat.mid  has a real long space of silence, in the middle, one may think it is not going to continue, but it dose. I did not write the 3 I just posted.
 I tried the munchies.mid with UnseensGDK, "Garrysgame"(catch the bunny)
It worked, but I did not have the _sndloop  in it so it did not keep playing continuesly.
 So if you compose a loop and have a place inside that loop that checks if sound is playing then if the sound stops soundplaying returns a zero so based off that zero you branch to load and play the sound again.  This makes sense, and explains why I could not put the sound inside the main loop. It is hard when I am so tired, well I will "dream" on this,
I think I understand better.
Thanks and see you later
from Garry
« Last Edit: September 17, 2011, 09:45:43 am by GarrisonRicketson » Report Spam   Logged


Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy