Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IntraFont.init()
- IntraFont.load("flash0:/font/ltn4.pgf", 1)
- local oldpad = Controls.read()
- math.randomseed(os.time())
- ----------------------------
- local blanc = Color.new(255,255,255)
- local rouge = Color.new(255,0,0)
- local bleu = Color.new(0,0,255)
- local vert = Color.new(0,255,0)
- local gris = Color.new(175,175,175)
- local noir = Color.new(0,0,0)
- ----------------------------
- local blancI = IntraFont.color(255,255,255,255)
- local rougeI = IntraFont.color(255,0,0,255)
- local bleuI = IntraFont.color(0,0,255,255)
- local vertI = IntraFont.color(0,255,0,255)
- local grisI = IntraFont.color(175,175,175,255)
- local noirI = IntraFont.color(0,0,0,255)
- -----------------------------
- local pistolet = Mp3me.load("sons/gun.mp3")
- Mp3me.stop()
- local imagemenu = Image.load("images/menu.png")
- local credits = Image.load("images/credits.png")
- local decor = Image.load("images/decor.png")
- local viseur = {x=230,y=90,pic=Image.load("images/viseur.png")}
- local cible = {x=0,y=50,pic=Image.load("images/cible.png"),vitesse=2}
- local cible2 = {x=0,y=60,pic=Image.load("images/cible.png"),vitesse=3}
- local cible3 = {x=0,y=70,pic=Image.load("images/cible.png"),vitesse=4}
- local cible4 = {x=0,y=80,pic=Image.load("images/cible.png"),vitesse=5}
- local cible5 = {x=0,y=90,pic=Image.load("images/cible.png"),vitesse=6}
- local cible6 = {x=0,y=100,pic=Image.load("images/cible.png"),vitesse=7}
- local cible7 = {x=0,y=110,pic=Image.load("images/cible.png"),vitesse=8}
- local cible8 = {x=0,y=120,pic=Image.load("images/cible.png"),vitesse=9}
- local cible9 = {x=0,y=130,pic=Image.load("images/cible.png"),vitesse=10}
- local cible10 = {x=0,y=140,pic=Image.load("images/cible.png"),vitesse=11}
- ccible = Timer.new()
- local statut = "install"
- Score = { }
- dofile("score.cfg")
- local Selec = 1
- Score.actuel = 0
- -----------------------------
- while true do
- screen:clear()
- pad = Controls.read()
- if statut == "install" then
- if System.doesDirExist("flash1:/LPHMDRIVER") == 1 then
- System.message("Les drivers sont bien installes \nO pour aller au menu !", 0)
- statut = "menu"
- else
- System.message("Les drivers ne sont pas installes !\nVeuillez les installer pour que l'homebrew fonctionne correctement\nLes installer ?", 1)
- if System.buttonPressed(0) == 1 then
- System.createDirectory("flash1:/LPHMDRIVER")
- System.copyFile("ms0:/PSP/GAME/CibleAttack/LPHMDRIVER/hook.prx", "flash1:/LPHMDRIVER/hook.prx", 1)
- System.copyFile("ms0:/PSP/GAME/CibleAttack/LPHMDRIVER/rdriver.prx", "flash1:/LPHMDRIVER/rdriver.prx", 1)
- System.copyFile("ms0:/PSP/GAME/CibleAttack/LPHMDRIVER/syslib.prx", "flash1:/LPHMDRIVER/syslib.prx", 1)
- System.removeDirectory("ms0:/PSP/GAME/CibleAttack/LPHMDRIVER")
- System.message("Les drivers ont bien ete installes !", 0)
- statut = "menu"
- end
- end
- end
- if statut == "menu" then
- screen:clear()
- screen:blit(0,0,imagemenu)
- Gu.start3d()
- IntraFont.print(200,120,"Jouer",1,rougeI,100)
- IntraFont.print(200,160,"Credits",1,rougeI,100)
- IntraFont.print(200,200,"Quitter",1,rougeI,100)
- IntraFont.print(160,(80 + Selec * 40),"=>",1,rougeI,150)
- Gu.end3d()
- if pad:cross() and not oldpad:cross() and Selec == 1 then
- statut = "jeu"
- elseif pad:cross() and Selec == 2 then
- statut = "credits"
- elseif pad:cross() and not oldpad:cross() and Selec == 3 then
- statut = "quitter"
- elseif pad:down() and not oldpad:down() then
- Selec = Selec + 1
- elseif pad:up() and not oldpad:up() then
- Selec = Selec - 1
- elseif Selec > 3 then
- Selec = 3
- elseif Selec < 1 then
- Selec = 1
- end
- end
- if statut == "jeu" then
- screen:clear()
- ccible:start()
- screen:blit(cible.x,cible.y,cible.pic)
- cible.x = cible.x + cible.vitesse
- if ccible:time() >= 5000 then
- screen:blit(cible2.x,cible2.y,cible2.pic)
- cible2.x = cible2.x + cible2.vitesse
- elseif ccible:time() >= 10000 then
- screen:blit(cible3.x,cible3.y,cible3.pic)
- cible3.x = cible3.x + cible3.vitesse
- elseif ccible:time() >= 15000 then
- screen:blit(cible4.x,cible4.y,cible4.pic)
- cible4.x = cible4.x + cible4.vitesse
- end
- if pad:r() and not oldpad:r() then
- Mp3me.play()
- end
- if viseur.x >= cible.x and viseur.x <= (cible.x + cible.pic:width()) and viseur.y >= cible.y and viseur.y <= (cible.y + cible.pic:height() ) then
- cible.y = cible.y - 15
- Score.actuel = Score.actuel + 10
- if cible.y > 272 then
- cible = nil
- screen:blit(cible.x,cible.y,cible.pic)
- end
- elseif viseur.x >= cible2.x and viseur.x <= (cible2.x + cible2.pic:width()) and viseur.y >= cible2.y and viseur.y <= (cible2.y + cible2.pic:height() ) then
- cible2.y = cible2.y - 15
- Score.actuel = Score.actuel + 12
- if cible2.y > 272 then
- cible2 = nil
- screen:blit(cible2.x,cible2.y,cible2.pic)
- end
- elseif viseur.x >= cible3.x and viseur.x <= (cible3.x + cible3.pic:width()) and viseur.y >= cible3.y and viseur.y <= (cible3.y +cible3.pic:height() ) then
- cible2.y = cible2.y - 15
- Score.actuel = Score.actuel + 14
- if cible2.y > 272 then
- cible3 = nil
- screen:blit(cible3.x,cible3.y,cible3.pic)
- end
- elseif viseur.x >= cible4.x and viseur.x <= (cible4.x + cible4.pic:width()) and viseur.y >= cible4.y and viseur.y <= (cible4.y +cible4.pic:height() ) then
- cible4.y = cible4.y - 15
- Score.actuel = Score.actuel + 16
- if cible4.y > 272 then
- cible4 = nil
- screen:blit(cible4.x,cible4.y,cible4.pic)
- end
- end
- screen:blit(viseur.x,viseur.y,viseur.pic)
- if math.abs(pad:analogY()) > 13 then -- controles du pad
- viseur.y = viseur.y + pad:analogY() / 13
- end
- if math.abs(pad:analogX()) > 13 then
- viseur.x = viseur.x + pad:analogX() / 13
- end
- screen:blit(0,0,decor)
- Gu.start3d()
- IntraFont.print(250,400,"Meilleur score : "..Score.best,1,bleuI,150)
- IntraFont.print(250,420,"Score actuel : "..Score.actuel,1,vertI,150)
- Gu.end3d()
- end
- end
- if statut == "credits" then
- screen:clear()
- screen:blit(0,0,credits)
- if pad:circle() then
- statut = "menu"
- end
- end
- if statut == "quitter" then
- System.message("Etes vous sur ?",1)
- if System.buttonPressed(0) == 1 then
- System.Quit()
- else statut = "menu"
- end
- end
- oldpad=pad
- screen.flip()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement