Jump to content
Zerbu

Zerbu Engine - Change (in game) or Randomize Game Over Graphic

Recommended Posts

Change or Randomize Game Over Graphic

 

Introduction

This script allows you to change the game over graphic in-game, and/or randomize between more than one graphic.

 

Instructions

To change the game over graphic in the game:

ze_chrgameover(:graphics, ["NewGameover"])

 

To change to a list of random graphics:

ze_chrgameover(:graphics, ["Image1", "Image2", "etc"])

 

Script

 

 

#============================================================================
# Zerbu Engine - Change or Randomize Game Over Graphic
#----------------------------------------------------------------------------
# This script allows you to change the game over graphic in-game, and/or
# randomize between more than one graphic.
#----------------------------------------------------------------------------
# To change the game over graphic in the game:
# ze_chrgameover(:graphics, ["NewGameover"])
#----------------------------------------------------------------------------
# To change to a list of random graphics:
# ze_chrgameover(:graphics, ["Image1", "Image2", "etc"])
#============================================================================

#============================================================================
# ZE_Change_Randomize_Game_Over
#============================================================================
class ZE_Change_Randomize_Game_Over
 #--------------------------------------------------------------------------
 # new method: initialize
 #--------------------------------------------------------------------------
 def initialize
#---
@data = {
  #----------------------------------------------------------------------
  # Options
  #----------------------------------------------------------------------
  # This option will enable or disable the system. When it is disabled,
  # the usual game over graphic will be used.
  #----------------------------------------------------------------------
  :ENABLED => true,
  #----------------------------------------------------------------------
  # This is a list of the possible graphics that can be used as the
  # game over screen.
  #----------------------------------------------------------------------
  :GRAPHICS => ["Gameover"]
}
#---
 end

 #--------------------------------------------------------------------------
 # new method: []
 #--------------------------------------------------------------------------
 def [](setting)
#---
@data[setting] || false
#---
 end

 #--------------------------------------------------------------------------
 # new method: []=
 #--------------------------------------------------------------------------
 def []=(setting, value)
#---
@data[setting] = value
#---
 end
end

#============================================================================
# DataManager
#============================================================================
module DataManager
 class << self
#------------------------------------------------------------------------
# alias method: create_game_objects
#------------------------------------------------------------------------
alias ze_chrgameover_create_game_objects create_game_objects
def create_game_objects
  #---
  ze_chrgameover_create_game_objects
  $ze_chrgameover = ZE_Change_Randomize_Game_Over.new
  #---
end

#------------------------------------------------------------------------
# alias method: make_save_contents
#------------------------------------------------------------------------
alias ze_chrgameover_make_save_contents make_save_contents
def make_save_contents
  #---
  contents = ze_chrgameover_make_save_contents
  contents[:ze_chrgameover] = $ze_chrgameover
  contents
  #---
end

#------------------------------------------------------------------------
# alias method: extract_save_contents
#------------------------------------------------------------------------
alias ze_chrgameover_extract_save_contents extract_save_contents
def extract_save_contents(contents)
  #---
  ze_chrgameover_extract_save_contents(contents)
  $ze_chrgameover = contents[:ze_chrgameover] ? contents[:ze_chrgameover] : ze_chrgameover.new
  #---
end
 end
end

#============================================================================
# Scene_Gameover
#============================================================================
class Scene_Gameover < Scene_Base
 #--------------------------------------------------------------------------
 # alias method: create_background
 #--------------------------------------------------------------------------
 alias ze_chrgameover_create_background create_background
 def create_background
#---
if $ze_chrgameover[:ENABLED]
  @sprite = Sprite.new
  @sprite.bitmap = Cache.system($ze_chrgameover[:GRAPHICS][rand($ze_chrgameover[:GRAPHICS].size)])
else
  ze_chrgameover_create_background
end
#---
 end
end

#============================================================================
# Game_Interpreter
#============================================================================
class Game_Interpreter
 #--------------------------------------------------------------------------
 # new method: ze_chrgameover
 #--------------------------------------------------------------------------
 def ze_chrgameover(setting, value)
#---
$ze_chrgameover[setting.upcase] = value
#---
 end
end

 

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted