Jump to content
Rpg²S Forum
  • 0

Piccolissima modifica ad uno script da me creato!


PrinceEndymion88
 Share

Question

Prendendo spunto dallo scene_end ho "creato" questo script che mi permette di scegliere quale formazione voglio in battaglia. Lo script è il seguente:

 

#==============================================================================# ■ Scene_Formation#------------------------------------------------------------------------------#  ゲーム終了画面の処理を行うクラスです。#============================================================================== class Scene_Formation  def main	s1 = "Shoot"	s2 = "Arrow"	s3 = "Victory"	s4 = "Cluster"	@command_window = Window_Command.new(192, [s1, s2, s3,s4])	@command_window .windowskin = RPG::Cache.windowskin("vuota") 	@command_window.x = 200 - @command_window.width / 2	@command_window.y = 120 - @command_window.height / 2	@command_window.opacity = 255	@command_window.contents_opacity = 255 @menu2 = Plane.new	@menu2.bitmap = RPG::Cache.picture("MN_BK")@menu2.opacity = 255@menu3 = Plane.new	@menu3.bitmap = RPG::Cache.picture("Fog-01")@menu3.opacity =60@menu = Plane.new	@menu.bitmap = RPG::Cache.picture("formazione")@menu.opacity = 255 		  Graphics.transition(30, "Graphics/Transitions/" + "ripple")	loop do	  Graphics.update	  Input.update	  update	  if $scene != self		break	  end	end	for i in 0..20	 @command_window.x -= 30   @command_window.opacity -= 15	@command_window.contents_opacity -= 15 	  Graphics.updateend   	Graphics.freeze	@menu.dispose	@menu2.dispose	@menu3.dispose  	@command_window.dispose	if $scene.is_a?(Scene_Title)	  Graphics.transition	  Graphics.freeze	end  end  def update	if @command_window.x > 115	   @command_window.x -= 20	@command_window.opacity += 15	@command_window.contents_opacity += 15 	end	@menu3.ox += 1	@menu3.oy += 1	@menu2.ox -= 2 	@command_window.update	if Input.trigger?(Input::B)	  $game_system.se_play($data_system.cancel_se)	  $scene = Scene_Menu.new(5)	  return	end	# C ボタンが押された場合	if Input.trigger?(Input::C)	  # コマンドウィンドウのカーソル位置で分岐	  case @command_window.index	  when 0  # タイトルへ		$game_system.se_play($data_system.decision_se)		$battle_formation = SHOOT		$scene = Scene_Option.new		 when 1  # タイトルへ		$game_system.se_play($data_system.decision_se)		$battle_formation = ARROW		$scene = Scene_Option.new		when 2  # シャットダウン		$game_system.se_play($data_system.decision_se)		$battle_formation = VICTORY		$scene = Scene_Option.new	  when 3  	   $game_system.se_play($data_system.decision_se)		$battle_formation = CLUSTER		$scene = Scene_Option.new	   end	  return	end  end end

 

 

E quando lo richiamo con $scene = Scene_Formation.new si presenta in questo modo:

http://img218.imageshack.us/img218/4194/formazione1.png

 

Il risultato è abbastanza piacevole però vorrei apportare una piccola modifica ovvero vorrei fare in modo che quando il cursore si sposta tra le quattro scelte (Shoot, Arrow, Victory e Cluster) sotto la scritta Posizione appaia un'immagine differente in base a dove si posizione il cursore.

Ecco degli esempi:

Se il cursore è su Shoot si dovrebbe presentare così:

http://img222.imageshack.us/img222/936/formazione1shoot.png

Se il cursore è su Cluster invece l'immaginetta sotto posizione cambia in questo modo:

http://img237.imageshack.us/img237/8682/formazione1cluster.png

 

 

Le immagini che devono cambiare sono

http://img222.imageshack.us/img222/8204/shootformation.png -> Quando viene selezionato SHOOT

http://img218.imageshack.us/img218/4444/arrowformation.png -> Quando viene selezionato ARROW

http://img218.imageshack.us/img218/6081/victoryformation.png -> Quando viene selezionato VICTORY

http://img237.imageshack.us/img237/4713/clusterformation.png -> Quando viene selezionato CLUSTER

 

Spero che qualcuno riesca ad aiutarmi :D

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Ci sono diversi modi per farlo. Cerco di spiegarti il più semplice, anche se è un po' rozzo . . .

 

Per prima cosa devi creare 4 sprite ed assegnare a ciascuno una delle immagini della formazioni disponibili. Il codice va inserito ovviamente dove vengono creati gli altri elementi della Scene.

 

 

@formazione0 = Sprite.new@formazione0.bitmap = RPG::Cache.picture("shoot")@formazione0.x = 120	# Valore puramente indicativo, da sostituire con quello voluto@formazione0.y = 260	# Valore puramente indicativo, da sostituire con quello voluto@formazione0.visible = true@formazione1 = Sprite.new@formazione1.bitmap = RPG::Cache.picture("arrow")@formazione1.x = 120	# Valore puramente indicativo, da sostituire con quello voluto@formazione1.y = 260	# Valore puramente indicativo, da sostituire con quello voluto@formazione1.visible = false@formazione2 = Sprite.new@formazione2.bitmap = RPG::Cache.picture("victory")@formazione2.x = 120	# Valore puramente indicativo, da sostituire con quello voluto@formazione2.y = 260	# Valore puramente indicativo, da sostituire con quello voluto@formazione2.visible = false@formazione3 = Sprite.new@formazione3.bitmap = RPG::Cache.picture("cluster")@formazione3.x = 120	# Valore puramente indicativo, da sostituire con quello voluto@formazione3.y = 260	# Valore puramente indicativo, da sostituire con quello voluto@formazione3.visible = false

 

 

Poi nell'update, dopo @command_window.update, va aggiunto questo codice

@formazione0.visible = (@command_window.index == 0)@formazione1.visible = (@command_window.index == 1)@formazione2.visible = (@command_window.index == 2)@formazione3.visible = (@command_window.index == 3)

Infine, bisogna tornare su ed in fondo al (def) main della Scene, dove viene fatto il dispose di tutti gli elementi utilizzati, inserire il dispose degli sprite e delle loro bitmap.

@formazione0.bitmap.dispose@formazione0.dispose@formazione1.bitmap.dispose@formazione1.dispose@formazione2.bitmap.dispose@formazione2.dispose@formazione3.bitmap.dispose@formazione3.dispose

Ti consiglio di fare anche il dispose delle bitmap di @menu, @menu2 e @menu3.

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

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...