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

Project1

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

[已经解决] 人物跟随太紧怎么办?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
跳转到指定楼层
1
发表于 2009-7-27 15:23:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我使用了下面的脚步,结果人物跟随太紧怎么办????{:3_50:}
  1. #===================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #===================================================================
  4. # ————————————————————————————————————
  5. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
  6. # by fukuyama
  7. #
  8. # Train_Actor
  9. #
  10. # [email protected]
  11. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  12. #
  13. module Train_Actor

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

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

  21.   # 定数
  22.   #Input::DOWN = 2
  23.   #Input::LEFT = 4
  24.   #Input::RIGHT = 6
  25.   #Input::UP = 6
  26.   DOWN_LEFT = 1
  27.   DOWN_RIGHT = 3
  28.   UP_LEFT = 7
  29.   UP_RIGHT = 9
  30.   JUMP = 5

  31.   class Game_Party_Actor < Game_Character
  32.    
  33.     def initialize
  34.         super()

  35.         @through = true
  36.     end
  37.       
  38.     def setup(actor)

  39.         # キャラクターのファイル名と色相を設定
  40.         if actor != nil
  41.            @character_name = actor.character_name
  42.            @character_hue = actor.character_hue
  43.            @tempneme = actor.name           
  44.         else
  45.            @character_name = ""
  46.            @character_hue = 0
  47.            @tempneme = ""      
  48.         end
  49.         # 不透明度と合成方法を初期化
  50.         @opacity = 255
  51.         @blend_type = 0
  52.     end

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

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

Lv1.梦旅人

伸手爱好者

梦石
0
星屑
50
在线时间
8 小时
注册时间
2009-3-28
帖子
527
2
发表于 2009-7-27 15:27:33 | 只看该作者
这个问题其实也有人问过,
可惜最后因为涉及问题太多.没能解决
据我所知,那位仁兄只好修改行走图来解决这个问题..............
不知道有没有人已经解决了呢?
咱在咱的设计素描书上看到有“柳笛”这个名字,恩~到底有怎样的关系呢?
[img]http://rpg.blue/data/attachment/forum/month_0910/09102318341719b34b80b536d4.gif[/img]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
3
 楼主| 发表于 2009-7-27 17:21:40 | 只看该作者
哦!!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

PIG·KIN

梦石
0
星屑
45
在线时间
442 小时
注册时间
2009-1-26
帖子
3298

贵宾

4
发表于 2009-7-27 17:23:25 | 只看该作者
lz的头像很msn啊~
我是一个风一般的————外卖佬。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
128 小时
注册时间
2009-1-28
帖子
2790
5
发表于 2009-7-27 17:25:00 | 只看该作者
楼主请解决后给予认可,
另外这个问题只能修复行走图解决,因为脚本是无脑的不会自己思考....

炼金术的根本法则是等价交换。想要获得,必须失去同等价值的东西。每当烦躁的时候,煎熬在不想做却又正在做的烦心事中的时候,我就安慰自己,提醒自己做这些事情的目的所在,告诉自己不要忽略所获得或者即将获得的回报,物质的,精神的,肉体的,灵魂的回报!只做想做的事情,就会失去不想失去的东西。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-15 07:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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