import fbpy.sprite
import fbpy.fb as fb
import numpy as np
import time
if __name__ == "__main__":
#need it, else sprite will give typerror
main = fb.Surface()
timew = fb.Surface((0,0),(300,10))
sprite = fbpy.sprite.Sprite((0,0),(150,157))
sprite.surface.clear()
sprite.surface.blit("./fighter_viper_mk1small.png")
sprite.save()
for i in range(160):
sprite.surface.clear()
sprite.surface.blit("./fighter_viper_mk1small.png")
sprite.surface.trafo.identity()
sprite.surface.trafo.rotate(6.28/160.0*i)
sprite.surface.styledredraw()
sprite.save()
main.keepbackground()
main.blit("./stars.png")
main.update()
tnull = time.time()
#make it move and debug
counter = 0
nom=0
#for j in range(3):
# for i in range(0,301,1):
# t0 = time.time()
# t = i/300.0*2*np.pi
# x = -200*np.cos(t)+600
# y = 20*np.sin(t)+300
#
# nom = int(i/300.0*160)
# sprite.moveto((x,y), nom)
# counter +=1
# if not (counter % 50):
# timew.clear()
# timew.printxy((3,3),"runtime = {0} s".format(time.time()-tnull),1)
# timew.update()
# while((time.time()-t0)<0.005):
# pass
for i in range(300,-300,-1):
# timew.clear()
# timew.printxy((3,3),"frame = {0} s".format(i),1)
# timew.update()
sprite.moveto((i,300),1)
time.sleep(0.01)
sprite.moveto((100,100),1)
s = raw_input()
sprite.hide()