; DrawImage Example
; -----------------

Graphics 640,480,0,2
SetBuffer BackBuffer()

; The player ship sprite and a small star for the backdrop
player=LoadImage("media/player.bmp")
star=LoadImage("media/star1.bmp")

; Scatter the stars at fixed random positions
SeedRnd MilliSecs()
Dim star_x(19)
Dim star_y(19)
For i=0 To 19
    star_x(i)=Rand(0,639)
    star_y(i)=Rand(0,479)
Next

While Not KeyDown(1)

    Cls

    ; Draw the starfield backdrop
    For i=0 To 19
        DrawImage star,star_x(i),star_y(i)
    Next

    ; DrawImage puts the ship wherever the mouse points
    DrawImage player,MouseX(),MouseY()

    Text 0,0,"Move the mouse to fly the ship   Esc: exit"
    Text 0,20,"DrawImage player,"+MouseX()+","+MouseY()

    Flip

Wend

End
