No, I don't want to rotate the sprite.
I have solved the problem:
Set Display Mode 1280,1024,32
Sync On
Sync Rate 60
Load Image "bord.png",1
Create Animated Sprite 2,"dice.png",12,18,2
Randomize Timer()
Global dicex As Integer = 160
Global dicey As Integer = 360
Global dicespeedx As Integer
Global dicespeedy As Integer
`Randomize the direction
dicespeedx=rnd(3)+1
dicespeedy=rnd(3)+1
Do
Paste Image 1,0,0
Set Cursor 10,200
Print dicespeedx
Set Cursor 10,220
Print dicespeedy
Move_Dice()
`Direction = Degrees
Direction=Atanfull(dicespeedx,dicespeedy)
`determine the animation
If Direction >=90 And Direction <=95
Play Sprite 2,25,36,2
Sprite 2,dicex,dicey,2
etc.
Set Cursor 10,240
Print Direction
Sync
Loop
Function Move_Dice()
dicex=dicex+dicespeedx
If dicex<=110
dicex=110
dicespeedx=dicespeedx*-1
Endif
If dicex>=598
dicex=598
dicespeedx=dicespeedx*-1
Endif
dicey=dicey+dicespeedy
If dicey<=202
dicey=202
dicespeedy=dicespeedy*-1
Endif
If dicey>=598
dicey=598
dicespeedy=dicespeedy*-1
Endif
Endfunction
Atanfull give the direction back.
Thanks....