I'm trying to duplicate the sound a car engine makes when gearing.
but I'm stuck at this point, here is the code
set window on
set window position screen width()/4,screen height()/4
sync on:sync rate 30
`load sound
load sound "SportCarEngineFast.wav",1
loop sound 1
set sound volume 1,50
speed=10000
refs=2
resistance=1
`--------------------------------------------------------------------------------------
`--------------------------------------------------------------------------------------
do
cls
set cursor 0,3
print "gas= ",gas," ","brake= ",brake
print "gear= ",gear
print rnd(1000)-5
R= 255-(0-Y)+(Y*1.5)
G=(0-Y)+(Y*1.5)
ink rgb(R,G,0),0
Y=screen height()-refs/250
if Y>465 then Y=465
box screen width()/2-5,Y,screen width()/2+5,screen height()-10
set cursor screen width()/2+8,Y-8
print "-",refs
`--------------------------------------------------------------------------------------
if upkey()=1 and gas<100 then gas=gas+5
if upkey()=0 and gas>0
gas=gas-10
endif
if gas<0 then gas=0
`--------------------------------------------------------------------------------------
if upkey()=1 then refs=gas*gas*10
if upkey()=0 then refs=refs-1000
`--------------------------------------------------------------------------------------
if speed>100000 then speed=100000
if speed<100 then speed=100
F=refs+rnd(1000)-5
if F>100000 then F=100000
if F<100 then F=100
set sound speed 1,F
sync
loop
the problem occurs when you tap the up key. I know why that is caused, but I don't know how to fix it.
General advice is also appreciated
thank you
Don't look at my sig!