Because your SoundPan commands are within the bounds of your If KeyHit(205) command.
Try indenting your code. It helps A LOT to uncover mistakes like this.
Heres what you've got (indented):
For some tips, check out my programming tutorial website.
Heres some indenting tipe on the site:
http://home.cmit.net/rwolbeck/programmingtutorial/reference/goodhabits.htm#indentation
.
Try indenting your code. It helps A LOT to uncover mistakes like this.
Heres what you've got (indented):
If KeyDown (203) ;Set the plane to rotate left if the user chooses left ; 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 ElseIf KeyDown (205) ; Set the plane to rotate right if the user chooses right ; 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# EndIfand heres what you should have (indented):
If KeyDown (203) Set the plane to rotate left if the user chooses left ; 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 ElseIf KeyDown (205); Set the plane to rotate right if the user chooses right ; 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 EndIf SoundPan planesound, pan# SoundPan propsound, pan#
For some tips, check out my programming tutorial website.
Heres some indenting tipe on the site:
http://home.cmit.net/rwolbeck/programmingtutorial/reference/goodhabits.htm#indentation
.