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

Project1

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

[子弹君] 跳跃

[复制链接]

卑微的梦

梦石
0
星屑
511
在线时间
820 小时
注册时间
2013-2-23
帖子
1185

短篇九勇士组季军

跳转到指定楼层
1
发表于 2014-9-27 10:37:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. #  跳跃  by 子弹君
  3. #==============================================================================
  4. # 说明:
  5. # 让角色自由的跳跃~(死
  6. #==============================================================================
  7. $BombScript ||= {};$BombScript["跳跃"] = "跳跃20140924"
  8. #==============================================================================
  9. #  设定部分
  10. #==============================================================================
  11. module BOMB
  12.   module JUMP
  13.     SWITCH = 1
  14. #   设置一个开关,开关开启则开启跳跃
  15.     SOUND = "Jump1"
  16. #   设置跳跃的音效
  17.     DELAY = 30
  18. #   设置跳跃等待的帧数
  19.     TRIGGER = :X
  20. #   设置跳跃的按键
  21.   end
  22. end
  23. class Game_Player < Game_Character
  24.   #--------------------------------------------------------------------------
  25.   # ● 初始化对象
  26.   #--------------------------------------------------------------------------
  27.   alias bomb20140924_initialize initialize
  28.   def initialize
  29.   bomb20140924_initialize
  30.   @bomb_delay = BOMB::JUMP::DELAY
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 更新对象
  34.   #--------------------------------------------------------------------------
  35.   alias bomb20140924_update update
  36.   def update
  37.     bomb20140924_update
  38.     bomb_priority
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 由方向键移动
  42.   #--------------------------------------------------------------------------
  43.   alias bomb20140924_input move_by_input
  44.   def move_by_input
  45.     bomb20140924_input
  46.     if $game_switches[BOMB::JUMP::SWITCH] == true
  47.     if @bomb_delay == BOMB::JUMP::DELAY
  48.       if Input.trigger?(BOMB::JUMP::TRIGGER)
  49.         bomb_extra if bomb_do
  50.         @bomb_delay = 0
  51.       end
  52.     else
  53.       @bomb_delay += 1
  54.     end
  55.     end
  56.   end
  57.   def bomb20140924_map_jump(bx, by)
  58.     if map_passable?(bx, by, 2) or map_passable?(bx, by, 4) or map_passable?(bx, by, 6) or map_passable?(bx, by, 8)
  59.       return true
  60.     else
  61.       return false
  62.     end
  63.   end
  64.   def bomb_priority
  65.     if jumping?
  66.       @priority_type = 2
  67.     else
  68.       @priority_type = 1
  69.     end
  70.   end
  71.   def check_layered(bo_x, bo_y)
  72.     bomb_tile = "[0, 0, "+$game_map.tile_id(bo_x, bo_y, 0x00).to_s+"]"
  73.     bomb_layered = $game_map.layered_tiles(bo_x, bo_y).to_s
  74.     else if bomb_tile == bomb_layered
  75.       return true
  76.     else
  77.       return false
  78.     end
  79.   end
  80.   def bomb_extra
  81.     @followers.each {|member| member.jump(@x - member.x, @y - member.y)}
  82.     Audio.se_play('Audio/SE/'+BOMB::JUMP::SOUND+'.ogg',50,150)
  83.   end
  84.   def bomb_do
  85.     case @direction
  86.     when 2
  87.       if !collide_with_events?(@x, @y+2) && bomb20140924_map_jump(@x, @y+2)
  88.         if normal_walk? && check_layered(@x, @y)
  89.           jump( 0, 2)
  90.         end
  91.       end
  92.     when 4
  93.       if !collide_with_events?(@x-2, @y) && bomb20140924_map_jump(@x-2, @y)
  94.         if normal_walk? && check_layered(@x-1, @y-1)
  95.           jump(-2, 0)
  96.         end
  97.       end
  98.     when 6
  99.       if !collide_with_events?(@x+2, @y) && bomb20140924_map_jump(@x+2, @y)
  100.         if normal_walk? && check_layered(@x+1, @y-1)
  101.           jump( 2, 0)
  102.         end
  103.       end
  104.     when 8
  105.       if !collide_with_events?(@x, @y-2) && bomb20140924_map_jump(@x, @y-2)
  106.         if normal_walk? && check_layered(@x, @y-2)
  107.           jump( 0,-2)
  108.         end
  109.       end
  110.     end
  111.   end
  112. end
复制代码
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-4-26 13:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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