Well, here's where I am at this point. I'm trying to incorporate true stereo sound to this, so when you rotate your airplane right, the engine'll play out of the right speaker. However, with the left speaker, the sound doesn't seem to want to switch to the left speaker, and I'm quite sure I did the code right, here it is:
Not too sure how this is going to work. Also, it would be nice to still learn how to incorporate enemy plane targets, and to be able to shoot pellets at them, and make them explode. Still have to go through all that mess. However, to get the sound panned right between the right and left channels, that's my primary concern for right now.
; b-17.bb - This is the source code for the game project, B-17: 1942 ; Set the graphics resolution Graphics3D 800,600 ; Load the background in backimage = LoadImage ("background.png") ; Start playing the background music thememusic = PlayMusic ("b17.mp3") ; Draw in the background to match the program DrawImage backimage,0,0 ; Load the airplane picture foreimage = LoadImage ("b17g.png") ; Put the B-17 in the middle MidHandle foreimage ; Mask the B-17 image MaskImage foreimage,0,0,10 ; Draw the airplane in the middle of the screen DrawImage foreimage,320,240 Flip ; Wait for a keypress from the user WaitKey ; Make sure the screen is clear before proceeding Cls ; Set the initial AutoMidHandle and BackBuffer() AutoMidHandle True SetBuffer BackBuffer() ; This is the part where the media is loaded ; First, load in the airplane image that will have the rotation planeimage = LoadImage ("airplane.png") ; First, load the clouds image in, since it's closer to the airplane cloudsimage = LoadImage("clouds.png") ; Then, load the ground below into the program which is further away groundimage = LoadImage("ground.png") ; Then, load the background music for this game warmusic = PlayMusic("b17.mp3") ; Next, create a variable to track the scrolling scrolly = 0 ; Now, load the sound effect of the airplane flying planesound = LoadSound ("b17.wav") propsound = LoadSound ("prop.wav") ; Load the constants for this program Const rotations = 16 ; Now, create a variable that rotates this array Dim imagearray (rotations) ; With all the rotations specified, copy and rotate the airplane image with the respective amount of rotations For frame = 0 To rotations - 1 imagearray(frame) = CopyImage (planeimage) RotateImage imagearray (frame), frame * 360 / rotations Next ; Start the airplane at the first (North) frame frame = 0 ; This begins the main loop of the program While Not KeyDown(1) ; Make sure the screen is clear Cls ; Next, set the images into place at their respective speeds TileImage groundimage,0,scrolly TileImage cloudsimage,0,scrolly * 2 ; Increase the scrolly image value scrolly = scrolly + 1 ; Now, reset the scrolling tracking variable when it exceeds the maximum value If scrolly >= ImageHeight(cloudsimage) scrolly = 0 EndIf ; Play the sounds of the airplane PlaySound planesound PlaySound propsound ; Now, add the text for the user's instructions Text 0,0, "Press <Left> to Turn Left. Press <Right> to Turn Right." Text 0,12, "Press <Esc> to Quit. " ; Set the plane to rotate left if the user chooses left If KeyDown (203) ; Decrease the frame by 1 respectively frame = frame - 1 ; Play the plane sound out of the left speaker pan# = -1.000 ; If the frame is below the minimum level, reset it to the maximum value of the array If frame <= 0 frame = rotations - 1 EndIf ; Set the plane to rotate right if the user chooses right ElseIf KeyDown (205) ; Increase the frame by 1 respectively frame = frame + 1 ; Play the plane sound of of the right speaker pan# = 1.000 ; If the frame goes above the maximum level, reset the plane to the first frame If frame >= rotations frame = 0 EndIf SoundPan planesound, pan# SoundPan propsound, pan# EndIf ; Take the current frame, and draw it DrawImage imagearray(frame),400,300 Flip ; Standby for a brief delay Delay 50 Wend
Not too sure how this is going to work. Also, it would be nice to still learn how to incorporate enemy plane targets, and to be able to shoot pellets at them, and make them explode. Still have to go through all that mess. However, to get the sound panned right between the right and left channels, that's my primary concern for right now.