设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2194|回复: 5
打印 上一主题 下一主题

[已经过期] 人物跟随太近

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
105 小时
注册时间
2010-6-20
帖子
122
跳转到指定楼层
1
发表于 2010-12-24 21:59:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 白萌奈奈 于 2010-12-24 22:00 编辑

RMXP的人物跟随太近了。添加一个空白的角色是解决了。这个方法和我的某些脚本不能一起用。有什么方法可以不用这个方法来改变他他们的距离?

点评

上脚本……  发表于 2010-12-25 10:52
喵~~~~

Lv2.观梦者

虚構歪曲

梦石
0
星屑
309
在线时间
1194 小时
注册时间
2010-12-18
帖子
3928

贵宾

2
发表于 2010-12-25 16:48:21 | 只看该作者
试试看看吧
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

  5. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
  6. # by fukuyama

  7. # 分开一段距离跟随
  8. # by 叶子
  9. #
  10. # Train_Actor
  11. #
  12. # [email protected]
  13. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  14. #

  15. module Train_Actor




  16. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
  17. #开关打开,跟随的人物就消失了(其实只是变成透明而已)
  18. TRANSPARENT_SWITCH = true
  19. TRANSPARENT_SWITCHES_INDEX = 2
  20. #举例:第一个为true,第二个为2,则打开2号开关,后面的人都没了。




  21. #跟随人数的最大数目,可以更改为2、3什么的。
  22. TRAIN_ACTOR_SIZE_MAX = 4


  23. # 跟随距离,例如0为紧贴,1为分开一个身位
  24. TRAIN_ACTOR_DISTANCE = 1



  25. # 定数
  26. #Input::DOWN = 2
  27. #Input::LEFT = 4
  28. #Input::RIGHT = 6
  29. #Input::UP = 6
  30. DOWN_LEFT = 1
  31. DOWN_RIGHT = 3
  32. UP_LEFT = 7
  33. UP_RIGHT = 9
  34. JUMP = 5

  35. # 叶子到此一游
  36. # 插入空角色,造成分开一段距离跟随的假象
  37. TRAIN_ACTOR_SIZE_MAX = TRAIN_ACTOR_SIZE_MAX * (TRAIN_ACTOR_DISTANCE+1) + 1
  38. class Game_Party_Actor < Game_Character
  39. def initialize
  40. super()
  41. @through = true
  42. end
  43. def setup(actor)
  44. # キャラクターのファイル名と色相を設定
  45. if actor != nil
  46. @character_name = actor.character_name
  47. @character_hue = actor.character_hue
  48. else
  49. @character_name = ""
  50. @character_hue = 0
  51. end
  52. # 不透明度と合成方法を初期化
  53. @opacity = 255
  54. @blend_type = 0
  55. end
  56. def screen_z(height = 0)
  57. if $game_player.x == @x and $game_player.y == @y
  58. return $game_player.screen_z(height) - 1
  59. end
  60. super(height)
  61. end
  62. #--------------------------------------------------------------------------
  63. # ● 下に移動
  64. # turn_enabled : その場での向き変更を許可するフラグ
  65. #--------------------------------------------------------------------------
  66. def move_down(turn_enabled = true)
  67. # 下を向く
  68. if turn_enabled
  69. turn_down
  70. end
  71. # 通行可能な場合
  72. if passable?(@x, @y, Input::DOWN)
  73. # 下を向く
  74. turn_down
  75. # 座標を更新
  76. @y += 1
  77. end
  78. end
  79. #--------------------------------------------------------------------------
  80. # ● 左に移動
  81. # turn_enabled : その場での向き変更を許可するフラグ
  82. #--------------------------------------------------------------------------
  83. def move_left(turn_enabled = true)
  84. # 左を向く
  85. if turn_enabled
  86. turn_left
  87. end
  88. # 通行可能な場合
  89. if passable?(@x, @y, Input::LEFT)
  90. # 左を向く
  91. turn_left
  92. # 座標を更新
  93. @x -= 1
  94. end
  95. end
  96. #--------------------------------------------------------------------------
  97. # ● 右に移動
  98. # turn_enabled : その場での向き変更を許可するフラグ
  99. #--------------------------------------------------------------------------
  100. def move_right(turn_enabled = true)
  101. # 右を向く
  102. if turn_enabled
  103. turn_right
  104. end
  105. # 通行可能な場合
  106. if passable?(@x, @y, Input::RIGHT)
  107. # 右を向く
  108. turn_right
  109. # 座標を更新
  110. @x += 1
  111. end
  112. end
  113. #--------------------------------------------------------------------------
  114. # ● 上に移動
  115. # turn_enabled : その場での向き変更を許可するフラグ
  116. #--------------------------------------------------------------------------
  117. def move_up(turn_enabled = true)
  118. # 上を向く
  119. if turn_enabled
  120. turn_up
  121. end
  122. # 通行可能な場合
  123. if passable?(@x, @y, Input::UP)
  124. # 上を向く
  125. turn_up
  126. # 座標を更新
  127. @y -= 1
  128. end
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 左下に移動
  132. #--------------------------------------------------------------------------
  133. def move_lower_left
  134. # 向き固定でない場合
  135. unless @direction_fix
  136. # 右向きだった場合は左を、上向きだった場合は下を向く
  137. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  138. end
  139. # 下→左、左→下 のどちらかのコースが通行可能な場合
  140. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  141. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  142. # 座標を更新
  143. @x -= 1
  144. @y += 1
  145. end
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● 右下に移動
  149. #--------------------------------------------------------------------------
  150. def move_lower_right
  151. # 向き固定でない場合
  152. unless @direction_fix
  153. # 左向きだった場合は右を、上向きだった場合は下を向く
  154. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  155. end
  156. # 下→右、右→下 のどちらかのコースが通行可能な場合
  157. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  158. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  159. # 座標を更新
  160. @x += 1
  161. @y += 1
  162. end
  163. end
  164. #--------------------------------------------------------------------------
  165. # ● 左上に移動
  166. #--------------------------------------------------------------------------
  167. def move_upper_left
  168. # 向き固定でない場合
  169. unless @direction_fix
  170. # 右向きだった場合は左を、下向きだった場合は上を向く
  171. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  172. end
  173. # 上→左、左→上 のどちらかのコースが通行可能な場合
  174. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  175. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  176. # 座標を更新
  177. @x -= 1
  178. @y -= 1
  179. end
  180. end
  181. #--------------------------------------------------------------------------
  182. # ● 右上に移動
  183. #--------------------------------------------------------------------------
  184. def move_upper_right
  185. # 向き固定でない場合
  186. unless @direction_fix
  187. # 左向きだった場合は右を、下向きだった場合は上を向く
  188. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  189. end
  190. # 上→右、右→上 のどちらかのコースが通行可能な場合
  191. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  192. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  193. # 座標を更新
  194. @x += 1
  195. @y -= 1
  196. end
  197. end
  198. attr_writer :move_speed
  199. attr_writer :step_anime
  200. end
  201. module Spriteset_Map_Module
  202. def setup_actor_character_sprites?
  203. return @setup_actor_character_sprites_flag != nil
  204. end
  205. def setup_actor_character_sprites(characters)
  206. if !setup_actor_character_sprites?
  207. index_game_player = 0
  208. @character_sprites.each_index do |i|
  209. if @character_sprites[i].character.instance_of?(Game_Player)
  210. index_game_player = i
  211. break
  212. end
  213. end
  214. for character in characters.reverse
  215. @character_sprites.unshift(
  216. Sprite_Character.new(@viewport1, character)
  217. )
  218. end
  219. @setup_actor_character_sprites_flag = true
  220. end
  221. end
  222. end
  223. module Scene_Map_Module
  224. def setup_actor_character_sprites(characters)
  225. @spriteset.setup_actor_character_sprites(characters)
  226. end
  227. end
  228. module Game_Party_Module
  229. def set_transparent_actors(transparent)
  230. @transparent = transparent
  231. end
  232. def setup_actor_character_sprites
  233. if @characters == nil
  234. # 叶子到此一游
  235. @characters = []
  236. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  237. @characters.push(Game_Party_Actor.new)
  238. end
  239. end
  240. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  241. # 叶子到此一游
  242. if i % (TRAIN_ACTOR_DISTANCE+1) == 0
  243. @characters[i-1].setup(actors[i/(TRAIN_ACTOR_DISTANCE+1)])
  244. end
  245. end
  246. if $scene.class.method_defined?('setup_actor_character_sprites')
  247. $scene.setup_actor_character_sprites(@characters)
  248. end
  249. end
  250. def update_party_actors
  251. setup_actor_character_sprites
  252. transparent = $game_player.transparent
  253. if transparent == false
  254. if TRANSPARENT_SWITCH
  255. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  256. end
  257. end
  258. for character in @characters
  259. character.transparent = transparent
  260. character.move_speed = $game_player.move_speed
  261. character.step_anime = $game_player.step_anime
  262. character.update
  263. end
  264. end
  265. def moveto_party_actors( x, y )
  266. setup_actor_character_sprites
  267. for character in @characters
  268. character.moveto( x, y )
  269. end
  270. if @move_list == nil
  271. @move_list = []
  272. end
  273. move_list_setup
  274. end
  275. def move_party_actors
  276. if @move_list == nil
  277. @move_list = []
  278. move_list_setup
  279. end
  280. @move_list.each_index do |i|
  281. if @characters[i] != nil
  282. case @move_list[i].type
  283. when Input::DOWN
  284. @characters[i].move_down(@move_list[i].args[0])
  285. when Input::LEFT
  286. @characters[i].move_left(@move_list[i].args[0])
  287. when Input::RIGHT
  288. @characters[i].move_right(@move_list[i].args[0])
  289. when Input::UP
  290. @characters[i].move_up(@move_list[i].args[0])
  291. when DOWN_LEFT
  292. @characters[i].move_lower_left
  293. when DOWN_RIGHT
  294. @characters[i].move_lower_right
  295. when UP_LEFT
  296. @characters[i].move_upper_left
  297. when UP_RIGHT
  298. @characters[i].move_upper_right
  299. when JUMP
  300. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  301. end
  302. end
  303. end
  304. end
  305. class Move_List_Element
  306. def initialize(type,args)
  307. @type = type
  308. @args = args
  309. end
  310. def type() return @type end
  311. def args() return @args end
  312. end
  313. def move_list_setup
  314. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  315. @move_list[i] = nil
  316. end
  317. end
  318. def add_move_list(type,*args)
  319. @move_list.unshift(Move_List_Element.new(type,args)).pop
  320. end
  321. def move_down_party_actors(turn_enabled = true)
  322. move_party_actors
  323. add_move_list(Input::DOWN,turn_enabled)
  324. end
  325. def move_left_party_actors(turn_enabled = true)
  326. move_party_actors
  327. add_move_list(Input::LEFT,turn_enabled)
  328. end
  329. def move_right_party_actors(turn_enabled = true)
  330. move_party_actors
  331. add_move_list(Input::RIGHT,turn_enabled)
  332. end
  333. def move_up_party_actors(turn_enabled = true)
  334. move_party_actors
  335. add_move_list(Input::UP,turn_enabled)
  336. end
  337. def move_lower_left_party_actors
  338. move_party_actors
  339. add_move_list(DOWN_LEFT)
  340. end
  341. def move_lower_right_party_actors
  342. move_party_actors
  343. add_move_list(DOWN_RIGHT)
  344. end
  345. def move_upper_left_party_actors
  346. move_party_actors
  347. add_move_list(UP_LEFT)
  348. end
  349. def move_upper_right_party_actors
  350. move_party_actors
  351. add_move_list(UP_RIGHT)
  352. end
  353. def jump_party_actors(x_plus, y_plus)
  354. move_party_actors
  355. add_move_list(JUMP,x_plus, y_plus)
  356. end
  357. end
  358. module Game_Player_Module
  359. def update
  360. $game_party.update_party_actors
  361. super
  362. end
  363. def moveto( x, y )
  364. $game_party.moveto_party_actors( x, y )
  365. super( x, y )
  366. end
  367. def move_down(turn_enabled = true)
  368. if passable?(@x, @y, Input::DOWN)
  369. $game_party.move_down_party_actors(turn_enabled)
  370. end
  371. super(turn_enabled)
  372. end
  373. def move_left(turn_enabled = true)
  374. if passable?(@x, @y, Input::LEFT)
  375. $game_party.move_left_party_actors(turn_enabled)
  376. end
  377. super(turn_enabled)
  378. end
  379. def move_right(turn_enabled = true)
  380. if passable?(@x, @y, Input::RIGHT)
  381. $game_party.move_right_party_actors(turn_enabled)
  382. end
  383. super(turn_enabled)
  384. end
  385. def move_up(turn_enabled = true)
  386. if passable?(@x, @y, Input::UP)
  387. $game_party.move_up_party_actors(turn_enabled)
  388. end
  389. super(turn_enabled)
  390. end
  391. def move_lower_left
  392. # 下→左、左→下 のどちらかのコースが通行可能な場合
  393. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  394. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  395. $game_party.move_lower_left_party_actors
  396. end
  397. super
  398. end
  399. def move_lower_right
  400. # 下→右、右→下 のどちらかのコースが通行可能な場合
  401. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  402. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  403. $game_party.move_lower_right_party_actors
  404. end
  405. super
  406. end
  407. def move_upper_left
  408. # 上→左、左→上 のどちらかのコースが通行可能な場合
  409. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  410. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  411. $game_party.move_upper_left_party_actors
  412. end
  413. super
  414. end
  415. def move_upper_right
  416. # 上→右、右→上 のどちらかのコースが通行可能な場合
  417. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  418. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  419. $game_party.move_upper_right_party_actors
  420. end
  421. super
  422. end
  423. def jump(x_plus, y_plus)
  424. # 新しい座標を計算
  425. new_x = @x + x_plus
  426. new_y = @y + y_plus
  427. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  428. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  429. $game_party.jump_party_actors(x_plus, y_plus)
  430. end
  431. super(x_plus, y_plus)
  432. end
  433. attr_reader :move_speed
  434. attr_reader :step_anime
  435. end
  436. end # module Train_Actor
  437. class Game_Party
  438. include Train_Actor::Game_Party_Module
  439. end
  440. class Game_Player
  441. include Train_Actor::Game_Player_Module
  442. end
  443. class Spriteset_Map
  444. include Train_Actor::Spriteset_Map_Module
  445. end
  446. class Scene_Map
  447. include Train_Actor::Scene_Map_Module
  448. end

  449. #==============================================================================
  450. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  451. #==============================================================================
复制代码

点评

楼主很明确的说了。不要添加空白角色  发表于 2010-12-26 01:09
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
31 小时
注册时间
2010-7-27
帖子
58
3
发表于 2010-12-25 18:10:05 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
71 小时
注册时间
2010-12-25
帖子
104
4
发表于 2010-12-26 01:11:12 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

小莹爱水区

梦石
0
星屑
60
在线时间
163 小时
注册时间
2010-9-18
帖子
1085
5
发表于 2010-12-26 20:12:50 | 只看该作者
添加空白角色、?

像这种人物跟随不是可以使用者自己设定吗?
LZ上脚本吧

点评

我说 添加空白角色是个笨方法!谁说要用添加空白角色了  发表于 2010-12-27 12:32
三楼的脚本就是添加空白的角色  发表于 2010-12-27 00:12
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
105 小时
注册时间
2010-6-20
帖子
122
6
 楼主| 发表于 2011-1-1 17:03:01 | 只看该作者
:L三楼的脚本意思是在每一个角色中间添加一个的角色吧?
喵~~~~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-7 06:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表