diablosbud
Member
Game Over Menu (Command_Rotate) by Diablosbud [V1.0]
Â
  Description:Â
   Â
   Make your Gameover screen easier to use, and cooler with this script I made for Command_Rotate. This script allows the player, on Gameover to choose if they would like to "Load Game" or "Exit Game". A special feature has been added to the "Exit Game" choice, now you can either exit to the titlescreen or shutdown the game (This is an edit of LordSmith's Gameover Menu re-made with Command_Rotate to make it much cooler). Many features about this are customizable too, such as font, font size, disabled item colour, etc.
  Screenshots:
  Scripts:
Make sure that you put Command_Rotate above Game Over Menu or it causes an error!
  Demo:
Mega Upload: http://www.megaupload.com/?d=V10V5D4L
Rapid Share: http://rapidshare.com/files/99843613/Ga ... u.rar.html
  Author's Notes:
If used please give credits to
-Diablosbud
-KHMP
-LordSmith
As scripters or something alike if you use this script in your game!
!If you find a bug please report it with the error message and both your scripts so I can find a fix to the problem!
Here is a link to the Command_Rotate topic: http://www.rmxp.org/forums/index.php?to ... .msg222114
Link Updated was broken, because it was linked to a message in the topic :thumb:
I forgot to state that this needs the selection cursor moved once because the way Command_Rotate works it will not select that option until you move the cursor at least once (I mean selection cursor)!
Add-On #1 Are You Sure You Want to Quit Option by meh_meh
Customized for Game Over Menu by Diablosbud
Add-On #1
Add-On #1 also requires an updated version of Game Over Menu here:
Remember this add-on must be below the Game Over Menu script! The demo has not been updated for this add-on because it is simply plug n' play.
Screenshot:
http://img360.imageshack.us/img360/4581/exampleaddononeiv6.th.jpg[/img]
Thank you for reviewing my script and if you would please critique the script in a post :thumb:. Hope you like the script :smile:!
Â
  Description:Â
   Â
   Make your Gameover screen easier to use, and cooler with this script I made for Command_Rotate. This script allows the player, on Gameover to choose if they would like to "Load Game" or "Exit Game". A special feature has been added to the "Exit Game" choice, now you can either exit to the titlescreen or shutdown the game (This is an edit of LordSmith's Gameover Menu re-made with Command_Rotate to make it much cooler). Many features about this are customizable too, such as font, font size, disabled item colour, etc.
  Screenshots:
http://img296.imageshack.us/img296/1690/gameovermenuscreenshot1ja1.th.jpg[/img] http://img134.imageshack.us/img134/4954/gameovermenuscreenshot2oo1.th.jpg[/img]
Sorry for quality loss it's Image Shack, it's a .jpg and the red box around the choices is just to indicate that it is the script's modification.
Sorry for quality loss it's Image Shack, it's a .jpg and the red box around the choices is just to indicate that it is the script's modification.
  Scripts:
Code:
#===============================================================================
# Game Over Menu Script V1.0Â Â Â Â Â Â Â Â Â Â Â Â Â ~By Diablosbud~Â Â Â
#-------------------------------------------------------------------------------
#Â Â Make your Gameover screen easier to use, and cooler with this script I made
#Â for Command_Rotate. This script allows the player, on Gameover to choose if
#Â they would like to "Load Game" or "Exit Game". A special feature has been added
#Â to the "Exit Game" choice, now you can either exit to the titlescreen or
# shutdown the game (This is an edit of LordSmith's Gameover Menu re-made with
#Â Command_Rotate to make it much cooler). Many features about this are customizable
#Â too, such as font, font size, disabled item colour, etc.
#
#Â Requirements:
#Â -Command_Rotate script
#Â -This script
#
#Â Compatibility:
#Â -I am unsure yet if this script is compatible with the SDK
#Â
#Â Credit
#Â -Diablosbud
#Â -KHMP
#Â -LordSmith
#===============================================================================
#=========================================================
# Command_Rotate
#---------------------------------------------------------
#
# Created by LordSith
# email: lordsith@globetrotter.net
# Version: 1.1
# Date: 2007-06-08
#---------------------------------------------------------
#
#=========================================================
#==============================================================================
# ** Sprite_Text
#------------------------------------------------------------------------------
#Â This class draws text on the screen without the need of a window.
#==============================================================================
class Sprite_Text
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :sprite, # The sprite used to draw.
        :vx,   # The velocity in the x direction.
        :vy    # The velocity in the y direction.
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(text = 'nil', size = 50, font = 'Times New Roman', disabled = false,
         disabledcolor = Color.new(255, 255, 255, 108),
         vx = 0, vy = 0)
 Â
  # Turn the text into a string even if it already is a string.
  text = text.to_s
 Â
  # Create the sprite that will allow drawing.
  @sprite = Sprite.new
  @sprite.bitmap = Bitmap.new(1,1)
 Â
  # Initialize the sprite's bitmap's font properties.
  @sprite.bitmap.font.name = font
  @sprite.bitmap.font.size = size
 Â
  # Find out the size of the text so the sprite doesn't waste empty space.
  lx = @sprite.bitmap.text_size(text).width
  ly = @sprite.bitmap.text_size(text).height
 Â
  # Initialize the velocity vector
  @vx, @vy = vx, vy
 Â
  # The offset of the shadow for the text.
  shadow = 1
 Â
  # Reinitialize the bitmap with the proper size.
  @sprite.bitmap = Bitmap.new(lx + shadow, ly + shadow)
  # Make the z outstanding.
  @sprite.z = 5000
  @sprite.x = @x = 320.0
  @sprite.y = @y = 240.0
 Â
  # Draw the shadow first.
  @sprite.bitmap.font.color = Color.new(0,0,0,255)
  @sprite.bitmap.draw_text(Rect.new(shadow, shadow, lx + shadow,ly + shadow),
   text, 0)
 Â
  # If the sprite is disabled change the text color appropriately.
  @sprite.bitmap.font.color = disabled ? disabledcolor :
   Color.new(255,255,255,255) # White if not disabled.
 Â
  # Draw the text onto the bitmap finally.
  @sprite.bitmap.draw_text(Rect.new(0, 0, lx, ly), text)
 end
 #--------------------------------------------------------------------------
 # * Defining X, Y
 #--------------------------------------------------------------------------
 def xy(x, y)
  @x = x
  @y = y
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
  angle = Math.atan2(@vx,@vy)
 Â
  vx = 2 * Math.sin(angle)
  vy = 2 * Math.cos(angle)
 Â
  @x += vx
  @y += vy
 Â
  @sprite.x = @x
  @sprite.y = @y
  @sprite.opacity -= 4
 Â
  if @x > 640 or @x < 0 or @y > 480 or @y < 0 or @sprite.opacity <= 0
   @sprite.bitmap.dispose unless @sprite.bitmap.disposed?
   @sprite.dispose unless @sprite.disposed?
   return true
  end
 Â
  return false
 end
 #--------------------------------------------------------------------------
 # * Disposal
 #--------------------------------------------------------------------------
 def dispose
  @sprite.bitmap.dispose unless @sprite.bitmap.disposed?
  @sprite.dispose unless @sprite.disposed?
 end
end
def coords(x=0,y="")
 if y.is_a?(String)
  if x==0
   x=$game_player.screen_x
   y=$game_player.screen_y
  else
   y=$game_map.events[x].screen_y
   x=$game_map.events[x].screen_x
  end
  return [x,y]
 elsif x.is_a?(String)
  if y == 0
   x = $game_player.screen_x
   y = $game_player.screen_y
  else
   x = $game_map.events[y].screen_x
   y = $game_map.events[y].screen_y
  end
  return [x,y]
 end
 return [x,y]  Â
end
def angle(x1,y1,x2,y2)
 return 180*Math.atan2(x2-x1,y2-y1)/Math::PI
end
def ecart(id1,id2=0,y1="",y2="")
 x1=coords(id1,y1).at(0)
 y1=coords(id1,y1).at(1)
 x2=coords(id2,y2).at(0)
 y2=coords(id2,y2).at(1)
 return ((x1-x2)**2 + (y1-y2)**2)**0.5
end
#==============================================================================
# ** Command_Rotate
#------------------------------------------------------------------------------
#Â This class presents options in circuitous manner.
#==============================================================================
class Command_Rotate
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :index
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(choices, x = 400, y = 240, ray = 200, choices0 = 0,
         size = 50, font = 'Times New Roman', disabled_items = nil,
         disabledcolor = Color.new(255, 255, 255, 108))
  # By default visible.
  @visible = true
 Â
  @text_sprites = []
  @positions = []
  @options = choices
  @disabledcolor = disabledcolor
  @ray = ray
  @angle = 0
  @disabled_items = disabled_items
  @x, @y = coords(x, y)
  n = 0
 Â
  for choice in choices
   # Don't check for disabled items if it's nil.
   if !disabled_items.nil? && disabled_items.include?(n)
    text_sprite = Sprite_Text.new(choice, size, font, true, @disabledcolor)Â
   else
    text_sprite = Sprite_Text.new(choice, size, font)
   end
  Â
   text_sprite.sprite.ox = text_sprite.sprite.bitmap.width / 2
   text_sprite.sprite.oy = text_sprite.sprite.bitmap.height / 2
  Â
   teta = n * 360 / choices.size
   @text_sprites << text_sprite
   @positions << teta
   @delay=0
   n+=1
  end
 Â
  @angle = (@options.size-choices0) * 2 * Math::PI / @options.size
  @selected = @options[choices0]
  @index_self = 0
  update
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
  @angle -= (@angle - (@options.size - @index_self) * 2 * Math::PI /
   @options.size) / 8
  i = 0
 Â
  @text_sprites.each do |text_sprite|
   a = @positions.at(i) * Math::PI / 180
   text_sprite.sprite.x = 0
   text_sprite.sprite.x += @x
   text_sprite.sprite.y = @ray * Math.sin(a + @angle) / 2
   text_sprite.sprite.y+=@y
   text_sprite.sprite.zoom_x = text_sprite.sprite.zoom_y = (Math.cos(a + @angle) + 3) / 4
   text_sprite.sprite.opacity = (1 + Math.cos(a + @angle)) * 255 / 2
   i += 1
  end
 Â
  @delay-=1
  if @delay<=0
   if Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)
    @index_self += 1
    @selected = @options[@index_self % @text_sprites.size]
    @index = @options.index(@selected)
   end
   if Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
    @index_self -= 1   Â
    @selected = @options[@index_self % @text_sprites.size]
    @index = @options.index(@selected)
   end
   @delay=1
  end
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------
 def dispose
  @text_sprites.each {|sprite| sprite.dispose}
 end
 #--------------------------------------------------------------------------
 # * Visible
 #--------------------------------------------------------------------------
 def visible=(visible)
  return if @visible == visible
  @visible = visible
  @text_sprites[@options.index(@selected)].sprite.visible = @visible
 end
 #--------------------------------------------------------------------------
 # * Visible Accessor
 #--------------------------------------------------------------------------
 def visible
  return @visible
 end
end
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#Â This class performs game over screen processing.
#==============================================================================
class Scene_Gameover
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
  # By default we assume there are no save games.
  @continue_enabled = false
 Â
  # Loop through the possible save indexes and determine if a save exist.
  for i in 0..3
   if FileTest.exist?("Save#{i+1}.rxdata")
    @continue_enabled = true
   end
  end
  # The possible options to select.
  s1 = 'Load Game'
  s2 = 'Exit Game'
 Â
  # Creating a command rotate object.
  @commands1 = Command_Rotate.new([s1, s2], # Possible options
             320,   # X Starting point
             380,   # Y Starting point
             100,   # Ray to rotate around?
             0,    # Starting choice
             40,   # Font size to use
             'Times New Roman', # Font name to use
             @continue_enabled ? nil : [0], # Disabled items array.
             Color.new(255, 0, 0, 108)) # Color of disabled items
 Â
  # Change the strings to fit the new window.
  s1 = 'To Titlescreen'
  s2 = 'Shutdown'
 Â
  # Creating a command rotate object.
  @commands2 = Command_Rotate.new([s1, s2], # Possible options
             320,   # X Starting point
             380,   # Y Starting point
             100,   # Ray to rotate around?
             0,    # Starting choice
             40,   # Font size to use
             'Times New Roman') # Font name to use
  @commands2.visible = false
 Â
  # Make game over graphic
  @sprite = Sprite.new
  @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name) Â
  # Play game over ME
  $game_system.me_play($data_system.gameover_me) Â
  # Execute transition
  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 Command_Rotate
  @commands1.dispose
  @commands2.dispose
 Â
  # Dispose of title graphic
  @sprite.bitmap.dispose unless @sprite.bitmap.disposed?
  @sprite.dispose unless @sprite.disposed?
 end
 #--------------------------------------------------------------------------
 # Frame Update
 #--------------------------------------------------------------------------
 def update
  # Update Command_Rotate only if it's visible.
  @commands1.update if @commands1.visible
  @commands2.update if @commands2.visible
 Â
  # If the initial Command_Rotate is visible.
  if @commands1.visible
   # If C button was pressed
   if Input.trigger?(Input::C)
    # Branch by command window cursor position
    case @commands1.index
    when 0 # Load game
     command_continue
    when 1 # Exit Game
     command_exit
    end
   end
  else
   # If the B button was pressed, go back.
   if Input.trigger?(Input::B)
    @commands1.visible = true
    @commands2.visible = false
   end
  Â
   # If C button was pressed
   if Input.trigger?(Input::C)
    # Branch by command window cursor position
    case @commands2.index
    when 0 # Load game
     command_to_title
    when 1 # Exit Game
     command_shutdown
    end
   end
  end
 end
 #--------------------------------------------------------------------------
 # * Command: Continue
 #--------------------------------------------------------------------------
 def command_continue
  # If continue is disabled
  unless @continue_enabled
   # Play buzzer SE
   $game_system.se_play($data_system.buzzer_se)
   return
  end
  # Play decision SE
  $game_system.se_play($data_system.decision_se)
  # Switch to load screen
  $scene = Scene_Load.new
 end
 #--------------------------------------------------------------------------
 # Command: Exit
 #--------------------------------------------------------------------------
 def command_exit
  # Play decision SE
  $game_system.se_play($data_system.decision_se)
  # Alter the viewing of what windows.
  @commands1.visible = false
  @commands2.visible = true
 end
 #--------------------------------------------------------------------------
 # Command: To Titlescreen
 #--------------------------------------------------------------------------
 def command_to_title
  # Play decision SE
  $game_system.se_play($data_system.decision_se)
  # Fade out BGM, BGS, and ME
  Audio.bgm_fade(800)
  Audio.bgs_fade(800)
  Audio.me_fade(800)
  # Shutdown
  $scene = Scene_Title.new
 endÂ
 #--------------------------------------------------------------------------
 # Command: Shutdown
 #--------------------------------------------------------------------------
 def command_shutdown
  # Play decision SE
  $game_system.se_play($data_system.decision_se)
  # Fade out BGM, BGS, and ME
  Audio.bgm_fade(800)
  Audio.bgs_fade(800)
  Audio.me_fade(800)
  # Shutdown
  $scene = nil
 end
end
Code:
#=========================================================
# Command_Rotate
#---------------------------------------------------------
#
# Created by LordSith
# email: lordsith@globetrotter.net
# Version: 1.1
# Date: 2007-06-08
#---------------------------------------------------------
#
#=========================================================
def coords(x=0,y="")
 if y.is_a?(String)
    if x==0
    x=$game_player.screen_x
    y=$game_player.screen_y
    else
    y=$game_map.events[x].screen_y
    x=$game_map.events[x].screen_x
    end
    return [x,y]
  end
  if x.is_a?(String)
    if y==0
    x=$game_player.screen_x
    y=$game_player.screen_y
    else
     x=$game_map.events[y].screen_x
     y=$game_map.events[y].screen_y
    end
    return [x,y]
   end
 return [x,y]  Â
end
def angle(x1,y1,x2,y2)
  return 180*Math.atan2(x2-x1,y2-y1)/Math::PI
end
def ecart(id1,id2=0,y1="",y2="")
 x1=coords(id1,y1).at(0)
 y1=coords(id1,y1).at(1)
 x2=coords(id2,y2).at(0)
 y2=coords(id2,y2).at(1)
 return ((x1-x2)**2+(y1-y2)**2)**0.5
end
class Command_Rotate
Â
 attr_accessor:index
Â
 def initialize(choices, x=400, y=240, ray=200, choices0=0,
         size=20, font=$defaultfonttype, disabled_items=nil,
         disabledcolor=Color.new(255, 255, 255, 108))
  @sprite=[]
  @positions=[]
  @options=choices
  @disabledcolor=disabledcolor
  @ray=ray
  @angle=0
  @disabled_items = disabled_items
  x,y=coords(x,y)
  @x,@y=x,y
  n=0
  for c in choices
   if disabled_items.include?(n) and disabled_items != nil
    sprite=Sprite_text.new(c,size,font,true,@disabledcolor)Â
   else
    sprite=Sprite_text.new(c,size,font)
   end
   sprite.sprite.ox=sprite.sprite.bitmap.width/2
   sprite.sprite.oy=sprite.sprite.bitmap.height/2
   teta=n*360/choices.size
   @sprite+=[sprite]
   @positions+=[teta]
   @delay=0
   n+=1
  end
  @angle=(@options.size-choices0)*2*Math::PI/@options.size
  @selected=@options[choices0]
  @index_self=0
  update
 end
Â
 def update
  @angle-=(@angle-(@options.size-@index_self)*2*Math::PI/@options.size)/8
  for n in 0..@sprite.size-1
   sprite=@sprite.at(n)
   a=@positions.at(n)*Math::PI/180
   sprite.sprite.x=0
   sprite.sprite.x+=@x
   sprite.sprite.y=@ray*Math.sin(a+@angle)/2
   sprite.sprite.y+=@y
   sprite.sprite.zoom_x=sprite.sprite.zoom_y=(Math.cos(a+@angle)+3)/4
   sprite.sprite.opacity=(1+Math.cos(a+@angle))*255/2
  end
  @delay-=1
   if @delay<=0
    if Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)
     @index_self+=1
     @selected=@options[@index_self%@sprite.size]
     @index = @options.index(@selected)
    end
    if Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
     @index_self-=1   Â
     @selected=@options[@index_self%@sprite.size]
     @index = @options.index(@selected)
    end
   @delay=1
   end
 end
Â
 def dispose
  for sprite in @sprite
   sprite.dispose
  end
end
end
class Sprite_text
 def xy(x,y)
  @x=x
  @y=y
 end
 attr_accessor :sprite ,:vx ,:vy
Â
 def update
  angle=Math.atan2(@vx,@vy)
  vx=2*Math.sin(angle)
  vy=2*Math.cos(angle)
  @x+=vx
  @y+=vy
  @sprite.x =@x
  @sprite.y =@y
  @sprite.opacity-=4
  if @x>640 or @x<0 or @y>480 or @y<0 or @sprite.opacity<=0
   @sprite.bitmap.dispose
   @sprite=nil
   return true
  end
  return false
 end
Â
 def initialize(text="nil",size=23,font=$defaultfonttype,disabled=false,
         disabledcolor=Color.new(255, 255, 255, 108),vx=0,vy=0)
  text=text.to_s
  @sprite=Sprite.new
  @sprite.bitmap = Bitmap.new(1,1)
  @sprite.bitmap.font.name = font
  @sprite.bitmap.font.size = size
  lx=@sprite.bitmap.text_size(text).width
  ly=@sprite.bitmap.text_size(text).height
  @vx=vx
  @vy=vy
  shadow=1
  @sprite.bitmap = Bitmap.new(lx+shadow, ly+shadow)
  @sprite.bitmap.font.name = font
  @sprite.bitmap.font.size = size
  @sprite.z = 5000
  @sprite.x =@x=320.0
  @sprite.y =@y=240.0
  @sprite.bitmap.font.color = Color.new(0,0,0,255)
  @sprite.bitmap.draw_text(Rect.new(shadow,shadow,lx+shadow,ly+shadow), text, 0)
  if disabled
   @sprite.bitmap.font.color = disabledcolor
  else
   @sprite.bitmap.font.color = Color.new(255,255,255,255)
  end Â
  @sprite.bitmap.draw_text(Rect.new(0,0,lx,ly),text, 0)
 end
Â
 def dispose
  if @sprite.bitmap != nil
    @sprite.bitmap.dispose
  end
 end
end
Make sure that you put Command_Rotate above Game Over Menu or it causes an error!
  Demo:
Mega Upload: http://www.megaupload.com/?d=V10V5D4L
Rapid Share: http://rapidshare.com/files/99843613/Ga ... u.rar.html
  Author's Notes:
If used please give credits to
-Diablosbud
-KHMP
-LordSmith
As scripters or something alike if you use this script in your game!
!If you find a bug please report it with the error message and both your scripts so I can find a fix to the problem!
Here is a link to the Command_Rotate topic: http://www.rmxp.org/forums/index.php?to ... .msg222114
Link Updated was broken, because it was linked to a message in the topic :thumb:
I forgot to state that this needs the selection cursor moved once because the way Command_Rotate works it will not select that option until you move the cursor at least once (I mean selection cursor)!
Add-On #1 Are You Sure You Want to Quit Option by meh_meh
Customized for Game Over Menu by Diablosbud
Add-On #1
Code:
=begin
Are you sure you want to quit - meh_meh
http://www.rmxp.net/forums/index.php?showtopic=21585
meh_meh
Aug 24 2005, 08:44 PM
Ok, what this script does is revives something from the old makers, 2000 2003 etc... It would ask you when you went to Quit Game "Are you sure you want to quit?" And give you a choice yes or no. Here is a Screenie of what I mean.
Ok now, for the script. Like all others paste this script above main.
CODE
=end
#==============================================================================
# ¦ Window_Steps
#------------------------------------------------------------------------------
#==============================================================================
class Window_YouSure < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 58)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 320, 22, "Quit your current game?")
end
end
#==============================================================================
# ¦ Scene_YouSure
#------------------------------------------------------------------------------
# Created By: Bad_Assassin
#==============================================================================
class Scene_GYouSure
def main
@yousure_window = Window_YouSure.new
@yousure_window.x = 160
@yousure_window.y = 175
@command_window = Window_Command.new(90, ["Yes", "No"])
@command_window.x = 270
@command_window.y = 233
#---------------
Graphics.transition
#---------------
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
#---------------
Graphics.freeze
#---------------
@command_window.dispose
@yousure_window.dispose
end
#------------------------------------------------------------------------------
def update
@yousure_window.update
@command_window.update
#---------------
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_End.new
return
end
#---------------------------------
if Input.trigger?(Input::C)
case @command_window.index
#---------------------------------
when 0
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
#---------------------------------
when 1
$game_system.se_play($data_system.decision_se)
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# Cancel
#--------------------------------------------------------------------------
def command_cancel
# play decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_Gameover.new
end
end
# This is the script for exiting RMXP altogether. Just delete if you dont want it.
#==============================================================================
# ¦ Window_Steps
#------------------------------------------------------------------------------
#==============================================================================
class Window_YouSure2 < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 58)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 320, 22, "Exit to Windows?")
end
end
#==============================================================================
# ¦ Scene_YouSure2
#------------------------------------------------------------------------------
# Created By: Bad_Assassin
# Slightly Edited By: Killswitch_Engage
#==============================================================================
class Scene_GYouSure2
def main
@yousure_window = Window_YouSure2.new
@yousure_window.x = 160
@yousure_window.y = 175
@command_window = Window_Command.new(90, ["Yes", "No"])
@command_window.x = 270
@command_window.y = 233
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@yousure_window.dispose
end
#------------------------------------------------------------------------------
def update
@yousure_window.update
@command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_End.new
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
when 1
$game_system.se_play($data_system.decision_se)
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# Cancel
#--------------------------------------------------------------------------
def command_cancel
# play decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_Gameover.new
end
end
Add-On #1 also requires an updated version of Game Over Menu here:
Code:
#===============================================================================
# Game Over Menu Script V1.0 ~By Diablosbud~
#-------------------------------------------------------------------------------
# Make your Gameover screen easier to use, and cooler with this script I made
# for Command_Rotate. This script allows the player, on Gameover to choose if
# they would like to "Load Game" or "Exit Game". A special feature has been added
# to the "Exit Game" choice, now you can either exit to the titlescreen or
# shutdown the game (This is an edit of LordSmith's Gameover Menu re-made with
# Command_Rotate to make it much cooler). Many features about this are customizable
# too, such as font, font size, disabled item colour, etc.
#
# Requirements:
# -Command_Rotate script
# -This script
#
# Compatibility:
# -I am unsure yet if this script is compatible with the SDK
#
# Credit
# -Diablosbud
# -KHMP
# -LordSmith
#===============================================================================
#=========================================================
# Command_Rotate
#---------------------------------------------------------
#
# Created by LordSith
# email: lordsith@globetrotter.net
# Version: 1.1
# Date: 2007-06-08
#---------------------------------------------------------
#
#=========================================================
#==============================================================================
# ** Sprite_Text
#------------------------------------------------------------------------------
# This class draws text on the screen without the need of a window.
#==============================================================================
class Sprite_Text
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sprite, # The sprite used to draw.
:vx, # The velocity in the x direction.
:vy # The velocity in the y direction.
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(text = 'nil', size = 50, font = 'Times New Roman', disabled = false,
disabledcolor = Color.new(255, 255, 255, 108),
vx = 0, vy = 0)
# Turn the text into a string even if it already is a string.
text = text.to_s
# Create the sprite that will allow drawing.
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new(1,1)
# Initialize the sprite's bitmap's font properties.
@sprite.bitmap.font.name = font
@sprite.bitmap.font.size = size
# Find out the size of the text so the sprite doesn't waste empty space.
lx = @sprite.bitmap.text_size(text).width
ly = @sprite.bitmap.text_size(text).height
# Initialize the velocity vector
@vx, @vy = vx, vy
# The offset of the shadow for the text.
shadow = 1
# Reinitialize the bitmap with the proper size.
@sprite.bitmap = Bitmap.new(lx + shadow, ly + shadow)
# Make the z outstanding.
@sprite.z = 5000
@sprite.x = @x = 320.0
@sprite.y = @y = 240.0
# Draw the shadow first.
@sprite.bitmap.font.color = Color.new(0,0,0,255)
@sprite.bitmap.draw_text(Rect.new(shadow, shadow, lx + shadow,ly + shadow),
text, 0)
# If the sprite is disabled change the text color appropriately.
@sprite.bitmap.font.color = disabled ? disabledcolor :
Color.new(255,255,255,255) # White if not disabled.
# Draw the text onto the bitmap finally.
@sprite.bitmap.draw_text(Rect.new(0, 0, lx, ly), text)
end
#--------------------------------------------------------------------------
# * Defining X, Y
#--------------------------------------------------------------------------
def xy(x, y)
@x = x
@y = y
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
angle = Math.atan2(@vx,@vy)
vx = 2 * Math.sin(angle)
vy = 2 * Math.cos(angle)
@x += vx
@y += vy
@sprite.x = @x
@sprite.y = @y
@sprite.opacity -= 4
if @x > 640 or @x < 0 or @y > 480 or @y < 0 or @sprite.opacity <= 0
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
return true
end
return false
end
#--------------------------------------------------------------------------
# * Disposal
#--------------------------------------------------------------------------
def dispose
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
end
end
def coords(x=0,y="")
if y.is_a?(String)
if x==0
x=$game_player.screen_x
y=$game_player.screen_y
else
y=$game_map.events[x].screen_y
x=$game_map.events[x].screen_x
end
return [x,y]
elsif x.is_a?(String)
if y == 0
x = $game_player.screen_x
y = $game_player.screen_y
else
x = $game_map.events[y].screen_x
y = $game_map.events[y].screen_y
end
return [x,y]
end
return [x,y]
end
def angle(x1,y1,x2,y2)
return 180*Math.atan2(x2-x1,y2-y1)/Math::PI
end
def ecart(id1,id2=0,y1="",y2="")
x1=coords(id1,y1).at(0)
y1=coords(id1,y1).at(1)
x2=coords(id2,y2).at(0)
y2=coords(id2,y2).at(1)
return ((x1-x2)**2 + (y1-y2)**2)**0.5
end
#==============================================================================
# ** Command_Rotate
#------------------------------------------------------------------------------
# This class presents options in circuitous manner.
#==============================================================================
class Command_Rotate
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(choices, x = 400, y = 240, ray = 200, choices0 = 0,
size = 50, font = 'Times New Roman', disabled_items = nil,
disabledcolor = Color.new(255, 255, 255, 108))
# By default visible.
@visible = true
@text_sprites = []
@positions = []
@options = choices
@disabledcolor = disabledcolor
@ray = ray
@angle = 0
@disabled_items = disabled_items
@x, @y = coords(x, y)
n = 0
for choice in choices
# Don't check for disabled items if it's nil.
if !disabled_items.nil? && disabled_items.include?(n)
text_sprite = Sprite_Text.new(choice, size, font, true, @disabledcolor)
else
text_sprite = Sprite_Text.new(choice, size, font)
end
text_sprite.sprite.ox = text_sprite.sprite.bitmap.width / 2
text_sprite.sprite.oy = text_sprite.sprite.bitmap.height / 2
teta = n * 360 / choices.size
@text_sprites << text_sprite
@positions << teta
@delay=0
n+=1
end
@angle = (@options.size-choices0) * 2 * Math::PI / @options.size
@selected = @options[choices0]
@index_self = 0
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@angle -= (@angle - (@options.size - @index_self) * 2 * Math::PI /
@options.size) / 8
i = 0
@text_sprites.each do |text_sprite|
a = @positions.at(i) * Math::PI / 180
text_sprite.sprite.x = 0
text_sprite.sprite.x += @x
text_sprite.sprite.y = @ray * Math.sin(a + @angle) / 2
text_sprite.sprite.y+=@y
text_sprite.sprite.zoom_x = text_sprite.sprite.zoom_y = (Math.cos(a + @angle) + 3) / 4
text_sprite.sprite.opacity = (1 + Math.cos(a + @angle)) * 255 / 2
i += 1
end
@delay-=1
if @delay<=0
if Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)
@index_self += 1
@selected = @options[@index_self % @text_sprites.size]
@index = @options.index(@selected)
end
if Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
@index_self -= 1
@selected = @options[@index_self % @text_sprites.size]
@index = @options.index(@selected)
end
@delay=1
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@text_sprites.each {|sprite| sprite.dispose}
end
#--------------------------------------------------------------------------
# * Visible
#--------------------------------------------------------------------------
def visible=(visible)
return if @visible == visible
@visible = visible
@text_sprites[@options.index(@selected)].sprite.visible = @visible
end
#--------------------------------------------------------------------------
# * Visible Accessor
#--------------------------------------------------------------------------
def visible
return @visible
end
end
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
# This class performs game over screen processing.
#==============================================================================
class Scene_Gameover
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# By default we assume there are no save games.
@continue_enabled = false
# Loop through the possible save indexes and determine if a save exist.
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# The possible options to select.
s1 = 'Load Game'
s2 = 'Exit Game'
# Creating a command rotate object.
@commands1 = Command_Rotate.new([s1, s2], # Possible options
320, # X Starting point
380, # Y Starting point
100, # Ray to rotate around?
0, # Starting choice
40, # Font size to use
'Times New Roman', # Font name to use
@continue_enabled ? nil : [0], # Disabled items array.
Color.new(255, 0, 0, 108)) # Color of disabled items
# Change the strings to fit the new window.
s1 = 'To Titlescreen'
s2 = 'Shutdown'
# Creating a command rotate object.
@commands2 = Command_Rotate.new([s1, s2], # Possible options
320, # X Starting point
380, # Y Starting point
100, # Ray to rotate around?
0, # Starting choice
40, # Font size to use
'Times New Roman') # Font name to use
@commands2.visible = false
# Make game over graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
# Play game over ME
$game_system.me_play($data_system.gameover_me)
# Execute transition
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 Command_Rotate
@commands1.dispose
@commands2.dispose
# Dispose of title graphic
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def update
# Update Command_Rotate only if it's visible.
@commands1.update if @commands1.visible
@commands2.update if @commands2.visible
# If the initial Command_Rotate is visible.
if @commands1.visible
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @commands1.index
when 0 # Load game
command_continue
when 1 # Exit Game
command_exit
end
end
else
# If the B button was pressed, go back.
if Input.trigger?(Input::B)
@commands1.visible = true
@commands2.visible = false
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @commands2.index
when 0 # Load game
command_to_title
when 1 # Exit Game
command_shutdown
end
end
end
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Loadslot.new
end
#--------------------------------------------------------------------------
# Command: Exit
#--------------------------------------------------------------------------
def command_exit
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Alter the viewing of what windows.
@commands1.visible = false
@commands2.visible = true
end
#--------------------------------------------------------------------------
# Command: To Titlescreen
#--------------------------------------------------------------------------
def command_to_title
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = Scene_GYouSure.new
end
#--------------------------------------------------------------------------
# Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = Scene_GYouSure2.new
end
end
Remember this add-on must be below the Game Over Menu script! The demo has not been updated for this add-on because it is simply plug n' play.
Screenshot:
http://img360.imageshack.us/img360/4581/exampleaddononeiv6.th.jpg[/img]
Thank you for reviewing my script and if you would please critique the script in a post :thumb:. Hope you like the script :smile:!