Good to see some code from you, always the best way to get help.
Whenever something isn't working in your program like you think it should, adding print statements as debug code is the best way to track it down.
Here is your program, slightly modified to compile, you example wouldn't even compile because of this command
So I added some print statements to debug your code
Rem Simple 30 Second Countdown Timer
sync on
sync rate 60
`create image 1,128,128
print "SPRITE"
get image 1,0,0,100,50,1
cls
sprite 1,0,0,1
global fadeval
fadeval = 255
`delete image 1
Set Text Opaque
Ink RGB(255,255,255),0
Seconds=3: Rem change this value to alter the length of the timer
T=HiTimer()
global fadestart
make object cube 1,10
do
Call_Timer(1,fadeval,Seconds)
if fadestart
if fadeval<0 then fadeval=0
repeat
dec fadeval,1
if fadeval>0
set sprite alpha 1,fadeval
endif
until fadeval=0
endif
set cursor 0,100
print "fadestart=";fadestart
print "fadeval=";fadeval
sync
loop
Function Call_Timer(s,fadeval,secs)
Elapsed=(HiTimer()-T)/1000
TimeLeft=secs-Elapsed
if TimeLeft>0
Center Text screen width()/2,screen height()/2+20,Str$(TimeLeft)+" "
else
Seconds=3
endif
if TimeLeft=0
if fadeval>0
fadestart=1
endif
endif
endfunction
The fadeval=0 with no fading happening
So time to check the code...
Seems you are in your repeat loop for fading with no sync command
that will redraw the screen to see the fading
So adding a sync command in your repeat loop will fade the sprite
Rem Simple 30 Second Countdown Timer
sync on
sync rate 60
`create image 1,128,128
print "SPRITE"
get image 1,0,0,100,50,1
cls
sprite 1,0,0,1
global fadeval
fadeval = 255
`delete image 1
Set Text Opaque
Ink RGB(255,255,255),0
Seconds=3: Rem change this value to alter the length of the timer
T=HiTimer()
global fadestart
make object cube 1,10
do
Call_Timer(1,fadeval,Seconds)
if fadestart
if fadeval<0 then fadeval=0
repeat
dec fadeval,1
if fadeval>0
set sprite alpha 1,fadeval
sync
endif
until fadeval=0
endif
set cursor 0,100
print "fadestart=";fadestart
print "fadeval=";fadeval
sync
loop
Function Call_Timer(s,fadeval,secs)
Elapsed=(HiTimer()-T)/1000
TimeLeft=secs-Elapsed
if TimeLeft>0
Center Text screen width()/2,screen height()/2+20,Str$(TimeLeft)+" "
else
Seconds=3
endif
if TimeLeft=0
if fadeval>0
fadestart=1
endif
endif
endfunction
While this works, it is really NOT what you want to do...
You really only want one sync command in your main loop unless you are getting user input or doing something special
You don't really want to fade an object in a repeat loop causing everything on the screen to halt until the fading is completed,
so fading it out or in a little bit each time through your main loop is the best way to do this.
Try it yourself, and if you get stuck, ask for help with your new code.