Jump to content
Rpg²S Forum
  • 0

Ottenere l'indice di una window selectable


Darklink92
 Share

Question

Sto creando uno script che ti permette di scegliere un tutorial da leggere; i tutorial si dovrebbero poter visualizzare in base all'indice della finestra di scelta, ma non riesco ad ottenerne il risultato.

Lo scipt è questo

#=========================================================================#creazione finestra scelte#creazione finestra del tutorial#creazione della scena#========================================================================== #===========================================================================# @ Creazione della finestra selezionabile#==========================================================================class Select_Window < Window_Selectable  def initialize	super(0,40,100,350)	#self.opacity = 0	  self.index = 0	  @item_max = 5	  @column_max = 1	  	refresh  end     def refresh	    self.contents.clear	   	$indice = self.index   for i in 0...@item_max	x = i % @column_max * WLH	y = i / @column_max * WLH  self.contents.draw_text(x, y, 96, 24, "Guida#{i+1}")endendend #=============================================================================# @ Creazione della finestra del tutorial#==============================================================================class Tutorial_Window < Window_Base  def initialize	super(100,40,444,350)   # self.opacity = 0   refresh end  def refresh   self.contents.clear	case $indicewhen 0 self.contents.draw_text(0,0,300, 50,'Vive in zone desertiche, ha una forte difesa ')  when 1 self.contents.draw_text(0,0,300, 50,'ciao')  when 2 self.contents.draw_text(0,0,300, 50,'puzzi ')  when 3self.contents.draw_text(0,0,300, 50,'cacca nello spazio')   when 4self.contents.draw_text(0,0,300, 50,'Metallica rulez')  end endend #==============================================================================# @ Creazione della scena#=============================================================================class Tutorial_System < Scene_Base  def initialize	@lista = Select_Window.new	@tutorial =  Tutorial_Window.new	@lista.active	update  end  def update	@lista.update 	@tutorial.update	 if Input.trigger?(Input::C) and @lista.active == true		 @lista.active = false	   else		 if Input.trigger?(Input::C) and @lista.active == false		 Sound.play_cancel	   end	 end			 	if Input.trigger?(Input::B)  and @lista.active == false	  Sound.play_cancel		@lista.active = true	  else		if Input.trigger?(Input::B) and @lista.active == true		   Sound.play_cancel		   fine		   $scene = Scene_Map.new 		 end		 end   end  def fine	@lista.dispose	@tutorial.dispose    end  end

Mi visulizza solo il primo messaggio e se cambio posizione nulla.

come se lo script non aggiornasse il valore numerico dell'indice...

Elp!

EDIT!

Ho risolto; ho inserito la creazione del contenuto della finestra nell update della scena, e ora funziona!

#=========================================================================#creazione finestra scelte#creazione della scena#==========================================================================class Select_Window < Window_Selectable  def initialize	super(0,40,100,350)	#self.opacity = 0	  self.index = 0	  @item_max = 5	  @column_max = 1	  	refresh  end     def refresh	    self.contents.clear      for i in 0...@item_max	x = i % @column_max * WLH	y = i / @column_max * WLH  self.contents.draw_text(x, y, 96, 24, "Guida#{i+1}")endendend#==============================================================================# @ Creazione della scena#=============================================================================class Tutorial_System < Scene_Base  def initialize	@lista = Select_Window.new  #creazione della finestra  @tutorial =  Window_Base.new(100,40,444,350)  #=============================================  	@lista.active	 	update  end  def update	#================================	#riempimento della finestra   @tutorial.contents.clearcase @indicewhen 0  @tutorial.contents.draw_text(0,0,300, 50,'Vive in zone desertiche, ha una forte difesa ')  when 1 @tutorial.contents.draw_text(0,0,300, 50,'ciao')  when 2 @tutorial.contents.draw_text(0,0,300, 50,'puzzi ')  when 3@tutorial.contents.draw_text(0,0,300, 50,'cacca nello spazio')   when 4@tutorial.contents.draw_text(0,0,300, 50,'Metallica rulez')end#=================================================	@lista.update 	@tutorial.update 	@indice = @lista.index	 if Input.trigger?(Input::C) and @lista.active == true		 @lista.active = false	   else		 if Input.trigger?(Input::C) and @lista.active == false		 Sound.play_cancel	   end	 end  	 if Input.trigger?(Input::B)  and @lista.active == false	  Sound.play_cancel		@lista.active = true	  else		if Input.trigger?(Input::B) and @lista.active == true		   Sound.play_cancel		   fine		   $scene = Scene_Map.new 		 end	   end	   end  def fine	@lista.dispose	@tutorial.dispose    endend

Potete chiudere il topic :biggrin:

Edited by Darklink92

 

 

Partecipante al Rpg2s.net Game Contest 2008/2009

Gioco in Sviluppo:

Fantasy Chronicle

 

Sarica e commenta anche tu!

 

http://img120.imageshack.us/img120/3914/adlucariodd0.pnghttp://img74.imageshack.us/img74/8841/admariomc6.pnghttp://img177.imageshack.us/img177/8113/adzsamuszd3.pnghttp://img359.imageshack.us/img359/9097/adfalcoqq6.png

http://img382.imageshack.us/img382/3572/adlucasom6.pnghttp://img501.imageshack.us/img501/5646/adsnakepp3.png

 

http://team.ffonline.it/imgpersonaggio/cloud_it.jpghttp://team.ffonline.it/imgpersonaggio/cyan_it.jpghttp://team.ffonline.it/imgpersonaggio/steiner_it.jpg

 

Un tizio riguardo Mario Galaxy

 

io l'ho provato, molto divertente e colorato, ma nn c'entra nulla il termine "cpaolavoro" o "miglior gioco" x un gioco del genere, e ha se, nn puo essere paragonato a "veri" giochi del calibro di resident evil,tekken,gran turismo,rachet e clank,assassin's creed ecc.....

 

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...