Poulet carnivore Lv.2
Inscrit le : 07/09/2011 Messages : 15
| Sujet: Selection de Musique plus verouillage Mer 7 Sep 2011 - 17:25 | |
| Un selecteur de musique qui peuvent etre verouiller et deverouiller en utilisant les variable dans le jeu image : - Code:
-
http://img829.imageshack.us/img829/3093/musicplayer.png code : - Code:
-
#--------------------------------------- #apeller avec "$scene = Scene_Music.new" #Music Player #utilise les Variables du jeu #pour deverouiller une musique #Variable 50+ #ca depend de la variable Max_Music #Value = 0 Verrouiller #Value = 1 Deverouiller #Auteur : Zarby #---------------------------------------
module Music #Here the Max Music and Names of Music Start_Variable = 50 #Commence a la variable 50 Max_Music = 10 #jusqua la variable 60 Replace_Character = '*' #si la musique est verouiller ca affiche * sinon change Replace_Word #si Replace word = pas '' #ca va afficher un mot au lieu d'un asterix qui masque chaque lettre Replace_Word = '' Music = [] File = [] #Here the file "le nom de ton fichier dans le dossier BGM Ressource" File[0] = 'Field1' File[1] = 'Field2' File[2] = 'Field3' File[3] = 'Town1' File[4] = 'Town2' File[5] = 'Town3' File[6] = 'Scene1' File[7] = 'Scene2' File[8] = 'Scene4' File[9] = 'Scene5' #Le nom des musique a afficher Music[0] = 'Field1 Music' Music[1] = 'This is my music 2' Music[2] = 'This is the Field 3 Music' Music[3] = 'Town 1' Music[4] = 'Town of desert' Music[5] = 'Unknow Music' Music[6] = 'This is the Music number 6' Music[7] = 'Village x Music' Music[8] = 'Music number 8' Music[9] = 'Music 10' end
#Window Music class Window_Music < Window_Selectable
def initialize(x, y, width, height) super(x, y, width, height) @item_max = Music::Max_Music @column_max = 1 self.index = 0 refresh set_variables end def set_variables for i in Music::Start_Variable..Music::Start_Variable+Music::Max_Music if $game_variables[i] == nil $game_variables[i] = 0 end end end def draw_music(index) rect = item_rect(index) self.contents.clear_rect(rect) @Music_Name = Music::Music[index] enable = $game_variables[index+Music::Start_Variable] self.contents.font.color = normal_color self.contents.font.color.alpha = 255 if enable == 0 self.contents.font.color.alpha = 128 if Music::Replace_Word != '' @Music_Name = Music::Replace_Word else @Music_Name = @Music_Name.gsub(/[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890]/) {|s| s = Music::Replace_Character} end end self.contents.draw_text(rect.x, rect.y, 272, WLH,@Music_Name) end def refresh create_contents for i in 0...@item_max draw_music(i) end end
end
#Scene_Music class Scene_Music < Scene_Base def start @music_window = Window_Music.new(0, 0, 544, 416) @music_window.index = 0 end
def terminate @music_window.dispose end def update @music_window.update if Input.trigger?(Input::B) RPG::BGS.stop RPG::ME.stop RPG::BGM.stop Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_variables[@music_window.index+Music::Start_Variable] == 0 Sound.play_buzzer elsif $game_variables[@music_window.index+Music::Start_Variable] == 1 RPG::BGM.stop RPG::BGS.stop RPG::ME.stop @name = Music::File[@music_window.index] Audio.bgm_play("Audio/BGM/" + @name, 100, 100) end end end end
|
|