=begin
LISA物理系统脚本 V1.5
By 炽天之咸鱼裁决
修复了成吨bug
=end
#使用方法,创建一个并行事件,输入脚本"lisajump(X)",X为玩家奔跑时跳跃的最大距离
module Jump
#=============Run/On bike====================================
#自行车开关ID
#不需要就写"nil"
BIKE = nil
#自行车/奔跑图像
RUN = ["$Brad bike",0]
#自行车/奔跑时的跳跃图像
RUNJUMP = ["$Brad bike",0]
#自行车/奔跑时的跳崖图像
LRUNFALL = ["$Brad bike jump L",0]
RRUNFALL = ["$Brad bike jump R",0]
#自行车/奔跑时的摔倒图像
BIKEFALL = ["$Brad fall bike",0]
#掉落高度 => 伤害
RLIST = {0 => 0,
5 => 10}
#自行车/奔跑时的攀爬图像
RROPEP = ["$Brad rope bike",0]
#=================================================================
#绳子区域编号
ROPE = [18]
#爬绳贴图
ROPEP = ["$Brad rope",0]
#陆地区域编号
LAND = [1,2,5,7]
#跳跃贴图
PIC = ["$Brad Jump1eye",0]
#行走贴图
WALK = ["Brad",2]
#摔倒贴图
FALL = ["$Brad fall 1eye",0]
#掉落高度 => 伤害
LIST = {0 => 0,
3 => 10}
#受到的伤害 => 动画
EXLIST = {0 => 1,
10 => 106}
#跳跃音效与受伤音效
FSE = RPG::SE.new("Rustle", 70, 150)
DSE = RPG::SE.new("Earth5", 70, 150)
#空变量ID
V = 66
#=================================================================
#空气墙ID
WALL = [48]
end
#========================================以下勿动===============================
class Game_Player < Game_Character
def move_by_input
return if !movable? || $game_map.interpreter.running? || $game_variables[Jump::V] == 1
move_straight(Input.dir4) if Input.dir4 > 0
end
end
class Game_Player < Game_Character
def getX
@x
end
def getY
@y
end
end
class Game_Player < Game_Character
def dash?
if Jump::BIKE != nil
if $game_switches[Jump::BIKE] == true
return true
else
return false
end
else
return false if $game_map.disable_dash?
return false if vehicle
return Input.press?(:A)
end
end
end
class Game_Interpreter
attr_accessor :rg
attr_accessor :bike
alias lisa_initialize initialize
def initialize(depth = 0)
@rg = 0
@bike = 1
lisa_initialize(depth = 0)
end
def rush
if Input.press?(:A)
if Jump::BIKE != nil
if $game_switches[Jump::BIKE] == true
$game_switches[Jump::BIKE] = false
end
end
end
end
def island(id)
for n in Jump::LAND
if n == id
return 1
end
end
return 0
end
def isrope(id)
for n in Jump::ROPE
if n == id
return 1
end
end
return 0
end
def refresh
i = [0,0]
x = $game_player.x
y = $game_player.y
id=$game_map.region_id(x, y)
i[1] = isrope(id)
i[0] = island(id)
if i[0] == 1
if $game_player.direction == 8
id2=$game_map.region_id(x, y - 1)
j = isrope(id2)
if j == 1
i = [0,1]
end
end
elsif i[1] == 1
if $game_player.direction == 2
id2=$game_map.region_id(x, y + 1)
j = island(id2)
if j == 1
i = [1,0]
end
end
end
if i[1] == 1
if $game_player.dash?
p = Jump::RROPEP
else
p = Jump::ROPEP
end
o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
fall_move(o)
elsif i[0] == 1
if $game_player.dash?
p = Jump::RUN
else
p = Jump::WALK
end
o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
fall_move(o)
end
@rg = id
end
def rope()
if $game_variables[Jump::V] == 1
return
end
if $game_player.dash?
b = 1
else
b = 0
end
refresh if @bike != b
@bike = b
i = [0,0]
x = $game_player.x
y = $game_player.y
id=$game_map.region_id(x, y)
return if id == @rg
refresh
@rg = id
end
def lisajump(i)
return if $game_player.move_route_forcing
rush
fall(i)
jumpupanddown()
rope()
end
def jumpjump(i)
$game_variables[Jump::V] = 1
if $game_player.dash?
p = Jump::RUNJUMP
else
p = Jump::PIC
end
if $game_player.dash?
w = Jump::RUN
else
w = Jump::WALK
end
Jump::FSE.play
o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(14,[0,-i]),RPG::MoveCommand.new(0)]
fall_move(o)
o = [RPG::MoveCommand.new(41,w),RPG::MoveCommand.new(0)]
fall_move(o)
$game_variables[Jump::V] = 0
end
def jumpupanddown()
if $game_variables[Jump::V] == 1
return
end
i=0
j=0
if Input.press?(:UP) and Input.press?(:C)
x = $game_player.getX
y = $game_player.getY
if $game_map.valid?(x, y - 1) == true
id1=$game_map.region_id(x, y)
id2=$game_map.region_id(x, y - 1)
for n in Jump::LAND
if n == id1
i = 1
end
if n == id2
j = 1
end
end
k = i * j
for n in Jump::ROPE
if n == id1 or n == id2
k = 0
end
end
if k == 1
jumpjump(1)
end
end
end
if Input.press?(:DOWN) and Input.press?(:C)
x = $game_player.getX
y = $game_player.getY
if $game_map.valid?(x, y + 1) == true
id1=$game_map.region_id(x, y)
id2=$game_map.region_id(x, y + 1)
for n in Jump::LAND
if n == id1
i = 1
end
if n == id2
j = 1
end
end
k = i * j
if k == 1
jumpjump(-1)
end
end
end
end
def fall_move(x)
point = $game_player
r = RPG::MoveRoute.new
r.repeat = false
r.skippable = true
r.wait = true
r.list = x
point.force_move_route(r)
if r.wait
Fiber.yield while point.move_route_forcing
end
end
def checkdirection(x)
r = x
if $game_player.direction == 4
r = -r
end
return r
end
def findpoint(f)
x = $game_player.getX
y = $game_player.getY
r = f
i = -1
d = 0
while true
i += 1
j = 1
while j <= r
if $game_player.dash?
t = checkdirection(j)
else
t = 0
j = r
end
id = $game_map.region_id(x + t, y + i)
for n in Jump::LAND
if n == id
return [t,i,0]
end
end
j += 1
end
if $game_map.valid?(x + t, y + i) == false
i = -1
while true
i += 1
id = $game_map.region_id(x, y + i)
for n in Jump::LAND
if n == id
return [0,i,0]
end
end
t = checkdirection(1)
return [t,i,1] if $game_map.valid?(x, y + i) == false
end
end
end
end
def fall(f)
if $game_variables[Jump::V] == 1
return
end
x = $game_player.getX
y = $game_player.getY
q = 0
p = $game_map.region_id(x, y)
for n in Jump::LAND
if n == p
q=1
end
end
for n in Jump::ROPE
if n == p
q=1
end
end
if q == 0
$game_variables[Jump::V] = 1
a = findpoint(f)
r = a[0]
i = a[1]
d = a[2]
if $game_player.dash?
if $game_player.direction == 6
igf = Jump::RRUNFALL
else
igf = Jump::LRUNFALL
end
else
igf = Jump::PIC
end
if d == 1
s = Jump::FSE
o = [RPG::MoveCommand.new(44,),RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(14,[r,i-1]),RPG::MoveCommand.new(0)]
fall_move(o)
SceneManager.goto(Scene_Gameover)
return
end
if $game_player.dash?
lst= Jump::RLIST
else
lst= Jump::LIST
end
f = 0
dam = 0
while f < i
f += 1
if lst[f] != nil
dam = lst[f]
end
end
if dam!=0 and Jump::EXLIST[dam] != nil
o = [RPG::MoveCommand.new(44,[Jump::FSE]),RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(14,[r,i]),RPG::MoveCommand.new(44,[Jump::DSE]),RPG::MoveCommand.new(0)]
fall_move(o)
$game_player.animation_id = Jump::EXLIST[dam]
value = operate_value(1,0,dam)
iterate_actor_var(0, 0) do |actor|
next if actor.dead?
actor.change_hp(value, -dam)
actor.perform_collapse_effect if actor.dead?
end
SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
s = Jump::FSE
o = [RPG::MoveCommand.new(41,Jump::FALL),RPG::MoveCommand.new(44,),RPG::MoveCommand.new(0)]
fall_move(o)
wait(60)
else
s = Jump::FSE
o = [RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(44,),RPG::MoveCommand.new(14,[r,i]),RPG::MoveCommand.new(0)]
fall_move(o)
end
refresh
$game_variables[Jump::V] = 0
end
end
end
class Game_Map
def iswall(id)
for n in Jump::WALL
if n == id
return 1
end
end
return 0
end
def isrope(id)
for n in Jump::ROPE
if n == id
return 1
end
end
return 0
end
alias lisa_passable passable?
def passable?(x, y, d)
if d ==4 or d == 6
id=region_id(x,y)
i = iswall(id)
return false if i == 1
end
s = $game_player.direction
if s == 2 or s == 8
id =region_id(x, y)
j = isrope(id)
if j == 1
return true
end
id =region_id(x, y + 1)
j = isrope(id)
if j == 1
return true
end
id =region_id(x, y - 1)
j = isrope(id)
if j == 1
return true
end
return false
end
lisa_passable(x, y, d)
end
end
用区域编号标出绳子与陆地实体即可(大概) 这玩意运行起来是这种效果 菜鸟之作,请轻喷 最后祝您身体健康,再见 |