02-01-2005, 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.
Features:
Lets the player dash when the A key is depressed until the dash level hits zero. When dash key is released the dash level starts to restore itself. As well if you don't like the time it takes for the bar to increase or decrease you can change it as well as the initial off set time before anything happens ~!
Instructions:
Create a new page call it Dash_Mode and add the following code to it
Code:
#==============================================================================
# â–� Dash Mode
#------------------------------------------------------------------------------
# Near Fantastica
# 09/12/04
#=============================================================================
class Game_Player
#--------------------------------------------------------------------------
# â—? Refer Update to Game Player
#--------------------------------------------------------------------------
alias game_player_update update
#--------------------------------------------------------------------------
# â—? Update
#--------------------------------------------------------------------------
def update
if Input.press?(Input::A)
if moving?
# If A Key press enter dash mode
# reduce dash level
@move_speed=5
@restore = false
if @reduce == false
@timer = 50 # Initial time off set
@reduce = true
else
@timer-= 1
end
@sec = (@timer / Graphics.frame_rate)%60
if @sec == 0
if @dash_level != 0
@dash_level -= 1
@timer = 45 # Timer Count
end
end
if @dash_level == 0
@move_speed=4
end
$dash_bar.update(@dash_level)
end
else
# restore dash level
@move_speed=4
@reduce = false
if @restore == false
@timer = 80 # Initial time off set
@restore = true
else
@timer-= 1
end
@sec = (@timer / Graphics.frame_rate)%60
if @sec == 0
if @dash_level != 5
@dash_level+= 1
@timer = 60 # Timer Count
end
end
$dash_bar.update(@dash_level)
end
game_player_update
end
end
#==============================================================================
# â–� Bar Sprite
#------------------------------------------------------------------------------
# Used for Dash Mode displays bar pictures to screen
#=============================================================================
class Bar_Sprite < Sprite
#--------------------------------------------------------------------------
# â—? Initialization
#--------------------------------------------------------------------------
def initialize
super
self.x = 10
self.y = 460
self.z = 500
end
#--------------------------------------------------------------------------
# â—? Update Dash Bar Level
#--------------------------------------------------------------------------
def update(number)
@number = number
case number
when 0
self.bitmap = RPG::Cache.picture("bar 0")
when 1
self.bitmap = RPG::Cache.picture("bar 1")
when 2
self.bitmap = RPG::Cache.picture("bar 2")
when 3
self.bitmap = RPG::Cache.picture("bar 3")
when 4
self.bitmap = RPG::Cache.picture("bar 4")
when 5
self.bitmap = RPG::Cache.picture("bar 5")
end
end
#--------------------------------------------------------------------------
# â—? Dispose
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose
end
end
#==============================================================================
# â–� Game Character
#------------------------------------------------------------------------------
# Add Initialization of Dash Mode Varibles
#=============================================================================
class Game_Character
#--------------------------------------------------------------------------
# â—? Refer Initialization to Game Character
#--------------------------------------------------------------------------
alias dash_mode_initialize initialize
#--------------------------------------------------------------------------
# â—? Initialization
#--------------------------------------------------------------------------
def initialize
@restore = false
@reduce= false
@timer = 0
@dash_level = 5
@sec = 0
$dash_bar = Bar_Sprite.new
dash_mode_initialize
end
end
#==============================================================================
# â–� Scene_Map
#------------------------------------------------------------------------------
# Check for $dash_bar.dispose condition
#=============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# â—? Refer Update to Scene Map
#--------------------------------------------------------------------------
alias scene_map_call_battle call_battle
alias scene_map_call_shop call_shop
alias scene_map_call_name call_name
alias scene_map_call_menu call_menu
alias scene_map_call_save call_save
alias scene_map_call_debug call_debug
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is Battle called
#--------------------------------------------------------------------------
def call_battle
$dash_bar.dispose
scene_map_call_battle
end
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is called
#--------------------------------------------------------------------------
def call_shop
$dash_bar.dispose
scene_map_call_shop
end
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is Name called
#--------------------------------------------------------------------------
def call_name
$dash_bar.dispose
scene_map_call_name
end
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is Menu called
#--------------------------------------------------------------------------
def call_menu
$dash_bar.dispose
scene_map_call_menu
end
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is Save called
#--------------------------------------------------------------------------
def call_save
$dash_bar.dispose
scene_map_call_save
end
#--------------------------------------------------------------------------
# â—? Dispose of $dash_bar is Debug called
#--------------------------------------------------------------------------
def call_debug
$dash_bar.dispose
scene_map_call_debug
end
end