12-04-2006, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
This just displays a gold window on the map screen.
Code:
class Scene_Map
alias chronic_golddis_scnmap_main main
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make gold window
@golddisplay_window = Window_GoldDisplay.new
# Make message window
@message_window = Window_Message.new
# Transition run
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of gold window
@golddisplay_window.dispose
# Dispose of message window
@message_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
alias chronic_golddis_scnmap_update update
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update gold window
@golddisplay_window.update
# Update message window
@message_window.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
#======================================================================
# Window_GoldDisplay
#----------------------------------------------------------------------
# Shows a window to show the gold amount on the map screen.
#======================================================================
class Window_GoldDisplay < Window_Base
#====================================================================
# Object Initialization
#====================================================================
def initialize
# Set window size and position
super (490, 405, 150, 75)
self.contents = Bitmap.new(width - 32, height - 32)
# Set the opacity
self.back_opacity = 150
# Run the refresh definition
refresh
end
#====================================================================
# End of Object Initialization
#====================================================================
# Object Refresh
#====================================================================
def refresh
# Clear the contents
self.contents.clear
# Sets the text spacing variable
cx = contents.text_size($data_system.words.gold).width
# Make text normal color
self.contents.font.color = normal_color
# Draw text
self.contents.draw_text(10, 16, 100, 32, $game_party.gold.to_s, 2)
# Make text system color
self.contents.font.color = system_color
# Draw text
self.contents.draw_text(0, -8, cx, 32, $data_system.words.gold, 2)
end
#=====================================================================
# End of Object Refresh
#=====================================================================
end
#=======================================================================
# End Window_GoldDisplay
#=======================================================================