前段时间做rpg发现,召唤火球存在两个量,而且都是控制方向的,那么这有什么意义呢
1:首先是最初的命令——————————————
- summon FireBall ~ ~2 ~ {ExplosionPower:1,direction:[0.0d,0.0d,0.0d],power:[0.0d,0.0d,0.0d]}
复制代码
这是在上方召唤一个火球
但是火球却停在了那,不会动,除非你左键打一下才会给予一个方向的力量
2:这就需要给予一个方向了——————————
- /summon FireBall ~ ~3 ~ {ExplosionPower:1,direction:[3.0d,0.0d,0.0d],power:[0.0d,0.0d,0.0d]}
复制代码
这下火球确实朝着方向飞起来了,但是仔细观察,火球在远处缓慢的停了下来,甚至撞在了一起
这就到了第三节
3:数据标签分析————————
在命令中:summon FireBall ~ ~2 ~ {ExplosionPower:1,direction:[0.0d,0.0d,0.0d],power:[0.0d,0.0d,0.0d]}
在这里,红色的的direction代表初始速度,会衰减
蓝色的power是匀速的,不会衰减
当初速度大于匀速的,会以初速度方向飞行,否则向匀速度方向飞行
至此,可以使用
- /summon FireBall ~ ~3 ~ {ExplosionPower:1,direction:[3.0d,0.0d,0.0d],power:[0.0d,0.0d,0.5d]}
复制代码
实现拐弯的火球
或者
- /summon FireBall ~ ~3 ~ {ExplosionPower:1,direction:[3.0d,0.0d,0.0d],power:[-0.3d,0.1d,0.0d]}
复制代码
至此关于火球发射向量研究完毕
4:其他
①使用计分板穷举,自由发射火球吧
- #scoreboard objectives add dir dummy 方向判断
- scoreboard players set @a[rym=-22,ry=22] dir 0
- scoreboard players set @a[rym=22,ry=67] dir 1
- scoreboard players set @a[rym=67,ry=112] dir 2
- scoreboard players set @a[rym=112,ry=157] dir 3
- scoreboard players set @a[rym=157,ry=-157] dir 4
- scoreboard players set @a[rym=-157,ry=-112] dir 5
- scoreboard players set @a[rym=-112,ry=-67] dir 6
- scoreboard players set @a[rym=-67,ry=-22] dir 7
复制代码
②一个指令,模拟旋转木马(猪)
- /summon FireBall ~ ~3 ~ {ExplosionPower:1,direction:[3.0d,0.0d,0.0d],power:[0.0d,0.0d,0.5d]}
复制代码