Project1

标题: 八方像素横向行走(类似地下城) [打印本页]

作者: 咚小黑    时间: 2011-11-20 19:07
标题: 八方像素横向行走(类似地下城)
至于出处,我不知道在哪了,以前海外看到的。

按照提示修改了一下,回了这个脚本给大家。(我很喜欢这种行走)
注意:NPC的随机移动是跟主角一样的。
  1. =begin
  2. ================================================================================
  3. Amethyst Custom Movement - v1.2 RMVX - 25/03/2010
  4. ================================================================================

  5. --------------------------------------------------------------------------------
  6. Credits\Terms of Use
  7. --------------------------------------------------------------------------------
  8. Created by Khas ([email protected])
  9. All Amethyst Scripts are licensed under a Creative Commons license
  10. All Amethyst Scripts are for non-commercial projects, if you need
  11. them for a commercial game, please send a email to [email protected]

  12. --------------------------------------------------------------------------------
  13. Features
  14. --------------------------------------------------------------------------------
  15. This script creates an advanced movement, including "half-tile" step,
  16. diagonal movement and an advanced touch trigger feature.
  17. ACM is also compatible with RMVX vehicles

  18. --------------------------------------------------------------------------------
  19. Configuration
  20. --------------------------------------------------------------------------------
  21. =end
  22. module Amcm_Config
  23. # Enable Diagonal movement for Player?
  24. Enable_Player_Diagonal = true
  25. # Enable Diagonal movement for events?
  26. Enable_Event_Diagonal = true
  27. # Enable "half-tile" step for events?
  28. Enable_Event_Movement = true
  29. # Enable Advanced Trigger Touch feature?
  30. Enable_Advanced_Touch = true
  31. end
  32. #-------------------------------------------------------------------------------

  33. $Amethyst_Scripts = {} if $Amethyst_Scripts.nil?
  34. $Amethyst_Scripts["Am Custom Movement"] = ["1.2","25/03/2010"]

  35. class Game_Character
  36. def amcm_integer?(value)
  37. i = value.to_i; return value == i
  38. end
  39. def pos?(x, y)
  40. if amcm_integer?(@x)
  41. if amcm_integer?(@y)
  42. return (@x == x and @y == y)
  43. else
  44. return (@x == x and (@y.to_i == y or @y.to_i+1 == y))
  45. end
  46. elsif amcm_integer?(@y)
  47. return ((@x.to_i == x or @x.to_i+1 == x) and @y == y)
  48. else
  49. return ((@x.to_i == x or @x.to_i+1 == x)and(@y.to_i == y or @y.to_i+1 == y))
  50. end
  51. end
  52. if Amcm_Config::Enable_Event_Diagonal
  53. def move_random
  54. case rand(8)
  55. when 0; move_down(false)
  56. when 1; move_left(false)
  57. when 2; move_right(false)
  58. when 3; move_up(false)
  59. when 4; move_lower_left
  60. when 5; move_lower_right
  61. when 6; move_upper_left
  62. when 7; move_upper_right
  63. end
  64. end
  65. end
  66. if Amcm_Config::Enable_Event_Movement
  67. def move_down(turn_ok = true)
  68. if amcm_integer?(@x)
  69. if amcm_integer?(@y)
  70. if passable?(@x, @y+1)
  71. @y = $game_map.round_y(@y+0.5)
  72. @real_y = (@y-0.5)*256
  73. increase_steps
  74. @move_failed = false
  75. else
  76. check_event_trigger_touch(@x, @y+1)
  77. @move_failed = true
  78. end
  79. else
  80. @y = $game_map.round_y(@y+0.5)
  81. @real_y = (@y-0.5)*256
  82. increase_steps
  83. @move_failed = false
  84. end
  85. elsif amcm_integer?(@y)
  86. if passable?(@x.to_i, @y+1) and passable?(@x.to_i+1, @y+1)
  87. @y = $game_map.round_y(@y+0.5)
  88. @real_y = (@y-0.5)*256
  89. increase_steps
  90. @move_failed = false
  91. else
  92. check_event_trigger_touch(@x.to_i+1, @y+1)
  93. check_event_trigger_touch(@x.to_i, @y+1)
  94. @move_failed = true
  95. end
  96. else
  97. @y = $game_map.round_y(@y+0.5)
  98. @real_y = (@y-0.5)*256
  99. increase_steps
  100. @move_failed = false
  101. end
  102. end
  103. def move_up(turn_ok = true)
  104. if amcm_integer?(@x)
  105. if amcm_integer?(@y)
  106. if passable?(@x, @y-1)
  107. @y = $game_map.round_y(@y-0.5)
  108. @real_y = (@y+0.5)*256
  109. increase_steps
  110. @move_failed = false
  111. else
  112. check_event_trigger_touch(@x, @y-1)
  113. @move_failed = true
  114. end
  115. else
  116. @y = $game_map.round_y(@y-0.5)
  117. @real_y = (@y+0.5)*256
  118. increase_steps
  119. @move_failed = false
  120. end
  121. elsif amcm_integer?(@y)
  122. if passable?(@x.to_i, @y-1) and passable?(@x.to_i+1, @y-1)
  123. @y = $game_map.round_y(@y-0.5)
  124. @real_y = (@y+0.5)*256
  125. increase_steps
  126. @move_failed = false
  127. else
  128. check_event_trigger_touch(@x.to_i, @y-1)
  129. check_event_trigger_touch(@x.to_i+1, @y-1)
  130. @move_failed = true
  131. end
  132. else
  133. @y = $game_map.round_y(@y-0.5)
  134. @real_y = (@y+0.5)*256
  135. increase_steps
  136. @move_failed = false
  137. end
  138. end
  139. def move_left(turn_ok = true)
  140. if amcm_integer?(@y)
  141. if amcm_integer?(@x)
  142. if passable?(@x-1, @y)
  143. turn_left
  144. @x = $game_map.round_x(@x-0.5)
  145. @real_x = (@x+0.5)*256
  146. increase_steps
  147. @move_failed = false
  148. else
  149. turn_left if turn_ok
  150. check_event_trigger_touch(@x-1, @y)
  151. @move_failed = true
  152. end
  153. else
  154. turn_left
  155. @x = $game_map.round_x(@x-0.5)
  156. @real_x = (@x+0.5)*256
  157. increase_steps
  158. @move_failed = false
  159. end
  160. elsif amcm_integer?(@x)
  161. if passable?(@x-1,@y.to_i) and passable?(@x-1,@y.to_i+1)
  162. turn_left
  163. @x = $game_map.round_x(@x-0.5)
  164. @real_x = (@x+0.5)*256
  165. increase_steps
  166. @move_failed = false
  167. else
  168. turn_left if turn_ok
  169. check_event_trigger_touch(@x-1, @y.to_i)
  170. check_event_trigger_touch(@x-1, @y.to_i+1)
  171. @move_failed = true
  172. end
  173. else
  174. turn_left
  175. @x = $game_map.round_x(@x-0.5)
  176. @real_x = (@x+0.5)*256
  177. increase_steps
  178. @move_failed = false
  179. end
  180. end
  181. def move_right(turn_ok = true)
  182. if amcm_integer?(@y)
  183. if amcm_integer?(@x)
  184. if passable?(@x+1, @y)
  185. turn_right
  186. @x = $game_map.round_x(@x+0.5)
  187. @real_x = (@x-0.5)*256
  188. increase_steps
  189. @move_failed = false
  190. else
  191. turn_right if turn_ok
  192. check_event_trigger_touch(@x+1, @y)
  193. @move_failed = true
  194. end
  195. else
  196. turn_right
  197. @x = $game_map.round_x(@x+0.5)
  198. @real_x = (@x-0.5)*256
  199. increase_steps
  200. @move_failed = false
  201. end
  202. elsif amcm_integer?(@x)
  203. if passable?(@x+1,@y.to_i) and passable?(@x+1,@y.to_i+1)
  204. turn_right
  205. @x = $game_map.round_x(@x+0.5)
  206. @real_x = (@x-0.5)*256
  207. increase_steps
  208. @move_failed = false
  209. else
  210. turn_right if turn_ok
  211. check_event_trigger_touch(@x+1, @y.to_i)
  212. check_event_trigger_touch(@x+1, @y.to_i+1)
  213. @move_failed = true
  214. end
  215. else
  216. turn_right
  217. @x = $game_map.round_x(@x+0.5)
  218. @real_x = (@x-0.5)*256
  219. increase_steps
  220. @move_failed = false
  221. end
  222. end
  223. def move_lower_left
  224. unless @direction_fix
  225. @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  226. end
  227. if amcm_integer?(@x)
  228. if amcm_integer?(@y)
  229. if passable?(@x-1,@y) and passable?(@x-1,@y+1) and passable?(@x,@y+1)
  230. @x -= 0.5
  231. @y += 0.5
  232. increase_steps
  233. @move_failed = false
  234. else
  235. @move_failed = true
  236. end
  237. else
  238. if passable?(@x-1,@y.to_i+1)
  239. @x -= 0.5
  240. @y += 0.5
  241. increase_steps
  242. @move_failed = false
  243. else
  244. @move_failed = true
  245. end
  246. end
  247. elsif amcm_integer?(@y)
  248. if passable?(@x.to_i,@y+1)
  249. @x -= 0.5
  250. @y += 0.5
  251. increase_steps
  252. @move_failed = false
  253. else
  254. @move_failed = true
  255. end
  256. else
  257. @x -= 0.5
  258. @y += 0.5
  259. increase_steps
  260. @move_failed = false
  261. end
  262. end
  263. def move_lower_right
  264. unless @direction_fix
  265. @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  266. end
  267. if amcm_integer?(@x)
  268. if amcm_integer?(@y)
  269. if passable?(@x+1,@y) and passable?(@x+1,@y+1) and passable?(@x,@y+1)
  270. @x += 0.5
  271. @y += 0.5
  272. increase_steps
  273. @move_failed = false
  274. else
  275. @move_failed = true
  276. end
  277. else
  278. if passable?(@x+1,@y.to_i+1)
  279. @x += 0.5
  280. @y += 0.5
  281. increase_steps
  282. @move_failed = false
  283. else
  284. @move_failed = true
  285. end
  286. end
  287. elsif amcm_integer?(@y)
  288. if passable?(@x.to_i+1,@y+1)
  289. @x += 0.5
  290. @y += 0.5
  291. increase_steps
  292. @move_failed = false
  293. else
  294. @move_failed = true
  295. end
  296. else
  297. @x += 0.5
  298. @y += 0.5
  299. increase_steps
  300. @move_failed = false
  301. end
  302. end
  303. def move_upper_left
  304. unless @direction_fix
  305. @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  306. end
  307. if amcm_integer?(@x)
  308. if amcm_integer?(@y)
  309. if passable?(@x-1,@y) and passable?(@x-1,@y-1) and passable?(@x,@y-1)
  310. @x -= 0.5
  311. @y -= 0.5
  312. increase_steps
  313. @move_failed = false
  314. else
  315. @move_failed = true
  316. end
  317. else
  318. if passable?(@x-1,@y.to_i)
  319. @x -= 0.5
  320. @y -= 0.5
  321. increase_steps
  322. @move_failed = false
  323. else
  324. @move_failed = true
  325. end
  326. end
  327. elsif amcm_integer?(@y)
  328. if passable?(@x.to_i,@y-1)
  329. @x -= 0.5
  330. @y -= 0.5
  331. increase_steps
  332. @move_failed = false
  333. else
  334. @move_failed = true
  335. end
  336. else
  337. @x -= 0.5
  338. @y -= 0.5
  339. increase_steps
  340. @move_failed = false
  341. end
  342. end
  343. def move_upper_right
  344. unless @direction_fix
  345. @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  346. end
  347. if amcm_integer?(@x)
  348. if amcm_integer?(@y)
  349. if passable?(@x+1,@y) and passable?(@x+1,@y-1) and passable?(@x,@y-1)
  350. @x += 0.5
  351. @y -= 0.5
  352. increase_steps
  353. @move_failed = false
  354. else
  355. @move_failed = true
  356. end
  357. else
  358. if passable?(@x+1,@y.to_i)
  359. @x += 0.5
  360. @y -= 0.5
  361. increase_steps
  362. @move_failed = false
  363. else
  364. @move_failed = true
  365. end
  366. end
  367. elsif amcm_integer?(@y)
  368. if passable?(@x.to_i+1,@y-1)
  369. @x += 0.5
  370. @y -= 0.5
  371. increase_steps
  372. @move_failed = false
  373. else
  374. @move_failed = true
  375. end
  376. else
  377. @x += 0.5
  378. @y -= 0.5
  379. increase_steps
  380. @move_failed = false
  381. end
  382. end
  383. end
  384. end

  385. class Game_Player < Game_Character
  386. if Amcm_Config::Enable_Player_Diagonal
  387. def move_by_input
  388. @run_event = false
  389. return unless movable?
  390. return if $game_map.interpreter.running?
  391. case Input.dir8
  392. when 1; move_lower_left
  393. when 2; move_down
  394. when 3; move_lower_right
  395. when 4; move_left
  396. when 6; move_right
  397. when 7; move_upper_left
  398. when 8; move_up
  399. when 9; move_upper_right
  400. end
  401. end
  402. end
  403. def get_amx(plus=false)
  404. if plus
  405. case @direction
  406. when 2; amcm_integer?(@x) ? i = @x : i = false
  407. when 4; amcm_integer?(@x) ? i = @x-1 : i = false
  408. when 6; amcm_integer?(@x) ? i = @x+1 : i = false
  409. when 8; amcm_integer?(@x) ? i = @x : i = false
  410. end
  411. return i
  412. else
  413. amcm_integer?(@x) ? i = @x : i = [@x.to_i,@x.to_i+1]; return i
  414. end
  415. end
  416. def get_amy(plus=false)
  417. if plus
  418. case @direction
  419. when 2; amcm_integer?(@y) ? i = @y+1 : i = false
  420. when 4; amcm_integer?(@y) ? i = @y : i = false
  421. when 6; amcm_integer?(@y) ? i = @y : i = false
  422. when 8; amcm_integer?(@y) ? i = @y-1 : i = false
  423. end
  424. return i
  425. else
  426. amcm_integer?(@y) ? i = @y : i = [@y.to_i,@y.to_i+1]; return i
  427. end
  428. end
  429. if Amcm_Config::Enable_Advanced_Touch
  430. def check_event_trigger_here(triggers)
  431. return false if $game_map.interpreter.running?
  432. result = false
  433. ax = get_amx
  434. ay = get_amy
  435. if ax.is_a?(Array)
  436. if ay.is_a?(Array)
  437. for event in $game_map.events_xy(ax[0],ay[0])
  438. if triggers.include?(event.trigger) and event.priority_type != 1
  439. event.start
  440. return true if event.starting
  441. end
  442. end
  443. for event in $game_map.events_xy(ax[0],ay[1])
  444. if triggers.include?(event.trigger) and event.priority_type != 1
  445. event.start
  446. return true if event.starting
  447. end
  448. end
  449. for event in $game_map.events_xy(ax[1],ay[0])
  450. if triggers.include?(event.trigger) and event.priority_type != 1
  451. event.start
  452. return true if event.starting
  453. end
  454. end
  455. for event in $game_map.events_xy(ax[1],ay[1])
  456. if triggers.include?(event.trigger) and event.priority_type != 1
  457. event.start
  458. return true if event.starting
  459. end
  460. end
  461. else
  462. for event in $game_map.events_xy(ax[0],ay)
  463. if triggers.include?(event.trigger) and event.priority_type != 1
  464. event.start
  465. return true if event.starting
  466. end
  467. end
  468. for event in $game_map.events_xy(ax[1],ay)
  469. if triggers.include?(event.trigger) and event.priority_type != 1
  470. event.start
  471. return true if event.starting
  472. end
  473. end
  474. end
  475. elsif ay.is_a?(Array)
  476. for event in $game_map.events_xy(ax,ay[0])
  477. if triggers.include?(event.trigger) and event.priority_type != 1
  478. event.start
  479. return true if event.starting
  480. end
  481. end
  482. for event in $game_map.events_xy(ax,ay[1])
  483. if triggers.include?(event.trigger) and event.priority_type != 1
  484. event.start
  485. return true if event.starting
  486. end
  487. end
  488. else
  489. for event in $game_map.events_xy(ax,ay)
  490. if triggers.include?(event.trigger) and event.priority_type != 1
  491. event.start
  492. return true if event.starting
  493. end
  494. end
  495. end
  496. return result
  497. end
  498. else
  499. def check_event_trigger_here(triggers)
  500. return false if $game_map.interpreter.running?
  501. result = false
  502. for event in $game_map.events_xy(@x, @y)
  503. if triggers.include?(event.trigger) and event.priority_type != 1
  504. event.start
  505. result = true if event.starting
  506. end
  507. end
  508. return result
  509. end
  510. end
  511. def check_event_trigger_there(triggers)
  512. return false if $game_map.interpreter.running?
  513. result = false
  514. front_x = get_amx(true)
  515. front_y = get_amy(true)
  516. return if !front_x or !front_y
  517. for event in $game_map.events_xy(front_x, front_y)
  518. if triggers.include?(event.trigger) and event.priority_type == 1
  519. event.start
  520. result = true
  521. end
  522. end
  523. if result == false and $game_map.counter?(front_x, front_y)
  524. front_x = $game_map.x_with_direction(front_x, @direction)
  525. front_y = $game_map.y_with_direction(front_y, @direction)
  526. for event in $game_map.events_xy(front_x, front_y)
  527. if triggers.include?(event.trigger) and event.priority_type == 1
  528. event.start
  529. result = true
  530. end
  531. end
  532. end
  533. return result
  534. end
  535. def get_on_vehicle
  536. front_x = get_amx(true)
  537. front_y = get_amy(true)
  538. if $game_map.airship.pos?(@x, @y)
  539. get_on_airship
  540. return true
  541. elsif $game_map.ship.pos?(front_x, front_y)
  542. get_on_ship
  543. return true
  544. elsif $game_map.boat.pos?(front_x, front_y)
  545. get_on_boat
  546. return true
  547. end
  548. return false
  549. end
  550. def force_vland
  551. if amcm_integer?(@x)
  552. if amcm_integer?(@y)
  553. return
  554. else
  555. case @direction
  556. when 2; move_forward
  557. when 8; move_forward
  558. else
  559. case rand(2)
  560. when 0; move_up
  561. when 1; move_down
  562. end
  563. end
  564. end
  565. elsif amcm_integer?(@y)
  566. case @direction
  567. when 4; move_forward
  568. when 6; move_forward
  569. else
  570. case rand(2)
  571. when 0; move_left
  572. when 1; move_right
  573. end
  574. end
  575. else
  576. case @direction
  577. when 2;
  578. case rand(2)
  579. when 0; move_lower_right
  580. when 1; move_lower_left
  581. end
  582. when 4;
  583. case rand(2)
  584. when 0; move_lower_left
  585. when 1; move_upper_left
  586. end
  587. when 6;
  588. case rand(2)
  589. when 0; move_lower_right
  590. when 1; move_upper_right
  591. end
  592. when 8;
  593. case rand(2)
  594. when 0; move_upper_right
  595. when 1; move_upper_left
  596. end
  597. end
  598. end
  599. return (amcm_integer?(@x) and amcm_integer?(@y))
  600. end
  601. def force_move_forward
  602. @through = true
  603. move_forward
  604. move_forward if in_vehicle?
  605. @through = false
  606. end
  607. def get_off_vehicle
  608. if in_airship?
  609. return if force_vland
  610. return unless airship_land_ok?(@x, @y)
  611. else
  612. return if force_vland
  613. front_x = get_amx(true)
  614. front_y = get_amy(true)
  615. return unless can_walk?(front_x, front_y)
  616. end
  617. $game_map.vehicles[@vehicle_type].get_off
  618. if in_airship?
  619. @direction = 2
  620. else
  621. force_move_forward
  622. @transparent = false
  623. end
  624. @vehicle_getting_off = true
  625. @move_speed = 4
  626. @through = false
  627. @walking_bgm.play
  628. make_encounter_count
  629. end
  630. if not Amcm_Config::Enable_Event_Movement
  631. def move_down(turn_ok = true)
  632. if amcm_integer?(@x)
  633. if amcm_integer?(@y)
  634. if passable?(@x, @y+1)
  635. @y = $game_map.round_y(@y+0.5)
  636. @real_y = (@y-0.5)*256
  637. increase_steps
  638. @move_failed = false
  639. else
  640. check_event_trigger_touch(@x, @y+1)
  641. @move_failed = true
  642. end
  643. else
  644. turn_down
  645. @y = $game_map.round_y(@y+0.5)
  646. @real_y = (@y-0.5)*256
  647. increase_steps
  648. @move_failed = false
  649. end
  650. elsif amcm_integer?(@y)
  651. if passable?(@x.to_i, @y+1) and passable?(@x.to_i+1, @y+1)
  652. @y = $game_map.round_y(@y+0.5)
  653. @real_y = (@y-0.5)*256
  654. increase_steps
  655. @move_failed = false
  656. else
  657. check_event_trigger_touch(@x.to_i+1, @y+1)
  658. check_event_trigger_touch(@x.to_i, @y+1)
  659. @move_failed = true
  660. end
  661. else
  662. turn_down
  663. @y = $game_map.round_y(@y+0.5)
  664. @real_y = (@y-0.5)*256
  665. increase_steps
  666. @move_failed = false
  667. end
  668. end
  669. def move_up(turn_ok = true)
  670. if amcm_integer?(@x)
  671. if amcm_integer?(@y)
  672. if passable?(@x, @y-1)
  673. @y = $game_map.round_y(@y-0.5)
  674. @real_y = (@y+0.5)*256
  675. increase_steps
  676. @move_failed = false
  677. else
  678. check_event_trigger_touch(@x, @y-1)
  679. @move_failed = true
  680. end
  681. else
  682. turn_up
  683. @y = $game_map.round_y(@y-0.5)
  684. @real_y = (@y+0.5)*256
  685. increase_steps
  686. @move_failed = false
  687. end
  688. elsif amcm_integer?(@y)
  689. if passable?(@x.to_i, @y-1) and passable?(@x.to_i+1, @y-1)
  690. @y = $game_map.round_y(@y-0.5)
  691. @real_y = (@y+0.5)*256
  692. increase_steps
  693. @move_failed = false
  694. else
  695. check_event_trigger_touch(@x.to_i, @y-1)
  696. check_event_trigger_touch(@x.to_i+1, @y-1)
  697. @move_failed = true
  698. end
  699. else
  700. turn_up
  701. @y = $game_map.round_y(@y-0.5)
  702. @real_y = (@y+0.5)*256
  703. increase_steps
  704. @move_failed = false
  705. end
  706. end
  707. def move_left(turn_ok = true)
  708. if amcm_integer?(@y)
  709. if amcm_integer?(@x)
  710. if passable?(@x-1, @y)
  711. turn_left
  712. @x = $game_map.round_x(@x-0.5)
  713. @real_x = (@x+0.5)*256
  714. increase_steps
  715. @move_failed = false
  716. else
  717. turn_left if turn_ok
  718. check_event_trigger_touch(@x-1, @y)
  719. @move_failed = true
  720. end
  721. else
  722. turn_left
  723. @x = $game_map.round_x(@x-0.5)
  724. @real_x = (@x+0.5)*256
  725. increase_steps
  726. @move_failed = false
  727. end
  728. elsif amcm_integer?(@x)
  729. if passable?(@x-1,@y.to_i) and passable?(@x-1,@y.to_i+1)
  730. turn_left
  731. @x = $game_map.round_x(@x-0.5)
  732. @real_x = (@x+0.5)*256
  733. increase_steps
  734. @move_failed = false
  735. else
  736. turn_left if turn_ok
  737. check_event_trigger_touch(@x-1, @y.to_i)
  738. check_event_trigger_touch(@x-1, @y.to_i+1)
  739. @move_failed = true
  740. end
  741. else
  742. turn_left
  743. @x = $game_map.round_x(@x-0.5)
  744. @real_x = (@x+0.5)*256
  745. increase_steps
  746. @move_failed = false
  747. end
  748. end
  749. def move_right(turn_ok = true)
  750. if amcm_integer?(@y)
  751. if amcm_integer?(@x)
  752. if passable?(@x+1, @y)
  753. turn_right
  754. @x = $game_map.round_x(@x+0.5)
  755. @real_x = (@x-0.5)*256
  756. increase_steps
  757. @move_failed = false
  758. else
  759. turn_right if turn_ok
  760. check_event_trigger_touch(@x+1, @y)
  761. @move_failed = true
  762. end
  763. else
  764. turn_right
  765. @x = $game_map.round_x(@x+0.5)
  766. @real_x = (@x-0.5)*256
  767. increase_steps
  768. @move_failed = false
  769. end
  770. elsif amcm_integer?(@x)
  771. if passable?(@x+1,@y.to_i) and passable?(@x+1,@y.to_i+1)
  772. turn_right
  773. @x = $game_map.round_x(@x+0.5)
  774. @real_x = (@x-0.5)*256
  775. increase_steps
  776. @move_failed = false
  777. else
  778. turn_right if turn_ok
  779. check_event_trigger_touch(@x+1, @y.to_i)
  780. check_event_trigger_touch(@x+1, @y.to_i+1)
  781. @move_failed = true
  782. end
  783. else
  784. turn_right
  785. @x = $game_map.round_x(@x+0.5)
  786. @real_x = (@x-0.5)*256
  787. increase_steps
  788. @move_failed = false
  789. end
  790. end
  791. def move_lower_left
  792. unless @direction_fix
  793. @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  794. end
  795. if amcm_integer?(@x)
  796. if amcm_integer?(@y)
  797. if passable?(@x-1,@y) and passable?(@x-1,@y+1) and passable?(@x,@y+1)
  798. @x -= 0.5
  799. @y += 0.5
  800. increase_steps
  801. @move_failed = false
  802. else
  803. @move_failed = true
  804. end
  805. else
  806. if passable?(@x-1,@y.to_i+1)
  807. @x -= 0.5
  808. @y += 0.5
  809. increase_steps
  810. @move_failed = false
  811. else
  812. @move_failed = true
  813. end
  814. end
  815. elsif amcm_integer?(@y)
  816. if passable?(@x.to_i,@y+1)
  817. @x -= 0.5
  818. @y += 0.5
  819. increase_steps
  820. @move_failed = false
  821. else
  822. @move_failed = true
  823. end
  824. else
  825. @x -= 0.5
  826. @y += 0.5
  827. increase_steps
  828. @move_failed = false
  829. end
  830. end
  831. def move_lower_right
  832. unless @direction_fix
  833. @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  834. end
  835. if amcm_integer?(@x)
  836. if amcm_integer?(@y)
  837. if passable?(@x+1,@y) and passable?(@x+1,@y+1) and passable?(@x,@y+1)
  838. @x += 0.5
  839. @y += 0.5
  840. increase_steps
  841. @move_failed = false
  842. else
  843. @move_failed = true
  844. end
  845. else
  846. if passable?(@x+1,@y.to_i+1)
  847. @x += 0.5
  848. @y += 0.5
  849. increase_steps
  850. @move_failed = false
  851. else
  852. @move_failed = true
  853. end
  854. end
  855. elsif amcm_integer?(@y)
  856. if passable?(@x.to_i+1,@y+1)
  857. @x += 0.5
  858. @y += 0.5
  859. increase_steps
  860. @move_failed = false
  861. else
  862. @move_failed = true
  863. end
  864. else
  865. @x += 0.5
  866. @y += 0.5
  867. increase_steps
  868. @move_failed = false
  869. end
  870. end
  871. def move_upper_left
  872. unless @direction_fix
  873. @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  874. end
  875. if amcm_integer?(@x)
  876. if amcm_integer?(@y)
  877. if passable?(@x-1,@y) and passable?(@x-1,@y-1) and passable?(@x,@y-1)
  878. @x -= 0.5
  879. @y -= 0.5
  880. increase_steps
  881. @move_failed = false
  882. else
  883. @move_failed = true
  884. end
  885. else
  886. if passable?(@x-1,@y.to_i)
  887. @x -= 0.5
  888. @y -= 0.5
  889. increase_steps
  890. @move_failed = false
  891. else
  892. @move_failed = true
  893. end
  894. end
  895. elsif amcm_integer?(@y)
  896. if passable?(@x.to_i,@y-1)
  897. @x -= 0.5
  898. @y -= 0.5
  899. increase_steps
  900. @move_failed = false
  901. else
  902. @move_failed = true
  903. end
  904. else
  905. @x -= 0.5
  906. @y -= 0.5
  907. increase_steps
  908. @move_failed = false
  909. end
  910. end
  911. def move_upper_right
  912. unless @direction_fix
  913. @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  914. end
  915. if amcm_integer?(@x)
  916. if amcm_integer?(@y)
  917. if passable?(@x+1,@y) and passable?(@x+1,@y-1) and passable?(@x,@y-1)
  918. @x += 0.5
  919. @y -= 0.5
  920. increase_steps
  921. @move_failed = false
  922. else
  923. @move_failed = true
  924. end
  925. else
  926. if passable?(@x+1,@y.to_i)
  927. @x += 0.5
  928. @y -= 0.5
  929. increase_steps
  930. @move_failed = false
  931. else
  932. @move_failed = true
  933. end
  934. end
  935. elsif amcm_integer?(@y)
  936. if passable?(@x.to_i+1,@y-1)
  937. @x += 0.5
  938. @y -= 0.5
  939. increase_steps
  940. @move_failed = false
  941. else
  942. @move_failed = true
  943. end
  944. else
  945. @x += 0.5
  946. @y -= 0.5
  947. increase_steps
  948. @move_failed = false
  949. end
  950. end
  951. end
  952. end
复制代码

作者: 梦回碧落    时间: 2011-11-20 19:18
不兼容人物跟随……废了
作者: 皮卡星    时间: 2011-11-20 19:36
麻烦发到地球村
谢谢
作者: 各种压力的猫君    时间: 2011-11-20 23:02
2)本版所有发表的作品默认为发帖者在该作品内具体实质性的原创成分,转载、汉化请到地球村;
纯引版规




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1