幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2422|回复: 7

[转帖]来,发一个比较有用的45度动画战斗

[复制链接]

15

主题

60

帖子

662

积分

⑤进阶

积分
662
发表于 2007-2-21 15:10:20 | 显示全部楼层 |阅读模式
这个比超级横版脚本好多了,超级横版脚本规定所有的图帧数都要一样,这个不用,比较好


用了这个脚本后,首先要把所有待机,防御,挨打,死亡动态,死亡静态,胜利动态,胜利静态的的画面在动画里面做成动画,动画名称与帧数可以任定

然后战斗图做成透明图。大少要跟待机画面的大少差不多。大一点都可以
注意改战斗图的名字。要改成这样的格式

战斗角色名字★待机ID★防御ID★挨打ID★死亡动态ID★死亡静态ID★胜利动态ID★胜利静态ID
如果是设置敌人的话,那么就变成
名字★待机ID★防御ID★挨打ID★死亡动态ID★死亡静态ID★★

所谓死亡动态就是人物死亡的整个过程,静态就是死亡动态的最后一个画面(通常是已经倒地的画面)死亡静态只需要一帧,坐标跟动态坐标一样。
胜利静态与死亡静态原理一样。


#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
#  战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视。
#==============================================================================

class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● 处理角色动作
  #--------------------------------------------------------------------------
  def update_actor_animation
    if @battler.is_a?(Game_Actor)
      if @battler.show_damage_value != nil
        self.damage(@battler.show_damage_value, false)
        @battler.show_damage(nil)
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
        @battler.setup_battler_hurt_ani(1)
      end
      if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
      else
        if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
        elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
          for actor in $game_party.actors
            if @battler != actor
              actor.add_state(6)
            end
          end
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 处理敌人动作
  #--------------------------------------------------------------------------
  def update_enemy_animation
    if @battler.is_a?(Game_Enemy)
      if @battler.show_damage_value != nil
        self.damage(@battler.show_damage_value, false)
        @battler.show_damage(nil)
        @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
        @battler.setup_battler_hurt_ani(1)
      end
      if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
      else
        if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
          @battler.setup_battler_hurt_ani(1)
        elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
          @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
          @battler.setup_battler_dead_ani(1)
          collapse
        end
      end
    end
  end
end



然后到这里好需要一个设置战斗坐标的脚本(好像不是战斗的动画都可以在这里设置),具体看脚本蓝色字眼。根据那里设置就好了。主要是设置敌人的普通攻击,挨打,待机,死亡,招式,和自己主角的招式,这个脚本要插在Interpreter 7下面,改名可以是Interpreter 8

#==============================================================================
# ■ Interpreter (分割定义 8)
#------------------------------------------------------------------------------
#  执行事件命令的解释器。本类在 Game_System 类
# 和 Game_Event 类的内部使用。
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # ● 动画突破_A
  #--------------------------------------------------------------------------
def ani_set_a
    id = 166
    a = 2
    b = 16
    first_x = 540
    first_y = 347
    frame_x = [523,525,524,528,545,567,591,255,188,171,171,71,175,285,300]
    frame_y = [331,327,327,329,330,357,358,186,182,158,141,76,143,173,268]
    ani_set(id,a,b,first_x,first_y,frame_x,frame_y,150,150)
  end
  
#先举个例子
#魔王_挨打(敌人来的)
  def ani_set_186
    id = 186
    a = 2
   b = 5
   first_x = 379
    first_y = 257
    frame_x = [370,338,346,368]
    frame_y = [235,225,229,235]
    ani_set(id,a,b,first_x,first_y,frame_x,frame_y)
  #--------------------------------------------------------------------------
  # ● 动画突破
  #--------------------------------------------------------------------------
  def ani_set(id, a, b, first_x, first_y, frame_x, frame_y, frame_x_w = 0, frame_y_w = 0)
    h = 0
    # 循环指定id号动画的帧
    for @frame in $data_animations[id].frames
      if h == a - 2
        for i in 0...$data_animations[id].frames[h].cell_data.xsize
          $data_animations[id].frames[h].cell_data[i, 1] += frame_x_w
          $data_animations[id].frames[h].cell_data[i, 2] += frame_y_w
        end
      end
      if h >= a - 1 and h <= b - 1
        d_x = frame_x[h - a + 1] - first_x + frame_x_w
        d_y = frame_y[h - a + 1] - first_y + frame_y_w
        # 循环帧的单元
        for i in 0...$data_animations[id].frames[h].cell_data.xsize
          # 0:式样、1:X 座标,2:Y 座标,3:放大率,4:旋转角度
          # 5:左右反转,6:不透明度,7:合成方式
          m = $data_animations[id].frames[h].cell_data[i, 1]
          n = $data_animations[id].frames[h].cell_data[i, 2]
          $data_animations[id].frames[h].cell_data[i, 1] += d_x
          $data_animations[id].frames[h].cell_data[i, 2] += d_y
          #if m != $data_animations[id].frames[h].cell_data[i, 1] or n != $data_animations[id].frames[h].cell_data[i, 2]
          #  p h,m,n,$data_animations[id].frames[h].cell_data[i, 1],$data_animations[id].frames[h].cell_data[i, 2]
          #end
        end
      end
      h += 1
    end
    # 储存数据
    save_data($data_animations,"Data/Animations.rxdata")
    p "Over"
  end
end






总体看起来像很麻烦的,但不是很难的,细心地看一看的话,会明白,如果知道脚本说什么的人,请发帖吧,这样其他人就可以知道了,我也不是很明白脚本的具体内容。(脚本转自石焚刃暖游戏)
回复

使用道具 举报

89

主题

2333

帖子

3273万

积分

⑧专业

Xavier on Rails

积分
32739794
QQ
发表于 2007-2-21 15:35:30 | 显示全部楼层
转的还[原创] [s:3]
回复 支持 反对

使用道具 举报

好人卡的 该用户已被删除
发表于 2007-2-21 18:49:20 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

15

主题

60

帖子

662

积分

⑤进阶

积分
662
 楼主| 发表于 2007-2-22 11:23:42 | 显示全部楼层
有的,我帮他发扬光大
回复 支持 反对

使用道具 举报

74

主题

514

帖子

4593

积分

⑥精研

支持成品,demo去死

积分
4593
QQ
发表于 2007-2-22 11:58:32 | 显示全部楼层
这个……好像不错
回复 支持 反对

使用道具 举报

3

主题

14

帖子

161

积分

③业余

积分
161
QQ
发表于 2007-3-1 17:23:53 | 显示全部楼层
先顶的说` [s:1]
落花有义流水无情,问世间情为何物?孔子曰:废物!
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
发表于 2007-3-1 18:13:08 | 显示全部楼层
  1. 请加上CODE
复制代码
否则可能被屏蔽
谢谢合作
回复 支持 反对

使用道具 举报

0

主题

2

帖子

1234

积分

⑥精研

积分
1234
发表于 2007-3-9 23:53:46 | 显示全部楼层
这个是。。全动画战斗系统。。已经发出来了。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-24 16:47 , Processed in 0.013395 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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