Guest Access
Go to page : 1, 2, 3
Active Member
Active Member
Active Member
profile
handy333
profile
Python? No, I tried it along time ago but it never stuck. What I mean is like when I use unity I can do something like this with c#:
//variables
someVariables
//update method
button inputs
//custom method
eh...
With Rgss in Rpg maker x...
This is to basically dash.
I got it from this site:
http://www.gdunlimited.net/forums/topic/8472-player-dash/
It's for rmxp.
//variables
someVariables
//update method
button inputs
//custom method
eh...
With Rgss in Rpg maker x...
- Code:
#==========================================================================
# ** Player : Dash
#=========================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Player.Dash', 'Kain Nobel ©', 3.5, '2009.06.17')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : Begin
#-------------------------------------------------------------------------------
if SDK.enabled?('Player.Dash')
#==========================================================================
# ** Game_Player::Dash
#==========================================================================
class Game_Player::Dash
#-----------------------------------------------------------------------------
# * Switch which disables the dash system and HUD
#-----------------------------------------------------------------------------
Switch_Disable = 1
#-----------------------------------------------------------------------------
# * Switch which disables exhaustion
#-----------------------------------------------------------------------------
Switch_Exhaust = 2
#-----------------------------------------------------------------------------
# * Maps which disable the dash system and HUD
#-----------------------------------------------------------------------------
Maps_Disabled = []
#-----------------------------------------------------------------------------
# * Scenes which don't display dash HUD (alternate scenes with Spriteset_Map)
#-----------------------------------------------------------------------------
Scenes_Disabled = true
#-----------------------------------------------------------------------------
# * Button used for Dashning
#-----------------------------------------------------------------------------
Button = Input::C
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :slow_speed
attr_accessor :walk_speed
attr_accessor :dash_speed
attr_accessor :stamina
attr_accessor :points
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@slow_speed = 3 # Speed for when player is exhausted
@walk_speed = 3.5 # Speed for when player is walking
@dash_speed = 5 # Speed for when player is dashing
@stamina = 1 # Steps player can take while dashing
@stamina_rate = 0.01 # Frames that stamina is replenished
@exhersion = @stamina / 8 # At the point where player exhausted
@points = @stamina # Sets points to stamina (don't touch)
end
#-----------------------------------------------------------------------------
# * Enabled?
#-----------------------------------------------------------------------------
def enabled?
return false if $game_switches[Switch_Disable]
return false if Maps_Disabled[$game_map.map_id]
if Scenes_Disabled == true
return false unless $scene.is_a?(Scene_Map)
else
return false if Scenes_Disabled.include?($scene.class.to_s)
end
return true
end
#-----------------------------------------------------------------------------
# * Increase Points
#-----------------------------------------------------------------------------
def increase_points(n)
@points = [[@points + n, @stamina].min, 0].max
end
#-----------------------------------------------------------------------------
# * Decrease Points
#-----------------------------------------------------------------------------
def decrease_points(n)
increase_points(-n)
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
unless enabled?
update_disabled
return
end
@disabled = false
if idle?
update_idle
return
elsif exhausted?
update_exhausted
return
elsif walking?
update_walking
return
elsif dashing?
update_dashing
return
end
end
#-----------------------------------------------------------------------------
# * Update Disabled
#-----------------------------------------------------------------------------
def update_disabled
unless @disabled
$game_player.move_speed = (Game_Player.new).move_speed
@disabled = true
end
end
#-----------------------------------------------------------------------------
# * Idle?
#-----------------------------------------------------------------------------
def idle?
!$game_player.moving?
end
#-----------------------------------------------------------------------------
# * Exhausted?
#-----------------------------------------------------------------------------
def exhausted?
@exhausted && !$game_switches[Switch_Exhaust]
end
#-----------------------------------------------------------------------------
# * Walking?
#-----------------------------------------------------------------------------
def walking?
return true if $game_player.move_route_forcing
$game_player.moving? && !Input.press?(Button)
end
#-----------------------------------------------------------------------------
# * Dashing?
#-----------------------------------------------------------------------------
def dashing?
return false if $game_system.map_interpreter.running?
return false if $game_temp.message_window_showing
return false if $game_player.move_route_forcing
$game_player.moving? && Input.press?(Button)
end
#-----------------------------------------------------------------------------
# * Update Idle
#-----------------------------------------------------------------------------
def update_idle
increase_points(exhausted? ? @stamina_rate * 0.5 : @stamina_rate)
if @points > (@exhersion)
@exhausted = false
end
end
#-----------------------------------------------------------------------------
# * Update Exhausted
#-----------------------------------------------------------------------------
def update_exhausted
$game_player.move_speed = @slow_speed
increase_points(@stamina_rate * 0.5)
if @points > (@exhersion)
@exhausted = false
end
end
#-----------------------------------------------------------------------------
# * Update Walking
#-----------------------------------------------------------------------------
def update_walking
$game_player.move_speed = @walk_speed
increase_points(@stamina_rate * 0.5)
end
#-----------------------------------------------------------------------------
# * Update Dashing
#-----------------------------------------------------------------------------
def update_dashing
unless $game_player.move_speed == @dash_speed
$game_player.move_speed += (@dash_speed * 0.1)
return
end
decrease_points(@stamina_rate * 2)
if @points.zero?
@exhausted = true
end
end
#-----------------------------------------------------------------------------
# * Last Move
#-----------------------------------------------------------------------------
def last_move
return 0 if idle?
return 1 if exhausted?
return 2 if walking?
return 3 if dashing?
end
end
#==========================================================================
# ** Game_Player
#==========================================================================
class Game_Player < Game_Character
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :move_speed
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :dashsystem_gmplayer_updateplayermove, :update_player_movement
#-----------------------------------------------------------------------------
# * Dash
#-----------------------------------------------------------------------------
def dash
@dash ||= Game_Player::Dash.new
@dash
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update_player_movement
dashsystem_gmplayer_updateplayermove
@dash.update
end
end
#==========================================================================
# ** Window_DashStamina
#==========================================================================
class Window_DashStamina < Window_Base
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
super(0, 416, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
@points = $game_player.dash.points
@last_move = $game_player.dash.last_move
self.contents.draw_seph_gradient_bar(0, 0, @points,
$game_player.dash.stamina, 128)
if $game_player.dash.idle?
color = ($game_player.dash.exhausted? ? Color.new(255,0,0) : normal_color)
self.contents.font.color = color
self.contents.draw_text(0, 0, 128, 32, "Idle", 1)
elsif $game_player.dash.exhausted?
self.contents.font.color = Color.new(255,0,0)
self.contents.draw_text(0, 0, 128, 32, "Exhausted", 1)
elsif $game_player.dash.walking?
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 128, 32, "Walking", 1)
elsif $game_player.dash.dashing?
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 128, 32, "Dashing", 1)
end
end
#-----------------------------------------------------------------------------
# * Update?
#-----------------------------------------------------------------------------
def update?
need_update = false
need_update |= $game_player.dash.points != @points
need_update |= $game_player.dash.last_move != @last_move
(need_update && Graphics.frame_count % 4 == 1)
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
self.visible = $game_player.dash.enabled?
if update?
refresh
end
end
end
#==========================================================================
# ** Spriteset_Map
#==========================================================================
class Spriteset_Map
#-----------------------------------------------------------------------------
# * Alias Lisitngs
#-----------------------------------------------------------------------------
alias_method :dashsystem_ssmap_initialize, :initialize
alias_method :dashsystem_ssmap_update, :update
alias_method :dashsystem_ssmap_dispose, :dispose
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@window_dashstamina = Window_DashStamina.new
dashsystem_ssmap_initialize
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
@window_dashstamina.update
dashsystem_ssmap_update
end
#-----------------------------------------------------------------------------
# * Dispose
#-----------------------------------------------------------------------------
def dispose
@window_dashstamina.dispose
dashsystem_ssmap_dispose
end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test : End
#-------------------------------------------------------------------------------
end
This is to basically dash.
I got it from this site:
http://www.gdunlimited.net/forums/topic/8472-player-dash/
It's for rmxp.
Active Member
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
Nah that's dash with extra features.
This is basically dash:
Sprint button is "A" on Keyboard.
You can fit it on one line if you really wanted to:
mr_wiggles
profile
handy333 wrote:This is to basically dash.
I got it from this site:
http://www.gdunlimited.net/forums/topic/8472-player-dash/
It's for rmxp.
Nah that's dash with extra features.
This is basically dash:
- Code:
class Game_Player
alias :simpleDash_update :update
def update
@move_speed = Input.press?(Input::X) ? 5 : 4
simpleDash_update
end
end
Sprint button is "A" on Keyboard.
You can fit it on one line if you really wanted to:
- Code:
class Game_Player;alias:sD:update;def update;@move_speed=Input.press?(Input::X)?5:4;sD;end;end
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
Active Member
profile
handy333
profile
Well I'll be. I've never seen a script so small in all my years of using someone else's scripts in my games. I don't know if I've ever said this but I've always been good with events so thats how I get by.
I guess you won that theme song!
Congratulations!
Whenever you need one for a game let me know.
I'll do my best.
I guess you won that theme song!
Congratulations!
Whenever you need one for a game let me know.
I'll do my best.
Active Member
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
profile
That's how i started out was in eventing. Stick with them and you'll be coding in no time once you start seeing block similarities in the event commands. Have you made an event that uses labels?
Sweet, thanks. Thinking about it i could use one for my old ass game from 6 years ago that i happened to find online in cryo sleep. It was in bad shape when i found it but i spent a few hours cleaning it up. I can PM you the Demo i slapped together.
That way you can see how the game "feels" and such.
mr_wiggles
profile
handy333 wrote:Well I'll be. I've never seen a script so small in all my years of using someone else's scripts in my games. I don't know if I've ever said this but I've always been good with events so thats how I get by.
That's how i started out was in eventing. Stick with them and you'll be coding in no time once you start seeing block similarities in the event commands. Have you made an event that uses labels?
handy333 wrote:I guess you won that theme song!
Congratulations!
Whenever you need one for a game let me know.
I'll do my best.
Sweet, thanks. Thinking about it i could use one for my old ass game from 6 years ago that i happened to find online in cryo sleep. It was in bad shape when i found it but i spent a few hours cleaning it up. I can PM you the Demo i slapped together.
That way you can see how the game "feels" and such.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
Active Member
profile
handy333
profile
great. I'll take a look at it.
I have used some labels for a game I was working on for a Phoenix Wright like system. That turned out messy. Actually, the whole game turned out messy. That's how Project Rising Sun Started.
I have used some labels for a game I was working on for a Phoenix Wright like system. That turned out messy. Actually, the whole game turned out messy. That's how Project Rising Sun Started.
Active Member
Show Signature
Go to page : 1, 2, 3