Jump to content
Rpg²S Forum

*HUD di Kingdom Hearts


Spike92
 Share

Recommended Posts

HUD di Kingdom Hearts


Descrizione



Questo script riprende l'HUD di Kingdom Hearts.


Autore



Skive



Allegati



Screen: 1


Istruzioni per l'uso


Prima di tutto dovete prendere quest' immagine e metterla in picture:
http://membres.lycos...parodie/hud.png
poi scrivete questa roba in una sezione sopra Main


 

 

#==============================================================================
# ■ Kingdom Hearts HUD
#------------------------------------------------------------------------------
# by Skive
# skivedaft@yahoo.com
#
# --
#
# released on 5th March 2006
#==============================================================================

#==============================================================================
# ■ Sprite_HP
#------------------------------------------------------------------------------
#  the HUD's hp bar
#==============================================================================

class Sprite_HP < Sprite
	#--------------------------------------------------------------------------
	# ● instances
	#--------------------------------------------------------------------------
	attr_writer :actor
	#--------------------------------------------------------------------------
	# ● initialize
	#--------------------------------------------------------------------------
	def initialize(actor = nil)
		super(nil)
		self.z = 202
		self.bitmap = Bitmap.new(60, 26)
		@actor = actor
		if !@actor.nil?
			@hp = @actor.hp
			@maxhp = @actor.maxhp
		end
		refresh
	end
	#--------------------------------------------------------------------------
	# ● refresh
	#--------------------------------------------------------------------------
	def refresh
		self.bitmap.clear
		return if @actor.nil?
		@hp = @actor.hp
		@maxhp = @actor.maxhp
		draw_bar(20, 6)
		self.angle = 270
	end
	#--------------------------------------------------------------------------
	# ● update
	#--------------------------------------------------------------------------
	def update
		super
		if @actor.nil?
			self.bitmap.clear
			return
		end
		if @hp != @actor.hp or @maxhp != @actor.maxhp
			refresh
		end
	end
	#--------------------------------------------------------------------------
	# ● draw_bar
	#--------------------------------------------------------------------------
	def draw_bar(radius, width)
		max = (@actor.hp * 360) / @actor.maxhp
		for j in 1..width
			for i in 0..max
				bx = Math.cos( (i * Math::PI) / 360) * (radius + j)
				by = Math.sin( (i * Math::PI) / 360) * (radius + j)
				case j
				when 1
					color = Color.new(74, 112, 29)
				when 2
					color = Color.new(77, 120, 29)
				when 3
					color = Color.new(80, 131, 28)
				when 4
					color = Color.new(85, 144, 27)
				when 5
					color = Color.new(89, 156, 26)
				when 6
					color = Color.new(93, 167, 26)
				end
				self.bitmap.set_pixel(30 + bx, by, color)
			end
		end
	end
end

#==============================================================================
# ■ Sprite_SP
#------------------------------------------------------------------------------
#  the HUD's sp bar
#==============================================================================

class Sprite_SP < Sprite
	#--------------------------------------------------------------------------
	# ● instances
	#--------------------------------------------------------------------------
	attr_writer :actor
	#--------------------------------------------------------------------------
	# ● initialize
	#--------------------------------------------------------------------------
	def initialize(actor = nil)
		super(nil)
		self.z = 202
		self.bitmap = Bitmap.new(60, 26)
		@actor = actor
		if !@actor.nil?
			@sp = @actor.sp
			@maxsp = @actor.maxsp
		end
		refresh
	end
	#--------------------------------------------------------------------------
	# ● refresh
	#--------------------------------------------------------------------------
	def refresh
		self.bitmap.clear
		return if @actor.nil?
		@sp = @actor.sp
		@maxsp = @actor.maxsp
		draw_bar(20, 6)
		self.angle = 90
		self.mirror = true
	end
	#--------------------------------------------------------------------------
	# ● update
	#--------------------------------------------------------------------------
	def update
		super
		if @actor.nil?
			self.bitmap.clear
			return
		end
		if @sp != @actor.sp or @maxsp != @actor.maxsp
			refresh
		end
	end
	#--------------------------------------------------------------------------
	# ● draw_bar
	#--------------------------------------------------------------------------
	def draw_bar(radius, width)
		max = (@actor.sp * 360) / @actor.maxsp
		for j in 1..width
			for i in 0..max
				bx = Math.cos( (i * Math::PI) / 360) * (radius + j)
				by = Math.sin( (i * Math::PI) / 360) * (radius + j)
				case j
				when 1
					color = Color.new(29, 82, 112)
				when 2
					color = Color.new(29, 86, 120)
				when 3
					color = Color.new(28, 90, 131)
				when 4
					color = Color.new(27, 96, 144)
				when 5
					color = Color.new(26, 102, 156)
				when 6
					color = Color.new(26, 106, 167)
				end
				self.bitmap.set_pixel(30 + bx, by, color)
			end
		end
	end
end

#==============================================================================
# ■ Sprite_HUD
#------------------------------------------------------------------------------
#  draws the HUD on the map
#==============================================================================

class Sprite_HUD < Sprite
	#--------------------------------------------------------------------------
	# ● initialize
	#--------------------------------------------------------------------------
	def initialize(corner = 4)
		super(nil)
		self.z = 200
		for actor in $game_party.actors
			next if actor.dead?
			@actor = actor
			@actor_index = $game_party.actors.index(@actor)
			break
		end
		@hp_sprite = Sprite_HP.new(@actor)
		@sp_sprite = Sprite_SP.new(@actor)
		self.bitmap = Bitmap.new(60, 60)
		case corner
		when 1
			x = 16
			y = 16
		when 2
			x = 640 - 52 - 16
			y = 16
		when 3
			x = 16
			y = 480 - 52 - 16
		when 4
			x = 640 - 52 - 16
			y = 480 - 52 - 16
		end
		self.x = x
		self.y = y
		@hp_sprite.x = x + 27
		@hp_sprite.y = y - 3
		@sp_sprite.x = x + 27 - 1
		@sp_sprite.y = y - 3 - 1 + 60
		refresh
	end
	#--------------------------------------------------------------------------
	# ● refresh
	#--------------------------------------------------------------------------
	def refresh
		self.bitmap.clear
		return if @actor.nil?
		bmp = RPG::Cache.character(@actor.character_name, @actor.character_hue)
		rect = Rect.new(0, 0, bmp.width / 4, (bmp.height / 4))
		self.bitmap.blt(27 - bmp.width / 8, 5, bmp, rect)
		self.bitmap.blt(0, 0, RPG::Cache.picture("hud"), Rect.new(0, 0, 60, 60))
	end
	#--------------------------------------------------------------------------
	# ● update
	#--------------------------------------------------------------------------
	def update
		super
		@hp_sprite.update
		@sp_sprite.update
		if @actor != $game_party.actors[@actor_index]
			@actor = $game_party.actors[@actor_index]
			@hp_sprite.actor = @actor
			@sp_sprite.actor = @actor
			@hp_sprite.refresh
			@sp_sprite.refresh
			refresh
		end
	end
end

#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  draws the hud on the map screen
# @khhud_corner is the corner you want the hud to be displayed in.
# 1 is upper left, 2 is upper right, 3 is bottom left and 4 is bottom right
#==============================================================================

class Scene_Map
	alias main_khhud main
	alias update_khhud update
	alias transfer_khhud transfer_player
	#--------------------------------------------------------------------------
	# ● initialize
	#--------------------------------------------------------------------------
	def initialize
		@khhud_corner = 4 # 1 or 2 or 3 or 4
	end
	#--------------------------------------------------------------------------
	# ● main
	#--------------------------------------------------------------------------
	def main
		@hud = Sprite_HUD.new(@khhud_corner)
		main_khhud
		@hud.dispose
	end
	#--------------------------------------------------------------------------
	# ● update
	#--------------------------------------------------------------------------
	def update
		@hud.update
		update_khhud
	end
end

 

 

 

 

Setta dei makeratori originali™ - SMO - #settadeimakeratorioriginali

 

 

<DarK-SePHiRoTH-> raga sono mancato un anno ma a quanto vedo mahun non ha ancora imparato a disegnare :O

 

<cip_e_ciop> picasso ha fatto per la pittura ciò che mahun ha fatto per i fumetti

Link to comment
Share on other sites

  • 1 month later...
  • 10 months later...
la barra dell'energia del personaggio principale appare in basso a destra nello schermo come in kingdom hearts ;)

"Dopo gli ultimi Final Fantasy, ho capito solamente una cosa: che il gioco è bello quando Nomura poco."

Making is not dead. You are dead.
RELEASE: La Bussola d'Oro | Download | Video di anteprima - La Partenza di Hanna

http://i.imgur.com/cFgc2lW.png

Prova Standrama!

Link to comment
Share on other sites

  • 2 weeks later...

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