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

Project1

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

[已经解决] VX如何可以进行“斜走”(双键同时按下)

[复制链接]

Lv2.观梦者 (版主)

HATSUNE★MIKU
KAGAMINE★LEN
KAGAMINE★RIN
MEGURINE★LUKA

梦石
0
星屑
849
在线时间
1172 小时
注册时间
2012-4-2
帖子
5035

开拓者

跳转到指定楼层
1
发表于 2012-11-6 20:59:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 tjjlb 于 2012-11-6 21:18 编辑

VX如何可以进行“斜走”?(双键同时按下)

例如 ↑ 和 →  一起按下,就可以像右上方行走


@protosssonny P叔这次可以么?



感谢P叔!!!

点评

八方向行走脚本  发表于 2012-11-6 21:00

Lv3.寻梦者 (版主)

八宝粥的基叔

梦石
0
星屑
4644
在线时间
5238 小时
注册时间
2009-4-29
帖子
14318

贵宾

2
发表于 2012-11-6 21:17:57 | 只看该作者
简单的饭菜应该留给大家。
但是你又是指定P叔回答,浪费饭菜了。
还有就是@失效了。
按照《6道》作者的方法吧,《八方向行走脚本》是可行的。
八方向行走脚本:

  1. #==============================================================================
  2. # ■ Game_Character
  3. #==============================================================================

  4. class Game_Character
  5.   #--------------------------------------------------------------------------
  6.   # ● 八方向
  7.   #--------------------------------------------------------------------------
  8.   def direction_8dir
  9.     return @direction
  10.   end
  11.   #--------------------------------------------------------------------------
  12.   # ● 变成指定方向
  13.   #     direction : 方向
  14.   #--------------------------------------------------------------------------
  15.   alias set_direction_8fangxiang set_direction
  16.   def set_direction(direction)
  17.     last_dir = @direction
  18.     set_direction_8fangxiang(direction)
  19.     if !@direction_fix && direction != 0
  20.       @direction_8dir = direction
  21.     end
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 向左下移动
  25.   #--------------------------------------------------------------------------
  26.   alias move_lower_left_8fangxiang move_lower_left
  27.   def move_lower_left
  28.     move_lower_left_8fangxiang
  29.     @direction_8dir = 1 unless @direction_fix
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 向右下移动
  33.   #--------------------------------------------------------------------------
  34.   alias move_lower_right_8fangxiang move_lower_right
  35.   def move_lower_right
  36.     move_lower_right_8fangxiang
  37.     @direction_8dir = 3 unless @direction_fix
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 向左上移动
  41.   #--------------------------------------------------------------------------
  42.   alias move_upper_left_8fangxiang move_upper_left
  43.   def move_upper_left
  44.     move_upper_left_8fangxiang
  45.     @direction_8dir = 7 unless @direction_fix
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 向右上移动
  49.   #--------------------------------------------------------------------------
  50.   alias move_upper_right_8fangxiang move_upper_right
  51.   def move_upper_right
  52.     move_upper_right_8fangxiang
  53.     @direction_8dir = 9 unless @direction_fix
  54.   end
  55. end
  56. #==============================================================================
  57. # ■ Game_Party
  58. #==============================================================================

  59. class Game_Party < Game_Unit
  60.   def decrease_steps
  61.     @steps -= 1
  62.   end
  63. end

  64. #==============================================================================
  65. # ■ Game_Player
  66. #==============================================================================

  67. class Game_Player < Game_Character

  68.   #--------------------------------------------------------------------------
  69.   # ●八方向
  70.   #--------------------------------------------------------------------------
  71.   def direction_8dir
  72.     @direction_8dir = @direction if @direction_8dir == nil
  73.     return @direction_8dir
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 八方向按键
  77.   #--------------------------------------------------------------------------
  78.   def move_by_input
  79.     return unless movable?
  80.     return if $game_map.interpreter.running?
  81.     last_steps = $game_party.steps
  82.     case Input.dir8
  83.     when 1;  move_down; move_left; @direction = 2
  84.     when 2;  move_down
  85.     when 3;  move_down; move_right; @direction = 6
  86.     when 4;  move_left
  87.     when 6;  move_right
  88.     when 7;  move_up; move_left; @direction = 4
  89.     when 8;  move_up
  90.     when 9;  move_up; move_right; @direction = 8
  91.     else;    return
  92.     end
  93.     @direction_8dir = Input.dir8
  94.     # 斜方向移动正确步数计算
  95.     if $game_party.steps - last_steps == 2
  96.       $game_party.decrease_steps
  97.     end
  98.   end
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # ● 移动更新
  102.   #--------------------------------------------------------------------------
  103.   def update_move
  104.     distance = 2 ** @move_speed   
  105.     if dash?                     
  106.       distance *= 2
  107.     end
  108.     distance = Integer(distance)
  109.     @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
  110.     @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
  111.     @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
  112.     @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
  113.     update_bush_depth unless moving?
  114.     if @walk_anime
  115.       @anime_count += 1.5
  116.     elsif @step_anime
  117.       @anime_count += 1
  118.     end
  119.   end
  120. end
  121. #==============================================================================
  122. # ■ Sprite_Character
  123. #==============================================================================
  124. class Sprite_Character < Sprite_Base
  125.   
  126.   ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
  127.   #--------------------------------------------------------------------------
  128.   # ● 更新位图
  129.   #--------------------------------------------------------------------------
  130.   alias update_bitmap_8fangxiang update_bitmap
  131.   def update_bitmap
  132.     name_changed = (@character_name != @character.character_name)
  133.     update_bitmap_8fangxiang
  134.     if @tile_id > 0            
  135.       @enable_slant = false
  136.       return
  137.     end
  138.     return unless name_changed  
  139.     @enable_slant = true
  140.     begin
  141.       @character_name_slant = @character_name + "#"
  142.       Cache.character(@character_name_slant)
  143.     rescue
  144.       @enable_slant = false
  145.     end
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 更新传送矩形
  149.   #--------------------------------------------------------------------------
  150.   alias update_src_rect_8fangxiang update_src_rect
  151.   def update_src_rect
  152.     return if @tile_id > 0  
  153.     if @enable_slant
  154.       update_src_rect_for_slant
  155.     else
  156.       update_src_rect_8fangxiang
  157.     end
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 更新斜方向传送矩形
  161.   #--------------------------------------------------------------------------
  162.   def update_src_rect_for_slant
  163.     index = @character.character_index
  164.     pattern = @character.pattern < 3 ? @character.pattern : 1
  165.     sx = (index % 4 * 3 + pattern) * @cw
  166.     dir = @character.direction_8dir
  167.     case dir % 2
  168.     when 0  # 上下左右
  169.       if @last_slant
  170.         self.bitmap = Cache.character(@character_name)
  171.         @last_slant = false
  172.       end
  173.     else   
  174.       unless @last_slant
  175.         self.bitmap = Cache.character(@character_name_slant)
  176.         @last_slant = true
  177.       end
  178.       dir = ANIME_TABLE[dir]
  179.     end
  180.     sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
  181.     self.src_rect.set(sx, sy, @cw, @ch)
  182.   end
  183. end

复制代码

评分

参与人数 2星屑 +200 收起 理由
八宝粥先生 + 60 扼...我记得有现成脚本的......P叔万岁!.
咕噜 + 140 精品文章

查看全部评分

《逝去的回忆3:四叶草之梦》真情发布,欢迎点击图片下载试玩喵。

《逝去的回忆3》的讨论群:
一群:192885514
二群:200460747
回复 支持 反对

使用道具 举报

Lv2.观梦者 (版主)

HATSUNE★MIKU
KAGAMINE★LEN
KAGAMINE★RIN
MEGURINE★LUKA

梦石
0
星屑
849
在线时间
1172 小时
注册时间
2012-4-2
帖子
5035

开拓者

3
 楼主| 发表于 2012-11-6 21:18:14 | 只看该作者
protosssonny 发表于 2012-11-6 21:17
简单的饭菜应该留给大家。
但是你又是指定P叔回答,浪费饭菜了。
还有就是@失效了。{:4_ ...

感谢!!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
18 小时
注册时间
2012-10-22
帖子
60
受到警告 4
发表于 2012-11-11 10:37:47 | 只看该作者
刚好我也在找

评分

参与人数 1星屑 -10 收起 理由
咕噜 -10 无意义纯水

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 02:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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