deadcell Trouvère Follet
Nombre de messages : 625 Age : 35 Niveau Rpg Maker : Excellent Niveau Jeux Préférés : Final Fantasy, Resident evil... Date d'inscription : 21/03/2007
| Sujet: Mini-jeu de réflexion Mar 10 Juil 2007, 00:40 | |
| Auteur : Inconnu Fonction : Permet de faire un mini-jeu de réflexion. Cela consiste à mettre tous les pions du "plateau" de la même couleur. Screen: Ressource(s) : - Choisir une musique BGM, le nommer "No" et le mettre dans le dossier Audio/BGM/ de votre projet. - Choisir un son Me, le nommer "No" et le mettre dans le dossier Audio/Me/ de votre projet. - Télécharger les images (419 Ko ; Fichier WinRAR) et les mettre dans le dossier Graphics/Pictures/ de votre projet Ouvrez l'éditeur de script ( F11 ), faites un nouveau script au dessus de " Main", nommez le " Scene_Lights_Out" et collez y le code ci-dessous: - Code:
-
class Window_Command2 < Window_Selectable
def initialize super(144, 64, 352, 352) @column_max = 5 @item_max = 25 self.windowskin = RPG::Cache.windowskin("") self.contents = Bitmap.new(width - 32, @item_max * 32) self.opacity = 0 self.contents.clear self.index = 0 end
end
#======================================================================== #======================================================================== class Window_Light < Window_Base
def initialize(x,y) super(80 + x*64, y*64, 96, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 18 self.opacity = 0 @x = x @y = y refresh end
def refresh self.contents.clear @switch_id = 1000 + @x + (5*(@y-1)) if $game_switches[@switch_id] self.contents.blt(0, 0, RPG::Cache.picture("on"), Rect.new(0,0,96,96), 255) else self.contents.blt(0, 0, RPG::Cache.picture("off"), Rect.new(0,0,96,96), 255) end end
end
#======================================================================== #======================================================================== class Scene_Lights_Out
#-------------------------------------------------------- # Begin / Pocz±tek #-------------------------------------------------------- def main Audio.bgm_play("Audio/BGM/No", 100, 100) # <--- BGM @background = Sprite.new @background.bitmap = RPG::Cache.picture("grad") @sum = 0 @alert = 0 @switch = 0 @select = Window_Command2.new @cursor = Sprite.new @cursor.bitmap = RPG::Cache.picture("cursor") @cursor.z = 2000 light_initialize light_update Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @background.dispose @select.dispose light_dispose @cursor.dispose end #-------------------------------------------------------- # Update / Od¶wie¿anie co klatkê #-------------------------------------------------------- def update @select.update @cursor.x = @select.index%5 * 64 + 160 @cursor.y = @select.index/5 * 64 + 80 if Input.trigger?(Input::C) and @alert > 0 $game_system.se_play($data_system.decision_se) turn_light light_update @alert = 2 end unless @switch == 25 @switch += 1 case rand(2) when 1 $game_switches[1000 + @switch] = false when 0 $game_switches[1000 + @switch] = true end end if @switch == 25 and @alert == 0 $game_system.se_play($data_system.buzzer_se) light_update @alert = 1 end if Input.trigger?(Input::X) and $DEBUG $game_switches[@select.index + 1001] = false light_update end judge if @sum == 0 and @alert == 2 fanfare end end #-------------------------------------------------------- # Initializing windows for the lights / Pierwsze wywo³anie ¶wiate³ #-------------------------------------------------------- def light_initialize @light_1 = Window_Light.new(1,1) @light_2 = Window_Light.new(2,1) @light_3 = Window_Light.new(3,1) @light_4 = Window_Light.new(4,1) @light_5 = Window_Light.new(5,1) @light_6 = Window_Light.new(1,2) @light_7 = Window_Light.new(2,2) @light_8 = Window_Light.new(3,2) @light_9 = Window_Light.new(4,2) @light_10 = Window_Light.new(5,2) @light_11 = Window_Light.new(1,3) @light_12 = Window_Light.new(2,3) @light_13 = Window_Light.new(3,3) @light_14 = Window_Light.new(4,3) @light_15 = Window_Light.new(5,3) @light_16 = Window_Light.new(1,4) @light_17 = Window_Light.new(2,4) @light_18 = Window_Light.new(3,4) @light_19 = Window_Light.new(4,4) @light_20 = Window_Light.new(5,4) @light_21 = Window_Light.new(1,5) @light_22 = Window_Light.new(2,5) @light_23 = Window_Light.new(3,5) @light_24 = Window_Light.new(4,5) @light_25 = Window_Light.new(5,5) end #-------------------------------------------------------- # Refreshing all the windows standing for the lights / Od¶wie¿anie ¶wiate³ #-------------------------------------------------------- def light_update @light_1.refresh @light_2.refresh @light_3.refresh @light_4.refresh @light_5.refresh @light_6.refresh @light_7.refresh @light_8.refresh @light_9.refresh @light_10.refresh @light_11.refresh @light_12.refresh @light_13.refresh @light_14.refresh @light_15.refresh @light_16.refresh @light_17.refresh @light_18.refresh @light_19.refresh @light_20.refresh @light_21.refresh @light_22.refresh @light_23.refresh @light_24.refresh @light_25.refresh end #-------------------------------------------------------- # Disposing all the windows standing for the lights / Usuwanie ¶wiate³ #-------------------------------------------------------- def light_dispose @light_1.dispose @light_2.dispose @light_3.dispose @light_4.dispose @light_5.dispose @light_6.dispose @light_7.dispose @light_8.dispose @light_9.dispose @light_10.dispose @light_11.dispose @light_12.dispose @light_13.dispose @light_14.dispose @light_15.dispose @light_16.dispose @light_17.dispose @light_18.dispose @light_19.dispose @light_20.dispose @light_21.dispose @light_22.dispose @light_23.dispose @light_24.dispose @light_25.dispose end #-------------------------------------------------------- # Pointing switches that are to be turned / Wskazanie, które ¶wiat³a maj± zostaæ prze³±czone #-------------------------------------------------------- def turn_light case @select.index when 0 perform_light_switching(1,2,6) when 1 perform_light_switching(1,2,3,7) when 2 perform_light_switching(2,3,4,8) when 3 perform_light_switching(3,4,5,9) when 4 perform_light_switching(4,5,10) when 5 perform_light_switching(1,6,7,11) when 6 perform_light_switching(2,6,7,8,12) when 7 perform_light_switching(3,7,8,9,13) when 8 perform_light_switching(4,8,9,10,14) when 9 perform_light_switching(5,9,10,15) when 10 perform_light_switching(6,11,12,16) when 11 perform_light_switching(7,11,12,13,17) when 12 perform_light_switching(8,12,13,14,18) when 13 perform_light_switching(9,13,14,15,19) when 14 perform_light_switching(10,14,15,20) when 15 perform_light_switching(11,16,17,21) when 16 perform_light_switching(12,16,17,18,22) when 17 perform_light_switching(13,17,18,19,23) when 18 perform_light_switching(14,18,19,20,24) when 19 perform_light_switching(15,19,20,25) when 20 perform_light_switching(16,21,22) when 21 perform_light_switching(17,21,22,23) when 22 perform_light_switching(18,22,23,24) when 23 perform_light_switching(19,23,24,25) when 24 perform_light_switching(20,24,25) end end #-------------------------------------------------------- # Turning the switches / Zmiana stanu prze³±czników #-------------------------------------------------------- def perform_light_switching(a=0, b=0, c=0, d=0, e=0) if $game_switches[1000 + a] == true $game_switches[1000 + a] = false else $game_switches[1000 + a] = true end
if $game_switches[1000 + b] == true $game_switches[1000 + b] = false else $game_switches[1000 + b] = true end
if $game_switches[1000 + c] == true $game_switches[1000 + c] = false else $game_switches[1000 + c] = true end
if $game_switches[1000 + d] == true $game_switches[1000 + d] = false else $game_switches[1000 + d] = true end
if $game_switches[1000 + e] == true $game_switches[1000 + e] = false else $game_switches[1000 + e] = true end end #-------------------------------------------------------- # Checking winning conditions / Sprawdzanie warunków wygranej #-------------------------------------------------------- def judge @sum = 0 for i in 1001..1025 if $game_switches[i] == true @sum += 1 end end end #-------------------------------------------------------- # This happens when you turn all the lights off / Co dzieje siê po zgaszeniu wszystkich ¶wiate³ :) #-------------------------------------------------------- def fanfare $scene = Scene_Map.new Audio.bgm_stop Audio.me_play("Audio/ME/No", 100, 100) # <--- ME $scene = Scene_Map.new end end Faire un évènement et mettre le code " $scene = Scene_Lights_Out.new " grâce à la commande d'évènement "Insérer un script" | |
|