--vmp3 by mrafenne



mov1 = 0
mov2 = 0

stella3 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/stella3.png")
stella2 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/stella2.png")
stella1 =Image.load("ms0:/PSP/GAME/vmp3 v1/images/stella1.png")
stella = Image.load("ms0:/PSP/GAME/vmp3 v1/images/stella.png")
x = 0 
y = 0
teta = 0.1; 
x1 = 0 
y1 = 0
teta1 = 0.3; 
x2 = 0 
y2 = 0
teta2 = 0.1; 
x = 0
y = 0
c = 0
counter = Timer.new()
math.randomseed(os.time())

function nomvis1()
mov2 = 0
if preiw == "fasle" and next == "fasle" then
if mov1 <= 251 and mov1 >= 0 then
mov1 = mov1 +8
end
end
end


statut = "defaut"

function exitMenu()
stella1 = nil
stella2 = nil
stella3 = nil
stella = nil
mov1 = nil
mov2 = nil
collectgarbage()
end


x = 0 
y = 0
teta = 0.1; 
x1 = 0 
y1 = 0
teta1 = 0.3; 
x2 = 0 
y2 = 0
teta2 = 0.5; 

while true do
screen:clear()

if pad:circle() then
statut = "affiche"
end

if statut == "affiche" then
nomvis1() 
screen:fillRect(40,mov1,400,1,white)
screen:fillRect(40,mov1,Mp3me.percent()*4,1,green)
screen:fontPrint(font,mov1+120,253,Mp3me.gettime(),green)
screen:fontPrint(font,mov1+120,270,Mp3me.songTime(),white)
screen:fontPrint(font,mov1-215,253,Mp3me.title(),white)
screen:fontPrint(font,mov1-215,270,Mp3me.album(),white)


end
if pad:square() then
statut = "defaut"
end


teta = teta + 5
x = r * math.sin(teta) 
y = r * math.cos(teta) 
currentTime = counter:time()



      if currentTime < 100 then
   a = 150
   b = 200
   c = 250
   end
      if currentTime > 100 then
   a = 250
   b = 150
   c = 200   end
      if currentTime > 200 then
   a = 200
   b = 250
   c = 150
   end
      

if currentTime > 300 
then counter:stop()
counter:reset(0)
counter:start() end 



if Mp3me.vis(0) <= 100 then
r = 0
screen:blit(a+x,100+y,stella1)
end

if Mp3me.vis(0) <= 90 then
r = 20
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 80 then
r = 40
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 70 then
r = 60
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 60 then
r = 80
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 50 then
r = 100
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 40 then
r = 120
screen:blit(a+x,100+y,stella1)
end


if Mp3me.vis(0) <= 30 then
r = 140
screen:blit(a+x,100+y,stella1)
end

teta1 = teta1 + 5
x1 = r * math.sin(teta) 
y1 = r * math.cos(teta) 


if Mp3me.vis(10) <= 100 then
r = 0
screen:blit(b+x1,100+y1,stella)
end

if Mp3me.vis(10) <= 90 then
r = 20
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 80 then
r = 40
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 70 then
r = 60
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 60 then
r = 80
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 50 then
r = 100
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 40 then
r = 120
screen:blit(b+x1,100+y1,stella)
end


if Mp3me.vis(10) <= 30 then
r = 140
screen:blit(b+x1,100+y1,stella)
end


teta2 = teta2 + 5
x2 = r * math.sin(teta) 
y2 = r * math.cos(teta) 


if Mp3me.vis(20) <= 100 then
r = 0
screen:blit(c+x2,100+y2,stella2)
end

if Mp3me.vis(20) <= 90 then
r = 20
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 80 then
r = 40
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 70 then
r = 60
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 60 then
r = 80
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 50 then
r = 100
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 40 then
r = 120
screen:blit(c+x2,100+y2,stella2)
end


if Mp3me.vis(20) <= 30 then
r = 140
screen:blit(c+x2,100+y2,stella2)
end


pad = Controls.read()

if pad:r() and not oldpad:r() then
if fbrowser.s < (fbrowser.nf + 1) then
i = fbrowser.s + 1
if i < (fbrowser.nf + 1) then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
fbrowser.s = fbrowser.s + 1
Mp3me.stop()
screen:clear()
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:l() and not oldpad:l() then
if fbrowser.s < (fbrowser.nf + 1) and fbrowser.s > 2 then
i = fbrowser.s - 1
if i < (fbrowser.nf + 1) and i > 2 then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
Mp3me.stop()
screen:clear()
fbrowser.s = fbrowser.s - 1
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:cross() and not oldpad:cross() then
Mp3me.pause()
end

if pad:left() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp320.lua")
exitMenu()
end

if pad:right() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp322.lua")
exitMenu()
end

if pad:triangle() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/menu.lua")
exitMenu()
end


if pad:start() then 
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/script1.lua")
exitMenu()
end


screen.waitVblankStart()
screen.flip()
oldpad = pad
end


