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

Project1

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

[已经过期] 求高手!!!这个图怎么挂机呀!!!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
22 小时
注册时间
2014-4-7
帖子
53
跳转到指定楼层
1
发表于 2014-4-15 20:28:04 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求高手!!!这个图怎么挂机呀!!!
求高手!!!这个图怎么挂机呀!!!
????????????????
{:7_293:}











我有着个挂机图就是不行呀






而变成这样的呢‘








在游戏中是这样        是八个人!!!!!




Lv1.梦旅人

梦石
0
星屑
50
在线时间
105 小时
注册时间
2013-2-7
帖子
82
2
发表于 2014-4-16 19:29:10 | 只看该作者
本帖最后由 jilei 于 2014-4-16 19:30 编辑

xp不是4*4的行走图么,你放那么大一张做什么,每一个方向只有四个动作!
下面那四排是用来做八个方向的,同样每个方向四个动作

点评

这根本是最最基础的新手问题。。。。  发表于 2014-4-16 19:31
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
22 小时
注册时间
2014-4-7
帖子
53
3
 楼主| 发表于 2014-4-16 19:46:33 | 只看该作者
jilei 发表于 2014-4-16 19:29
xp不是4*4的行走图么,你放那么大一张做什么,每一个方向只有四个动作!
下面那四排是用来做八个方向的,同 ...

那么大哥就是说,XP的不能用8张图的?????
{:7_298:}

点评

我指的是默认的。。。。不包含脚本修改的,我碉堡了  发表于 2014-4-16 20:22
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
192 小时
注册时间
2010-8-23
帖子
161
4
发表于 2014-4-16 20:15:52 | 只看该作者
八方向脚本(默认素材格式8X8),注释很详细,就不解释了

RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. ###########################################################################################################################
  5. ###########################################################################################################################
  6. # 脚本功能:八方向走与多帧移动之图片修正__ver1.1。
  7. # 更新日期:2005年8月6日
  8. # 更新内容:增加斜方向触发,增加斜方向面向角色(1步之内)
  9. # 使用方法:将本脚本插入到main之前。如果你使用了雅土版的八方向走脚本,请确保这个脚本的顺序位置,在雅土八方向走脚本的后面。
  10. # 预先处理:请输入每一步的帧数和总共可用的方向数
  11. $c3_每一步的帧数 = 8
  12. $c3_总共可用的方向数 = 8 #——建议不要修改这个。如果要伪8方向的,就用伪的好了。
  13. # 图片处理与功能说明:
  14. # 1、每一步的帧数:
  15. # 众所周知,RMXP的移动行走图是一个方向共有4帧,很多人都觉得这个帧数有点少。
  16. # 使用这个脚本之后,只要将 $c3_每一步的帧数 这个变量设置一个需要的帧数即可修改
  17. # 单方向移动帧数为相应输入值。修改后,需要用photoshop将所有用到的素材的横排
  18. # 调整为相应帧数,比如输入了8则要将每一行设置8个图像(即每一个行走图有8列)。
  19. # 2、可用方向调整(可用数量:4、8):
  20. # 当为4方向时没有任何变化,还是一个图4行,上左右下4个方向。
  21. # 如果想使用8方向走,将需要八方向行走的行走图在延伸扩大的画布中按照左下、右下、左上、右上继续排布图像。
  22. # 即,行走图图片从上到下的面向排列顺序为:下,左,右,上,左下,右下,左上,右上。
  23. # 至于不需要8方向走的普通的NPC(character),使用photoshop将画布向下扩大一倍即可使用。
  24. # 需要注意的是,如果需要斜方向飞鸟,请不要忘记自制素材。
  25. # 特别提示:
  26. # 使用本脚本前请先考虑清楚是否要做这种效果。因为使用本脚本后需要用photoshop处理character行走图素材
  27. # 虽然这种处理用photoshop定义动作只需要5分钟即可全部完成,但在制作阶段会感觉不是很爽(具体的用了才知道)
  28. # 作者的建议是,如果你没有足够的制作经验,使用这个脚本得不偿失。请确保自己的能力属于“高手”级别!
  29. # 附赠功能:
  30. # 可以让NPC角色随机8方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c8即可
  31. # 可以让NPC角色随机4斜角方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c4即可
  32. # 可以使用真·斜4方向行走,参考脚本53行开始
  33. # 作者:carol3
  34. ###########################################################################################################################
  35. ###########################################################################################################################
  36. class Game_Player < Game_Character
  37. if $c3_总共可用的方向数 == 8
  38. def update
  39. last_moving = moving?
  40. unless moving? or $game_system.map_interpreter.running? or
  41. @move_route_forcing or $game_temp.message_window_showing
  42. # 用井号后面的东西替代前面的,就可以实现斜4方向走
  43. case Input.dir8
  44. when 2
  45. move_down #move_lower_left
  46. when 4
  47. move_left #move_upper_left
  48. when 6
  49. move_right #move_lower_right
  50. when 8
  51. move_up #move_upper_right
  52. when 1
  53. move_lower_left
  54. when 3
  55. move_lower_right
  56. when 7
  57. move_upper_left
  58. when 9
  59. move_upper_right
  60. end
  61. end
  62. # 本地变量记忆坐标
  63. last_real_x = @real_x
  64. last_real_y = @real_y
  65. super
  66. # 角色向下移动、画面上的位置在中央下方的情况下
  67. if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  68. # 画面向下卷动
  69. $game_map.scroll_down(@real_y - last_real_y)
  70. end
  71. # 角色向左移动、画面上的位置在中央左方的情况下
  72. if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  73. # 画面向左卷动
  74. $game_map.scroll_left(last_real_x - @real_x)
  75. end
  76. # 角色向右移动、画面上的位置在中央右方的情况下
  77. if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  78. # 画面向右卷动
  79. $game_map.scroll_right(@real_x - last_real_x)
  80. end
  81. # 角色向上移动、画面上的位置在中央上方的情况下
  82. if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  83. # 画面向上卷动
  84. $game_map.scroll_up(last_real_y - @real_y)
  85. end
  86. # 不在移动中的情况下
  87. unless moving?
  88. # 上次主角移动中的情况
  89. if last_moving
  90. # 与同位置的事件接触就判定为事件启动
  91. result = check_event_trigger_here([1,2])
  92. # 没有可以启动的事件的情况下
  93. if result == false
  94. # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  95. unless $DEBUG and Input.press?(Input::CTRL)
  96. # 遇敌计数下降
  97. if @encounter_count > 0
  98. @encounter_count -= 1
  99. end
  100. end
  101. end
  102. end
  103. # 按下 C 键的情况下
  104. if Input.trigger?(Input::C)
  105. # 判定为同位置以及正面的事件启动
  106. check_event_trigger_here([0])
  107. check_event_trigger_there([0,1,2])
  108. end
  109. end
  110. end
  111. #--------------------------------------------------------------------------
  112. # ● 正面事件的启动判定
  113. #--------------------------------------------------------------------------
  114. def check_event_trigger_there(triggers)
  115. result = false
  116. # 事件执行中的情况下
  117. if $game_system.map_interpreter.running?
  118. return result
  119. end
  120. # 计算正面坐标
  121. new_x = @x
  122. new_y = @y
  123. case @direction
  124. when 1
  125. new_x -= 1
  126. new_y += 1
  127. when 2
  128. new_y += 1
  129. when 3
  130. new_x += 1
  131. new_y += 1
  132. when 4
  133. new_x -= 1
  134. when 6
  135. new_x += 1
  136. when 7
  137. new_x -= 1
  138. new_y -= 1
  139. when 8
  140. new_y -= 1
  141. when 9
  142. new_x += 1
  143. new_y -= 1
  144. end
  145. # 全部事件的循环
  146. for event in $game_map.events.values
  147. # 事件坐标与目标一致的情况下
  148. if event.x == new_x and event.y == new_y and
  149. triggers.include?(event.trigger)
  150. # 跳跃中以外的情况下、启动判定是正面的事件
  151. if not event.jumping? and not event.over_trigger?
  152. event.start
  153. result = true
  154. end
  155. end
  156. end
  157. # 找不到符合条件的事件的情况下
  158. if result == false
  159. # 正面的元件是计数器的情况下
  160. if $game_map.counter?(new_x, new_y)
  161. # 计算 1 元件里侧的坐标
  162. new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  163. new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  164. # 全事件的循环
  165. for event in $game_map.events.values
  166. # 事件坐标与目标一致的情况下
  167. if event.x == new_x and event.y == new_y and
  168. triggers.include?(event.trigger)
  169. # 跳跃中以外的情况下、启动判定是正面的事件
  170. if not event.jumping? and not event.over_trigger?
  171. event.start
  172. result = true
  173. end
  174. end
  175. end
  176. end
  177. end
  178. return result
  179. end
  180. #--------------------------------------------------------------------------
  181. # ● 向左下移动
  182. #--------------------------------------------------------------------------
  183. def move_lower_left
  184. # 没有固定面向的场合
  185. unless @direction_fix
  186. # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  187. @direction = 1#(@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  188. end
  189. # 下→左、左→下 的通道可以通行的情况下
  190. if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  191. (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  192. # 更新坐标
  193. @x -= 1
  194. @y += 1
  195. # 增加步数
  196. increase_steps
  197. else
  198. check_event_trigger_touch(@x-1, @y+1)
  199. end
  200. end
  201. #--------------------------------------------------------------------------
  202. # ● 向右下移动
  203. #--------------------------------------------------------------------------
  204. def move_lower_right
  205. # 没有固定面向的场合
  206. unless @direction_fix
  207. # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  208. @direction = 3#(@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  209. end
  210. # 下→右、右→下 的通道可以通行的情况下
  211. if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  212. (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  213. # 更新坐标
  214. @x += 1
  215. @y += 1
  216. # 增加步数
  217. increase_steps
  218. else
  219. check_event_trigger_touch(@x+1, @y+1)
  220. end
  221. end
  222. #--------------------------------------------------------------------------
  223. # ● 向左上移动
  224. #--------------------------------------------------------------------------
  225. def move_upper_left
  226. # 没有固定面向的场合
  227. unless @direction_fix
  228. # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  229. @direction = 7#(@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  230. end
  231. # 上→左、左→上 的通道可以通行的情况下
  232. if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  233. (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  234. # 更新坐标
  235. @x -= 1
  236. @y -= 1
  237. # 增加步数
  238. increase_steps
  239. else
  240. check_event_trigger_touch(@x-1, @y-1)
  241. end
  242. end
  243. #--------------------------------------------------------------------------
  244. # ● 向右上移动
  245. #--------------------------------------------------------------------------
  246. def move_upper_right
  247. # 没有固定面向的场合
  248. unless @direction_fix
  249. # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  250. @direction = 9#(@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  251. end
  252. # 上→右、右→上 的通道可以通行的情况下
  253. if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  254. (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  255. # 更新坐标
  256. @x += 1
  257. @y -= 1
  258. # 增加步数
  259. increase_steps
  260. else
  261. check_event_trigger_touch(@x+1, @y-1)
  262. end
  263. end
  264. #--------------------------------------------------------------------------
  265. # ● 雅土左下移動
  266. #--------------------------------------------------------------------------
  267. def move_lower_left_p
  268. unless @direction_fix
  269. @direction = 1
  270. end
  271. distance = (2 ** @move_speed) / Math.sqrt(2)
  272. turn_left unless down1(@x, @y, distance)
  273. turn_down if @event
  274. turn_down unless left1(@x, @y, distance) unless @event
  275. turn_left if @event
  276. end
  277. #--------------------------------------------------------------------------
  278. # ● 雅土右下移動
  279. #--------------------------------------------------------------------------
  280. def move_lower_right_p
  281. unless @direction_fix
  282. @direction = 3
  283. end
  284. distance = (2 ** @move_speed) / Math.sqrt(2)
  285. turn_right unless down1(@x, @y, distance)
  286. turn_down if @event
  287. turn_down unless right1(@x, @y, distance) unless @event
  288. turn_right if @event
  289. end
  290. #--------------------------------------------------------------------------
  291. # ● 雅土左上移動
  292. #--------------------------------------------------------------------------
  293. def move_upper_left_p
  294. unless @direction_fix
  295. @direction = 7
  296. end
  297. distance = (2 ** @move_speed) / Math.sqrt(2)
  298. turn_left unless up1(@x, @y, distance)
  299. turn_up if @event
  300. turn_up unless left1(@x, @y, distance) unless @event
  301. turn_left if @event
  302. end
  303. #--------------------------------------------------------------------------
  304. # ● 雅土右上移動
  305. #--------------------------------------------------------------------------
  306. def move_upper_right_p
  307. unless @direction_fix
  308. @direction = 9
  309. end
  310. distance = (2 ** @move_speed) / Math.sqrt(2)
  311. turn_right unless up1(@x, @y, distance)
  312. turn_up if @event
  313. turn_up unless right1(@x, @y, distance) unless @event
  314. turn_right if @event
  315. end
  316. end
  317. end
  318.  
  319. class Sprite_Character < RPG::Sprite
  320. def update
  321. super
  322. # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  323. if @tile_id != @character.tile_id or
  324. @character_name != @character.character_name or
  325. @character_hue != @character.character_hue
  326. # 记忆元件 ID 与文件名、色相
  327. @tile_id = @character.tile_id
  328. @character_name = @character.character_name
  329. @character_hue = @character.character_hue
  330. # 元件 ID 为有效值的情况下
  331. if @tile_id >= 384
  332. self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  333. @tile_id, @character.character_hue)
  334. self.src_rect.set(0, 0, 32, 32)
  335. self.ox = 16
  336. self.oy = 32
  337. # 元件 ID 为无效值的情况下
  338. else
  339. self.bitmap = RPG::Cache.character(@character.character_name,
  340. @character.character_hue)
  341. @cw = bitmap.width / $c3_每一步的帧数
  342. if $c3_总共可用的方向数==4
  343. @ch = bitmap.height / 4
  344. else
  345. @ch = bitmap.height / 8
  346. end
  347. self.ox = @cw / 2
  348. self.oy = @ch
  349. end
  350. end
  351. # 设置可视状态
  352. self.visible = (not @character.transparent)
  353. # 图形是角色的情况下
  354. if @tile_id == 0
  355. # 设置传送目标的矩形
  356. sx = @character.pattern * @cw
  357. if $c3_总共可用的方向数==8
  358. case @character.direction
  359. when 2
  360. sy = 0 * @ch
  361. when 4
  362. sy = 1 * @ch
  363. when 6
  364. sy = 2 * @ch
  365. when 8
  366. sy = 3 * @ch
  367. when 1
  368. sy = 4 * @ch
  369. when 3
  370. sy = 5 * @ch
  371. when 7
  372. sy = 6 * @ch
  373. when 9
  374. sy = 7 * @ch
  375. end
  376. else
  377. sy = (@character.direction - 2) / 2 * @ch
  378. end
  379. self.src_rect.set(sx, sy, @cw, @ch)
  380. end
  381. # 设置脚本的坐标
  382. self.x = @character.screen_x
  383. self.y = @character.screen_y
  384. self.z = @character.screen_z(@ch)
  385. # 设置不透明度、合成方式、茂密
  386. self.opacity = @character.opacity
  387. self.blend_type = @character.blend_type
  388. self.bush_depth = @character.bush_depth
  389. # 动画
  390. if @character.animation_id != 0
  391. animation = $data_animations[@character.animation_id]
  392. animation(animation, true)
  393. @character.animation_id = 0
  394. end
  395. end
  396. end
  397. class Game_Character
  398. def c8
  399. # 随机 0~5 的分支
  400. case rand(10)
  401. when 0..3 # 随机
  402. move_random
  403. when 4 # 前进一步
  404. move_forward
  405. when 5 # 暂时停止
  406. @stop_count = 0
  407. when 6..9 #另外4方向随机
  408. c4
  409. end
  410. end
  411. def c4
  412. case rand(5)
  413. when 0
  414. move_upper_left
  415. when 1
  416. move_upper_right
  417. when 2
  418. move_lower_left
  419. when 3
  420. move_lower_right
  421. when 4
  422. @stop_count = 0
  423. end
  424. end
  425.  
  426. def update
  427. # 跳跃中、移动中、停止中的分支
  428. if jumping?
  429. update_jump
  430. elsif moving?
  431. update_move
  432. else
  433. update_stop
  434. end
  435. # 动画计数超过最大值的情况下
  436. # ※最大值等于基本值减去移动速度 * 1 的值
  437. if @anime_count > 16*4/$c3_每一步的帧数 - @move_speed * 2
  438. # 停止动画为 OFF 并且在停止中的情况下
  439. if not @step_anime and @stop_count > 0
  440. # 还原为原来的图形
  441. @pattern = @original_pattern
  442. # 停止动画为 ON 并且在移动中的情况下
  443. else
  444. # 更新图形
  445. @pattern = (@pattern + 1) % $c3_每一步的帧数
  446. end
  447. # 清除动画计数
  448. @anime_count = 0
  449. end
  450. # 等待中的情况下
  451. if @wait_count > 0
  452. # 减少等待计数
  453. @wait_count -= 1
  454. return
  455. end
  456. # 强制移动路线的场合
  457. if @move_route_forcing
  458. # 自定义移动
  459. move_type_custom
  460. return
  461. end
  462. # 事件执行待机中并且为锁定状态的情况下
  463. if @starting or lock?
  464. # 不做规则移动
  465. return
  466. end
  467. # 如果停止计数超过了一定的值(由移动频度算出)
  468. if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  469. # 移动类型分支
  470. case @move_type
  471. when 1 # 随机
  472. move_type_random
  473. when 2 # 接近
  474. move_type_toward_player
  475. when 3 # 自定义
  476. move_type_custom
  477. end
  478. end
  479. end
  480. end
  481. class Window_Base < Window
  482. def draw_actor_graphic(actor, x, y)
  483. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  484. cw = bitmap.width / $c3_每一步的帧数
  485. ch = bitmap.height / $c3_总共可用的方向数
  486. src_rect = Rect.new(0, 0, cw, ch)
  487. self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  488. end
  489. end


这是跟随

RUBY 代码复制
  1. ###########################################################################################################################
  2. # 脚本功能:八方向走与多帧移动之图片修正 + 人物跟随。
  3.  
  4. # 更新日期:2005年8月6日
  5.  
  6. # 更新内容:增加斜方向触发,增加斜方向面向角色(1步之内)
  7.  
  8. # 使用方法:将本脚本插入到main之前。如果你使用了雅土版的八方向走脚本,请确保这个脚本的顺序位置,在雅土八方向走脚本的后面。
  9.  
  10. # 预先处理:请输入每一步的帧数和总共可用的方向数
  11.  
  12. $c3_每一步的帧数 = 8
  13. $c3_总共可用的方向数 = 8 #——建议不要修改这个。如果要伪8方向的,就用伪的好了。
  14.  
  15. # 图片处理与功能说明:
  16.  
  17. # 1、每一步的帧数:
  18. #    众所周知,RMXP的移动行走图是一个方向共有4帧,很多人都觉得这个帧数有点少。
  19. # 使用这个脚本之后,只要将 $c3_每一步的帧数 这个变量设置一个需要的帧数即可修改
  20. # 单方向移动帧数为相应输入值。修改后,需要用photoshop将所有用到的素材的横排
  21. # 调整为相应帧数,比如输入了8则要将每一行设置8个图像(即每一个行走图有8列)。
  22.  
  23. # 2、可用方向调整(可用数量:4、8):
  24. #    当为4方向时没有任何变化,还是一个图4行,上左右下4个方向。
  25. #    如果想使用8方向走,将需要八方向行走的行走图在延伸扩大的画布中按照左下、右下、左上、右上继续排布图像。
  26. # 即,行走图图片从上到下的面向排列顺序为:下,左,右,上,左下,右下,左上,右上。
  27. #    至于不需要8方向走的普通的NPC(character),使用photoshop将画布向下扩大一倍即可使用。
  28. #    需要注意的是,如果需要斜方向飞鸟,请不要忘记自制素材。
  29.  
  30. # 特别提示:   
  31. #     使用本脚本前请先考虑清楚是否要做这种效果。因为使用本脚本后需要用photoshop处理character行走图素材
  32. # 虽然这种处理用photoshop定义动作只需要5分钟即可全部完成,但在制作阶段会感觉不是很爽(具体的用了才知道)
  33. # 作者的建议是,如果你没有足够的制作经验,使用这个脚本得不偿失。请确保自己的能力属于“高手”级别!
  34.  
  35. # 附赠功能:
  36. #     可以让NPC角色随机8方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c8即可
  37. #     可以让NPC角色随机4斜角方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c4即可
  38. #     可以使用真·斜4方向行走,参考脚本53行开始
  39.  
  40. # 作者:carol3
  41. ###########################################################################################################################
  42. ###########################################################################################################################
  43.  
  44. class Game_Player < Game_Character
  45. if $c3_总共可用的方向数 == 8
  46.    def update
  47.      last_moving = moving?
  48.      unless moving? or $game_system.map_interpreter.running? or
  49.             @move_route_forcing or $game_temp.message_window_showing
  50.        # 用井号后面的东西替代前面的,就可以实现斜4方向走
  51.        case Input.dir8
  52.        when 2
  53.          move_down #move_lower_left
  54.        when 4
  55.          move_left #move_upper_left
  56.        when 6
  57.          move_right #move_lower_right
  58.        when 8
  59.          move_up #move_upper_right
  60.        when 1
  61.          move_lower_left
  62.        when 3
  63.          move_lower_right
  64.        when 7
  65.          move_upper_left
  66.        when 9
  67.          move_upper_right
  68.        end
  69.      end
  70.      # 本地变量记忆坐标
  71.      last_real_x = @real_x
  72.      last_real_y = @real_y
  73.      super
  74.      # 角色向下移动、画面上的位置在中央下方的情况下
  75.      if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  76.        # 画面向下卷动
  77.        $game_map.scroll_down(@real_y - last_real_y)
  78.      end
  79.      # 角色向左移动、画面上的位置在中央左方的情况下
  80.      if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  81.        # 画面向左卷动
  82.        $game_map.scroll_left(last_real_x - @real_x)
  83.      end
  84.      # 角色向右移动、画面上的位置在中央右方的情况下
  85.      if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  86.        # 画面向右卷动
  87.        $game_map.scroll_right(@real_x - last_real_x)
  88.      end
  89.      # 角色向上移动、画面上的位置在中央上方的情况下
  90.      if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  91.        # 画面向上卷动
  92.        $game_map.scroll_up(last_real_y - @real_y)
  93.      end
  94.      # 不在移动中的情况下
  95.      unless moving?
  96.        # 上次主角移动中的情况
  97.        if last_moving
  98.          # 与同位置的事件接触就判定为事件启动
  99.          result = check_event_trigger_here([1,2])
  100.          # 没有可以启动的事件的情况下
  101.          if result == false
  102.            # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  103.            unless $DEBUG and Input.press?(Input::CTRL)
  104.              # 遇敌计数下降
  105.              if @encounter_count > 0
  106.                @encounter_count -= 1
  107.              end
  108.            end
  109.          end
  110.        end
  111.        # 按下 C 键的情况下
  112.        if Input.trigger?(Input::C)
  113.          # 判定为同位置以及正面的事件启动
  114.          check_event_trigger_here([0])
  115.          check_event_trigger_there([0,1,2])
  116.        end
  117.      end
  118.    end
  119.    #--------------------------------------------------------------------------
  120.    # ● 正面事件的启动判定
  121.    #--------------------------------------------------------------------------
  122.    def check_event_trigger_there(triggers)
  123.      result = false
  124.      # 事件执行中的情况下
  125.      if $game_system.map_interpreter.running?
  126.        return result
  127.      end
  128.      # 计算正面坐标
  129.      new_x = @x
  130.      new_y = @y
  131.      case @direction
  132.      when 1
  133.        new_x -= 1
  134.        new_y += 1
  135.      when 2
  136.        new_y += 1
  137.      when 3
  138.        new_x += 1
  139.        new_y += 1
  140.      when 4
  141.        new_x -= 1
  142.      when 6
  143.        new_x += 1
  144.      when 7
  145.        new_x -= 1
  146.        new_y -= 1
  147.      when 8
  148.        new_y -= 1
  149.      when 9
  150.        new_x += 1
  151.        new_y -= 1
  152.      end
  153.      # 全部事件的循环
  154.      for event in $game_map.events.values
  155.        # 事件坐标与目标一致的情况下
  156.        if event.x == new_x and event.y == new_y and
  157.           triggers.include?(event.trigger)
  158.          # 跳跃中以外的情况下、启动判定是正面的事件
  159.          if not event.jumping? and not event.over_trigger?
  160.            event.start
  161.            result = true
  162.          end
  163.        end
  164.      end
  165.      # 找不到符合条件的事件的情况下
  166.      if result == false
  167.        # 正面的元件是计数器的情况下
  168.        if $game_map.counter?(new_x, new_y)
  169.          # 计算 1 元件里侧的坐标
  170.          new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  171.          new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  172.          # 全事件的循环
  173.          for event in $game_map.events.values
  174.            # 事件坐标与目标一致的情况下
  175.            if event.x == new_x and event.y == new_y and
  176.               triggers.include?(event.trigger)
  177.              # 跳跃中以外的情况下、启动判定是正面的事件
  178.              if not event.jumping? and not event.over_trigger?
  179.                event.start
  180.                result = true
  181.              end
  182.            end
  183.          end
  184.        end
  185.      end
  186.      return result
  187.    end
  188. end
  189. end
  190.  
  191.  
  192. class Sprite_Character < RPG::Sprite
  193. def update
  194.    super
  195.    # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  196.    if @tile_id != @character.tile_id or
  197.       @character_name != @character.character_name or
  198.       @character_hue != @character.character_hue
  199.      # 记忆元件 ID 与文件名、色相
  200.      @tile_id = @character.tile_id
  201.      @character_name = @character.character_name
  202.      @character_hue = @character.character_hue
  203.      # 元件 ID 为有效值的情况下
  204.      if @tile_id >= 384
  205.        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  206.          @tile_id, @character.character_hue)
  207.        self.src_rect.set(0, 0, 32, 32)
  208.        self.ox = 16
  209.        self.oy = 32
  210.      # 元件 ID 为无效值的情况下
  211.      else
  212.        self.bitmap = RPG::Cache.character(@character.character_name,
  213.          @character.character_hue)
  214.        @cw = bitmap.width / $c3_每一步的帧数
  215.        if $c3_总共可用的方向数==4
  216.          @ch = bitmap.height / 4
  217.        else
  218.          @ch = bitmap.height / 8
  219.        end
  220.        self.ox = @cw / 2
  221.        self.oy = @ch
  222.      end
  223.    end
  224.    # 设置可视状态
  225.    self.visible = (not @character.transparent)
  226.    # 图形是角色的情况下
  227.    if @tile_id == 0
  228.      # 设置传送目标的矩形
  229.      sx = @character.pattern * @cw
  230.      if $c3_总共可用的方向数==8
  231.        case @character.direction
  232.        when 2
  233.          sy = 0 * @ch
  234.        when 4
  235.          sy = 1 * @ch
  236.        when 6
  237.          sy = 2 * @ch
  238.        when 8
  239.          sy = 3 * @ch
  240.        when 1
  241.          sy = 4 * @ch
  242.        when 3
  243.          sy = 5 * @ch
  244.        when 7
  245.          sy = 6 * @ch
  246.        when 9
  247.          sy = 7 * @ch
  248.        end
  249.      else
  250.        sy = (@character.direction - 2) / 2 * @ch
  251.      end
  252.      self.src_rect.set(sx, sy, @cw, @ch)
  253.    end
  254.    # 设置脚本的坐标
  255.    self.x = @character.screen_x
  256.    self.y = @character.screen_y
  257.    self.z = @character.screen_z(@ch)
  258.    # 设置不透明度、合成方式、茂密
  259.    self.opacity = @character.opacity
  260.    self.blend_type = @character.blend_type
  261.    self.bush_depth = @character.bush_depth
  262.    # 动画
  263.    if @character.animation_id != 0
  264.      animation = $data_animations[@character.animation_id]
  265.      animation(animation, true)
  266.      @character.animation_id = 0
  267.    end
  268.    #####################################################################
  269. #  id = $game_map.map_id
  270. #   name = $data_mapinfos[id].name
  271. #   if name.include?("★") and not @character.character_name.include?("★★")
  272.     # rage = name.split(/★/)[1]
  273.     # min_rate = rage.split(/~/)[0].to_f
  274.    #  max_rate = rage.split(/~/)[1].to_f
  275.     # rate =  min_rate + (@character.y.to_f / $game_map.height.to_f * (max_rate - min_rate))
  276.    #  self.zoom_x = self.zoom_y = rate
  277. #  end
  278.    ####################################################################
  279. end
  280. end
  281.  
  282. class Game_Character
  283. def c8
  284.    # 随机 0~5 的分支
  285.    case rand(10)
  286.    when 0..3  # 随机
  287.      move_random
  288.    when 4  # 前进一步
  289.      move_forward
  290.    when 5  # 暂时停止
  291.      @stop_count = 0
  292.    when 6..9  #另外4方向随机
  293.      c4
  294.    end
  295. end
  296. def c4
  297.    case rand(5)
  298.    when 0
  299.      move_upper_left
  300.      @direction = 7
  301.    when 1
  302.      move_upper_right
  303.      @direction = 9
  304.    when 2
  305.      move_lower_left
  306.      @direction = 1
  307.    when 3
  308.      move_lower_right
  309.      @direction = 3
  310.    when 4
  311.      @stop_count = 0
  312.    end
  313. end
  314.  
  315. def update
  316.    # 跳跃中、移动中、停止中的分支
  317.    if jumping?
  318.      update_jump
  319.    elsif moving?
  320.      update_move
  321.    else
  322.      update_stop
  323.    end
  324.    # 动画计数超过最大值的情况下
  325.    # ※最大值等于基本值减去移动速度 * 1 的值
  326.    if @anime_count > 16 * 4/$c3_每一步的帧数 - @move_speed # * 2
  327.      # 停止动画为 OFF 并且在停止中的情况下
  328.      if not @step_anime and @stop_count > 0
  329.        # 还原为原来的图形
  330.        @pattern = @original_pattern
  331.      # 停止动画为 ON 并且在移动中的情况下
  332.      else
  333.        # 更新图形
  334.        @pattern = (@pattern + 1) % $c3_每一步的帧数
  335.      end
  336.      # 清除动画计数
  337.      @anime_count = 0
  338.    end
  339.    # 等待中的情况下
  340.    if @wait_count > 0
  341.      # 减少等待计数
  342.      @wait_count -= 1
  343.      return
  344.    end
  345.    # 强制移动路线的场合
  346.    if @move_route_forcing
  347.      # 自定义移动
  348.      move_type_custom
  349.      return
  350.    end
  351.    # 事件执行待机中并且为锁定状态的情况下
  352.    if @starting or lock?
  353.      # 不做规则移动
  354.      return
  355.    end
  356.    # 如果停止计数超过了一定的值(由移动频度算出)
  357.    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  358.      # 移动类型分支
  359.      case @move_type
  360.      when 1  # 随机
  361.        move_type_random
  362.      when 2  # 接近
  363.        move_type_toward_player
  364.      when 3  # 自定义
  365.        move_type_custom
  366.      end
  367.    end
  368. end
  369. end
  370.  
  371. class Window_Base < Window
  372. def draw_actor_graphic(actor, x, y)
  373.    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  374.    cw = bitmap.width / $c3_每一步的帧数
  375.    ch = bitmap.height / $c3_总共可用的方向数
  376.    src_rect = Rect.new(0, 0, cw, ch)
  377.    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  378. end
  379. end
  380.  
  381. class Game_Character
  382. #............................................................................
  383. #----------------------------------------------------------------------------
  384. # ● 寻路移动
  385. #----------------------------------------------------------------------------
  386. def goto(x, y)
  387.    #当操作目标为 角色 时
  388.    trg_x = x
  389.    trg_y = y
  390.    self_x = self.x
  391.    self_y = self.y
  392.    real_self_x = self.screen_x
  393.    real_self_y = self.screen_y
  394.    real_trg_x = x
  395.    real_trg_y = y
  396.    #调用寻路算法,开始计算路线
  397.    @find_path = Find_Path.new
  398.    @path = @find_path.find_short_path(self_x, self_y, trg_x, trg_y,
  399.                           real_self_x, real_self_y, real_trg_x, real_trg_y)
  400.    #开始自动移动,参照本类的 update方法
  401.    @go_path = true
  402.    #自动移动 处理位置初始化
  403.    @path_id = 0
  404. end
  405. #............................................................................
  406. #--------------------------------------------------------------------------
  407. # ● 面向主角的方向
  408. #--------------------------------------------------------------------------
  409. def turn_toward_player
  410.    # 求得与主角的坐标差
  411.    sx = @x - $game_player.x
  412.    sy = @y - $game_player.y
  413.    # 坐标相等的场合下
  414.    if sx == 0 and sy == 0
  415.      return
  416.    end
  417.    # 横侧距离长的情况下
  418.    if sx.abs > sy.abs
  419.      # 将左右方向变更为朝向主角的方向
  420.      sx > 0 ? turn_left : turn_right
  421.    # 竖侧距离长的情况下
  422.    else
  423.      # 将上下方向变更为朝向主角的方向
  424.      sy > 0 ? turn_up : turn_down
  425.    end
  426.    if sx == -1 and sy == -1
  427.      unless @direction_fix
  428.        @direction = 3
  429.      end
  430.      @stop_count = 0
  431.    elsif sx == -1 and sy == 1
  432.      unless @direction_fix
  433.        @direction = 9
  434.      end
  435.      @stop_count = 0
  436.    elsif sx == 1 and sy == -1
  437.      unless @direction_fix
  438.        @direction = 1
  439.      end
  440.      @stop_count = 0
  441.    elsif sx == 1 and sy == 1
  442.      unless @direction_fix
  443.        @direction = 7
  444.      end
  445.      @stop_count = 0
  446.    end
  447. end
  448. end
  449. #==============================================================================
  450. #==============================================================================

其实我是个三流的画师  ←_←
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
22 小时
注册时间
2014-4-7
帖子
53
5
 楼主| 发表于 2014-4-16 20:31:41 | 只看该作者
512195574 发表于 2014-4-16 20:15
八方向脚本(默认素材格式8X8),注释很详细,就不解释了

大还是不行呀,但是变成两个人了,而不是八个人
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
192 小时
注册时间
2010-8-23
帖子
161
6
发表于 2014-4-16 22:01:45 | 只看该作者
你那行走图是8*16的
$c3_每一步的帧数 = 8
改成$c3_每一步的帧数 = 16试试
其实我是个三流的画师  ←_←
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
22 小时
注册时间
2014-4-7
帖子
53
7
 楼主| 发表于 2014-4-17 19:05:24 | 只看该作者
512195574 发表于 2014-4-16 22:01
你那行走图是8*16的
$c3_每一步的帧数 = 8
改成$c3_每一步的帧数 = 16试试

哦?.....
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 21:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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