动画系统
在铁锈战争中,动画系统用于创建单位的动态效果,增强视觉表现。本章节将详细介绍如何配置单位动画,包括帧动画、腿部动画、炮塔动画等。
动画基本配置
动画系统通过图像属性和专门的动画部分来定义:
图像动画属性
[graphics]
image:units/tank.png
total_frames:4
frame_width:64
frame_height:64
图像动画属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| image | 图像文件 | image:units/tank.png |
| total_frames | 总帧数 | total_frames:4 |
| frame_width | 帧宽度 | frame_width:64 |
| frame_height | 帧高度 | frame_height:64 |
帧动画设置
可以配置单位的帧动画:
帧动画属性
[graphics]
animation_frameOffset:0
animation_frameCount:4
animation_frameRate:0.2
animation_loop:true
帧动画属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| animation_frameOffset | 动画帧偏移 | animation_frameOffset:0 |
| animation_frameCount | 动画帧数 | animation_frameCount:4 |
| animation_frameRate | 动画帧率 | animation_frameRate:0.2 |
| animation_loop | 动画循环 | animation_loop:true |
腿部动画设置
可以配置单位的腿部动画:
[leg_#] 腿部设置
[leg_1]
x:10
y:15
height:2
image:legs/leg.png
attach_x:0
attach_y:0
moveSpeed:1.5
腿部属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| x, y | 腿部位置 | x:10, y:15 |
| height | 腿部高度 | height:2 |
| image | 腿部图像 | image:legs/leg.png |
| attach_x, attach_y | 连接点 | attach_x:0, attach_y:0 |
| moveSpeed | 移动速度 | moveSpeed:1.5 |
腿部动画控制
可以控制腿部的动画行为:
腿部动画属性
[leg_1]
rotateSpeed:2
resetAngle:0
holdDisMin:10
holdDisMax:20
hold_moveOnlyIfFurthest:true
腿部动画属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| rotateSpeed | 旋转速度 | rotateSpeed:2 |
| resetAngle | 重置角度 | resetAngle:0 |
| holdDisMin | 最小保持距离 | holdDisMin:10 |
| holdDisMax | 最大保持距离 | holdDisMax:20 |
| hold_moveOnlyIfFurthest | 只移动最远的腿 | hold_moveOnlyIfFurthest:true |
腿部图像设置
可以设置腿部的图像效果:
腿部图像属性
[leg_1]
image:legs/leg.png
image_end:legs/foot.png
image_applyTeamColors:true
drawUnderAllUnits:true
腿部图像属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| image | 腿部图像 | image:legs/leg.png |
| image_end | 腿部末端图像 | image_end:legs/foot.png |
| image_applyTeamColors | 应用队伍颜色 | image_applyTeamColors:true |
| drawUnderAllUnits | 在所有单位下方绘制 | drawUnderAllUnits:true |
炮塔动画设置
可以配置炮塔的动画效果:
炮塔动画属性
[turret_1]
image:turrets/turret.png
image_applyTeamColors:true
chargeEffectImage:effects/charge.png
炮塔动画属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| image | 炮塔图像 | image:turrets/turret.png |
| image_applyTeamColors | 应用队伍颜色 | image_applyTeamColors:true |
| chargeEffectImage | 充能效果图像 | chargeEffectImage:effects/charge.png |
动画混合设置
可以设置动画的混合效果:
混合属性
[graphics]
animation_blend:true
animation_blendTime:0.3
animation_interpolate:true
混合属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| animation_blend | 动画混合 | animation_blend:true |
| animation_blendTime | 混合时间 | animation_blendTime:0.3 |
| animation_interpolate | 插值动画 | animation_interpolate:true |
动画状态控制
可以控制动画的状态:
状态控制属性
[graphics]
animation_state:move
animation_state_idle:true
animation_state_move:true
animation_state_attack:false
状态控制属性说明
| 属性 | 说明 | 示例 |
|---|---|---|
| animation_state | 动画状态 | animation_state:move |
| animation_state_idle | 空闲状态动画 | animation_state_idle:true |
| animation_state_move | 移动状态动画 | animation_state_move:true |
| animation_state_attack | 攻击状态动画 | animation_state_attack:false |
完整动画示例
基础单位动画
[graphics]
image:units/walker.png
total_frames:8
frame_width:64
frame_height:64
animation_frameOffset:0
animation_frameCount:4
animation_frameRate:0.15
animation_loop:true
animation_blend:true
animation_blendTime:0.2
[leg_1]
x:-15
y:10
height:3
image:legs/walker_leg.png
image_end:legs/walker_foot.png
attach_x:0
attach_y:0
moveSpeed:1.2
rotateSpeed:3
holdDisMin:8
holdDisMax:15
[leg_2]
x:15
y:10
height:3
image:legs/walker_leg.png
image_end:legs/walker_foot.png
attach_x:0
attach_y:0
moveSpeed:1.2
rotateSpeed:3
holdDisMin:8
holdDisMax:15
飞行单位动画
[graphics]
image:units/flyer.png
total_frames:6
frame_width:48
frame_height:48
animation_frameOffset:0
animation_frameCount:6
animation_frameRate:0.1
animation_loop:true
animation_state_move:true
[movement]
targetHeight:40
targetHeightDrift:2
heightChangeRate:4
炮塔动画
[turret_1]
x:0
y:0
projectile:bullet
turnSpeed:2
size:12
barrelX:0
barrelY:15
image:turrets/heavy_turret.png
image_applyTeamColors:true
chargeEffectImage:effects/charge_blue.png
[projectile_1]
directDamage:30
life:40
speed:12
image:projectiles/laser_bullet.png
drawType:1
color:#00FFFF
注意事项
- 合理设置动画帧数和帧率,避免过快或过慢
- 平衡动画效果与游戏性能
- 为不同状态的单位设置适当的动画
- 测试动画在不同情况下的表现
- 考虑动画与单位整体设计的一致性