Project1
标题:
跳跃
[打印本页]
作者:
子弹君
时间:
2014-9-27 10:37
标题:
跳跃
#==============================================================================
# 跳跃 by 子弹君
#==============================================================================
# 说明:
# 让角色自由的跳跃~(死
#==============================================================================
$BombScript ||= {};$BombScript["跳跃"] = "跳跃20140924"
#==============================================================================
# 设定部分
#==============================================================================
module BOMB
module JUMP
SWITCH = 1
# 设置一个开关,开关开启则开启跳跃
SOUND = "Jump1"
# 设置跳跃的音效
DELAY = 30
# 设置跳跃等待的帧数
TRIGGER = :X
# 设置跳跃的按键
end
end
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias bomb20140924_initialize initialize
def initialize
bomb20140924_initialize
@bomb_delay = BOMB::JUMP::DELAY
end
#--------------------------------------------------------------------------
# ● 更新对象
#--------------------------------------------------------------------------
alias bomb20140924_update update
def update
bomb20140924_update
bomb_priority
end
#--------------------------------------------------------------------------
# ● 由方向键移动
#--------------------------------------------------------------------------
alias bomb20140924_input move_by_input
def move_by_input
bomb20140924_input
if $game_switches[BOMB::JUMP::SWITCH] == true
if @bomb_delay == BOMB::JUMP::DELAY
if Input.trigger?(BOMB::JUMP::TRIGGER)
bomb_extra if bomb_do
@bomb_delay = 0
end
else
@bomb_delay += 1
end
end
end
def bomb20140924_map_jump(bx, by)
if map_passable?(bx, by, 2) or map_passable?(bx, by, 4) or map_passable?(bx, by, 6) or map_passable?(bx, by, 8)
return true
else
return false
end
end
def bomb_priority
if jumping?
@priority_type = 2
else
@priority_type = 1
end
end
def check_layered(bo_x, bo_y)
bomb_tile = "[0, 0, "+$game_map.tile_id(bo_x, bo_y, 0x00).to_s+"]"
bomb_layered = $game_map.layered_tiles(bo_x, bo_y).to_s
else if bomb_tile == bomb_layered
return true
else
return false
end
end
def bomb_extra
@followers.each {|member| member.jump(@x - member.x, @y - member.y)}
Audio.se_play('Audio/SE/'+BOMB::JUMP::SOUND+'.ogg',50,150)
end
def bomb_do
case @direction
when 2
if !collide_with_events?(@x, @y+2) && bomb20140924_map_jump(@x, @y+2)
if normal_walk? && check_layered(@x, @y)
jump( 0, 2)
end
end
when 4
if !collide_with_events?(@x-2, @y) && bomb20140924_map_jump(@x-2, @y)
if normal_walk? && check_layered(@x-1, @y-1)
jump(-2, 0)
end
end
when 6
if !collide_with_events?(@x+2, @y) && bomb20140924_map_jump(@x+2, @y)
if normal_walk? && check_layered(@x+1, @y-1)
jump( 2, 0)
end
end
when 8
if !collide_with_events?(@x, @y-2) && bomb20140924_map_jump(@x, @y-2)
if normal_walk? && check_layered(@x, @y-2)
jump( 0,-2)
end
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1