Kasbak Membre V.I.P.
Messages postés : 1356 Date d'inscription : 05/01/2013 Jauge LPC :
| Sujet: Sushi_shop Ven 24 Avr 2015 - 13:48 | |
| Voilà un script que j'ai fait pour mon jeu,je le partage au cas ou quelqu'un aurait l'envie de faire un magasin de sushi. Screen : Pour l'ouvrir : - Code:
-
$scene = Scene_JapanFood.new pour ouvrir directement le shop sans l'image d'intro : - Code:
-
$scene = Scene_JapanFood2.new Vous aurait une petite partie en event à gérer tout de même rien de bien compliquer.Vous faite un event vous mettez insérer un script ' $scene = Scene_JapanFood.new ' puis interrupteur A activer,dans l'interrupteur A vous mettez si variable 5= 1 condition si argent possédé est égal à 'somme désiré ' reçu objet sinon texte pas assez d'argent desactivé A,puis pareil pour variable 2,3,ect... - Intro 1:
- Intro 2:
Pour faire marcher le menu enregistré ces images,le fond du shop doit s'appeler 'JapanF3' et le fond de l'accueil 'Japan1'.Copier une des 2 images. - JapanF3:
- Copier une de ces 2 images dans le dossier pictures de votre dossier et appelez la 'Japan1':
- Script :
- Code:
-
#--------------------------------------------------------------------------------------------------------------# #"Menu Japan Food by Kasbak"
#$scene = Scene_JapanFood.new (Dans la commande script d'un évènement)
#option 1 = (variable 5 =1) #option 2 = (variable 5 =2) #option 3 = (variable 5 =3)
#faite un event insérer script "$scene = Scene_JapanFood.new" puis donner l'objet quand variable 5 est égal.
#--------------------------------------------------------------------------------------------------------------# class Window_JapanFood < Window_Base def initialize super(0, 0, 640, 600) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.size = 14 self.opacity = 0 refresh end def refresh self.contents.clear self.contents.font.size = 24 self.contents.font.name = "Tahoma"#"CloneWars"# self.contents.font.size = 16 self.contents.font.name = "Arial" self.contents.font.color = Color.new(153, 204, 50, 255)
self.contents.font.size = 15
self.contents.draw_text(55, 55, 300, 32, "Sushi") self.contents.draw_text(160, 55, 300, 32, "Sushi") self.contents.draw_text(265, 55, 300, 32, "Nigiri")
self.contents.draw_text(370, 55, 78, 32, "Sushi")#Charkin-sushi self.contents.draw_text(55, 160, 300, 32, "Hosomaki") self.contents.draw_text(160, 160, 300, 32, "Maki-sushi") self.contents.draw_text(265, 160, 300, 32, "Maki")
self.contents.draw_text(370, 160, 300, 32, "Futomaki") self.contents.draw_text(55, 265, 300, 32, "Temaki") self.contents.draw_text(160, 265, 300, 32, "Sashimis") self.contents.draw_text(265, 265, 300, 32, "Sashimis") self.contents.draw_text(370, 265, 300, 32, "Ikura") self.contents.font.size = 24
end end
class Window_JapanFoodPrice < Window_Base def initialize super(0, 0, 840, 480) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.size = 14 self.opacity = 0 refresh end def refresh self.contents.clear self.contents.font.size = 24 self.contents.font.name = "Tahoma"#"CloneWars"# self.contents.font.size = 16 self.contents.font.name = "Arial" self.contents.font.color = Color.new(238, 238, 0, 255)
self.contents.font.size = 15
self.contents.draw_text(55, 55, 300, 32, "3$",2) self.contents.draw_text(160, 55, 300, 32, "3$",2) self.contents.draw_text(265, 55, 300, 32, "3$",2)
self.contents.draw_text(370, 55, 300, 32, "3$",2) self.contents.draw_text(55, 160, 300, 32, "2$",2)
self.contents.draw_text(160, 160, 300, 32, "2$",2)
self.contents.draw_text(265, 160, 300, 32, "3$",2)
self.contents.draw_text(370, 160, 300, 32, "4$",2) self.contents.draw_text(55, 265, 300, 32, "5$",2) self.contents.draw_text(160, 265, 300, 32, "12$",2) self.contents.draw_text(265, 265, 300, 32, "14$",2) self.contents.draw_text(370, 265, 300, 32, "3$",2) self.contents.font.size = 24
end end
#============================================================================== # ** Window_ShopCommand #------------------------------------------------------------------------------ # This window is used to choose your business on the shop screen. #==============================================================================
class Window_MenuJapanFood < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(width, commands) super(0, 0, width, commands.size * 32 + 32) @item_max = commands.size @column_max = 4 @commands = commands refresh self.index = 0 end #-------------------------------------------------------------------------- # * Create Contents #-------------------------------------------------------------------------- def create_contents self.contents.clear if self.contents self.contents = Bitmap.new(width - 32, height - 32)
end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) x = 4 + index * 160 y = index / 2 * 32 self.contents.draw_text(x, y, 128, 32, @commands[index]) end #-------------------------------------------------------------------------- # * Update Cursor Rect #-------------------------------------------------------------------------- def update_cursor_rect # ??????? 0 ????? if @index < 0 self.cursor_rect.empty return end # ??????? row = @index / @column_max # ??????????????????????? if row < self.top_row # ?????????????????? self.top_row = row end # ????????????????????????? if row > self.top_row + (self.page_row_max - 1) # ??????????????????? self.top_row = row - (self.page_row_max - 1) end # ?????????Calculer la largeur du point d'insertion #largeur de la colonne* cursor_width = self.width / @column_max - 85#262 20 38 # ??????????Calculer les coordonnées du curseur x = @index % @column_max * (cursor_width + 30)#ecart gauche a droite y = @index / @column_max * 105 - self.oy # ??????????Mise à jour le rectangle de curseur self.cursor_rect.set(x, y, cursor_width, 75)#75 end end
######################## ######################## class Scene_JapanFood
#---------------# def initialize(menu_index = 0) @menu_index = menu_index end def main
$game_system = Game_System.new
#image : aide @spriteset = Spriteset_Map.new #@sprite = Sprite.new @img_fond = Sprite.new @img_fond.bitmap = RPG::Cache.picture("Japon1") #@sprite.bitmap = RPG::Cache.title("")
#Window_Command
s1 = " Enter"
@command_window = Window_Command.new(136, [s1,])
@command_window.index = @menu_index @command_window.back_opacity = 0 @command_window.opacity = 0
@command_window.x = 252 #- @command_window.width / 2
@command_window.y = -8
#Main loop
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
#@sprite.bitmap.dispose
#@sprite.dispose
end
#------------------------------------------------------------------------------#
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se) #quand 'echap' retour sur la map $scene = Scene_Map.new
return
end
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0 $game_system.se_play($data_system.decision_se) $scene = Scene_JapanFood2.new
end
end
end
#------------------------------------------------------------------------------# end
######################## ######################## class Scene_JapanFood2
#---------------# def initialize(menu_index = 0) @menu_index = menu_index end def main
$game_system = Game_System.new
#@spriteset = Spriteset_Map.new #@sprite = Sprite.new @img_fond = Sprite.new @img_fond.bitmap = RPG::Cache.picture("JapanF3") #@sprite.bitmap = RPG::Cache.title("")
#Window_Command
s1 = ""
s2 = ""
s3 = ""
s4 = ""
s5 = ""
s6 = ""
s7 = ""
s8 = ""
s9 = ""
s10 = ""
s11 = ""
s12 = ""
@command_window = Window_MenuJapanFood.new(640, [s1, s2, s3,s4,s5,s6,s7,s8,s9,s10,s11,s12]) @command_window.index = @menu_index @command_window.back_opacity = 0 @command_window.opacity = 0
@command_window.x = 22 #- @command_window.width / 2
@command_window.y = -8
@JapFood = Window_JapanFood.new @JapFood.x = -30 @JapFood.y = -70#416
@JapFoodP = Window_JapanFoodPrice.new @JapFoodP.x = -261 @JapFoodP.y = -12#416 #Main loop
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose @JapFood.dispose @JapFoodP.dispose #@sprite.bitmap.dispose
#@sprite.dispose
end
#------------------------------------------------------------------------------#
def update
@JapFood.update @JapFoodP.update if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se) #quand 'echp' retour sur la map $scene = Scene_Map.new
return
end
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0 $game_system.se_play($data_system.decision_se) $game_variables[5] = 1 $scene = Scene_Map.new when 1 $game_system.se_play($data_system.decision_se) $game_variables[5] = 2 $scene = Scene_Map.new when 2 $game_system.se_play($data_system.decision_se) $game_variables[5] = 3 $scene = Scene_Map.new when 3 $game_system.se_play($data_system.decision_se) $game_variables[5] = 4 $scene = Scene_Map.new when 4 $game_system.se_play($data_system.decision_se) $game_variables[5] = 5 $scene = Scene_Map.new when 5 $game_system.se_play($data_system.decision_se) $game_variables[5] = 6 $scene = Scene_Map.new when 6 $game_system.se_play($data_system.decision_se) $game_variables[5] = 7 $scene = Scene_Map.new when 7 $game_system.se_play($data_system.decision_se) $game_variables[5] = 8 $scene = Scene_Map.new when 8 $game_system.se_play($data_system.decision_se) $game_variables[5] = 9 $scene = Scene_Map.new when 9 $game_system.se_play($data_system.decision_se) $game_variables[5] = 10 $scene = Scene_Map.new when 10 $game_system.se_play($data_system.decision_se) $game_variables[5] = 11 $scene = Scene_Map.new when 11 $game_system.se_play($data_system.decision_se) $game_variables[5] = 12 $scene = Scene_Map.new
end
end
end
#------------------------------------------------------------------------------# end
#################################
|
|