Skip to content

Commit

Permalink
移動アニメーション実装
Browse files Browse the repository at this point in the history
  • Loading branch information
EllaCoat committed Aug 9, 2024
1 parent 7b4b46e commit 6b45016
Show file tree
Hide file tree
Showing 22 changed files with 366 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# @within function asset:mob/0391.axia_first/**
# マーカー関連
#declare tag AV.Marker.SummonPoint
#declare tag AV.Marker.Movement
# AnimatedJavaモデル関連
#declare tag AV.ModelRoot
# Mob制御関連
Expand All @@ -13,8 +14,6 @@
#declare tag AV.Temp.This
#declare tag AV.Temp.Target
#declare tag AV.Landing
#declare storage AV.Temp
#declare storage AV.ID
# Projectile
#declare tag AV.SlashEffect
#declare tag AV.SlashEffectMini
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@

# なぎなぎ教授
execute if score @s AV.AnimationNum matches 40 run function asset:mob/0391.axia_first/ai/animation/4_0_naginagi/

# 通常移動
execute if score @s AV.AnimationNum matches 60 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/

# 通常移動(特定地点まで)
execute if score @s AV.AnimationNum matches 61 run function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

# 居合い切り移動
execute if score @s AV.AnimationNum matches 62 run function asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#
# 斬撃エフェクト召喚3
#
# @within function asset:mob/0391.axia_first/ai/animation/3_0_triple_slash/
# @within function
# asset:mob/0391.axia_first/ai/animation/3_0_triple_slash/
# asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/

# Tempタグ付与
tag @s add AV.Temp.This
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/
#
# 移動アニメーション
#
# @within function asset:mob/0391.axia_first/ai/animation/

# 対象プレイヤー保存
execute if score @s AV.AnimationTick matches 1 run scoreboard players operation @s AV.UUID = @r[tag=!PlayerShouldInvulnerable,distance=..100] UserID

# プレイヤーの方を向く
# 移動中は対象プレイヤーの方を向く
tag @s add AV.Temp.This
scoreboard players operation $AV.Temp AV.UUID = @s AV.UUID
execute if score @s AV.AnimationTick matches 1..30 as @a if score @s UserID = $AV.Temp AV.UUID run function asset:mob/0391.axia_first/ai/general/2.rotate
execute if score @s AV.AnimationTick matches 31..36 as @p[tag=!PlayerShouldInvulnerable,distance=..100] run function asset:mob/0391.axia_first/ai/general/2.rotate
scoreboard players reset $AV.Temp AV.UUID

# 移動
# TP
execute if score @s AV.AnimationTick matches 6..26 at @s positioned ^ ^ ^0.6 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 27 at @s positioned ^ ^ ^0.5 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 28 at @s positioned ^ ^ ^0.4 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 29 at @s positioned ^ ^ ^0.2 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 30 at @s positioned ^ ^ ^0.1 run function asset:mob/0391.axia_first/ai/general/1.teleport

# アニメーション再生

Check failure on line 26 in Asset/data/asset/functions/mob/0391.axia_first/ai/animation/6_0_moving_forward/.mcfunction

View workflow job for this annotation

GitHub Actions / lint

Failed to resolve namespaced ID “animated_java:axia/animations/6_0_moving_forward/play” in cache category “function” (rule: “strictFunctionCheck”)
execute if score @s AV.AnimationTick matches 1 as @e[type=item_display,tag=AV.Root.This,distance=..100] run function animated_java:axia/animations/6_0_moving_forward/play

# アニメーション終了処理
execute if score @s AV.AnimationTick matches 36 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/end

# サウンド・VFX
execute if score @s AV.AnimationTick matches 6 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/sound
execute if score @s AV.AnimationTick matches 6 positioned ^ ^0.5 ^-0.5 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/vfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/end
#
# 終了処理
#
# @within function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/

# デバッグ用 アニメーションループ
scoreboard players set @s AV.AnimationNum 60
scoreboard players set @s AV.AnimationTick 0

# デバッグ用
scoreboard players reset @s AV.UUID
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/move.m
#
# 指定位置にTPする
#
# @input args
# X : Double
# Z : Double
# @within function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/

# TPする
$tp @s ~$(X) ~ ~$(Z) ~ ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/add_point
#
# 移動地点設定
#
# @within function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/

# 移動地点指定
# セッション開ける
function lib:array/session/open

# 自身のPosを取得
function api:data_get/pos
data modify storage lib: ArrayB set from storage api: Pos
summon marker ~ ~ ~ {Tags:["AV.Marker.Movement"]}

# プレイヤーの位置からPosを取得
# 今後AI次第では調整する予定
execute as @r[tag=!PlayerShouldInvulnerable,distance=..100] at @s run tp @e[type=marker,tag=AV.Marker.Movement,distance=..100] ^ ^ ^ ~ ~
execute as @e[type=marker,tag=AV.Marker.Movement,distance=..100] at @s run function api:data_get/pos
data modify storage lib: ArrayA set from storage api: Pos

# Pos差分を計算してその結果を一時保存
function lib:array/math/sub
data modify storage asset:temp AV.Temp set from storage lib: SubResult

# セッション閉じる
function lib:array/session/close

# セッション開ける
function lib:array/session/open

# Pos差分を1/25倍する
data modify storage lib: Array set from storage asset:temp AV.Temp
data modify storage lib: Mul set value 0.04
function lib:array/math/scalar_multiply

# 1tickの移動距離を保存
data modify storage asset:context this.MoveDistance set from storage lib: MulResult

# セッション閉じる
function lib:array/session/close

# リセット
data remove storage asset:temp AV.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/predict.m
#
# 偏差実行
#
# @input args
# X : Double
# Z : Double
# @within function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/predict

# マーカーをTP
$execute positioned ~$(X) ~ ~$(Z) if entity @s[distance=..30] run tp @e[type=marker,tag=AV.Marker.Movement,distance=..100] ^ ^ ^ ~ ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/predict
#
# 偏差移動
#
# @within function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/add_point

# 攻撃対象にTagを付与
tag @r[tag=!PlayerShouldInvulnerable,distance=..100] add AV.Temp.Target

# 攻撃対象のベクトルを取得
execute as @p[tag=AV.Temp.Target,distance=..100] run function api:player_vector/get

# セッション開ける
function lib:array/session/open

# ベクトルを10倍する
data modify storage lib: Array set from storage api: Return.Vector
data modify storage lib: Mul set value 20
function lib:array/math/scalar_multiply

# 別のstorageに移す
data modify storage asset:temp Predict.X set from storage lib: MulResult[0]
data modify storage asset:temp Predict.Z set from storage lib: MulResult[2]

# セッション閉じる
function lib:array/session/close

# マクロで偏差撃ちする
execute as @p[tag=AV.Temp.Target,distance=..100] at @s run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/movement_point/predict.m with storage asset:temp Predict

# リセット
tag @p[tag=AV.Temp.Target,distance=..100] remove AV.Temp.Target
data remove storage asset:temp Predict
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/sound
#
# 移動時のサウンド
#
# @within function
# asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/
# asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

playsound entity.breeze.hurt hostile @a[distance=..16] ~ ~ ~ 1.0 0.75 0.0
playsound entity.breeze.hurt hostile @a[distance=..16] ~ ~ ~ 1.0 0.76 0.0
playsound entity.breeze.idle_air hostile @a[distance=..16] ~ ~ ~ 1.0 0.8 0.0
playsound entity.blaze.shoot hostile @a[distance=..16] ~ ~ ~ 1.0 0.8 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#> asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/vfx
#
# VFX
#
# @within function
# asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/
# asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

# 円
particle flame ^-0.0 ^0.5 ^-0.0 ^14.901 ^1000000000.0 ^-43.711 0.00000000010 0 force @a[distance=..32]
particle flame ^0.191 ^0.462 ^-0.0 ^382683456.0 ^923879488.0 ^-40.384 0.00000000010 0 force @a[distance=..32]
particle flame ^0.354 ^0.354 ^-0.0 ^707106752.0 ^707106752.0 ^-30.909 0.00000000010 0 force @a[distance=..32]
particle flame ^0.462 ^0.191 ^-0.0 ^923879488.0 ^382683456.0 ^-16.728 0.00000000010 0 force @a[distance=..32]
particle flame ^0.5 ^0.0 ^0.0 ^1000000000.0 ^11.176 ^0.0 0.00000000010 0 force @a[distance=..32]
particle flame ^0.462 ^-0.191 ^0.0 ^923879488.0 ^-382683456.0 ^16.728 0.00000000010 0 force @a[distance=..32]
particle flame ^0.354 ^-0.354 ^0.0 ^707106752.0 ^-707106752.0 ^30.909 0.00000000010 0 force @a[distance=..32]
particle flame ^0.191 ^-0.462 ^0.0 ^382683456.0 ^-923879488.0 ^40.384 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.0 ^-0.5 ^0.0 ^14.901 ^-1000000000.0 ^43.711 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.191 ^-0.462 ^0.0 ^-382683456.0 ^-923879488.0 ^40.384 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.354 ^-0.354 ^0.0 ^-707106752.0 ^-707106752.0 ^30.909 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.462 ^-0.191 ^0.0 ^-923879488.0 ^-382683456.0 ^16.728 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.5 ^0.0 ^0.0 ^-1000000000.0 ^11.176 ^0.0 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.462 ^0.191 ^-0.0 ^-923879488.0 ^382683456.0 ^-16.728 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.354 ^0.354 ^-0.0 ^-707106752.0 ^707106752.0 ^-30.909 0.00000000010 0 force @a[distance=..32]
particle flame ^-0.191 ^0.462 ^-0.0 ^-382683456.0 ^923879488.0 ^-40.384 0.00000000010 0 force @a[distance=..32]

# ガスト
particle gust ^ ^ ^ 0 0 0 0 1 force @a[distance=..32]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#> asset:mob/0391.axia_first/ai/animation/6_1_moving_point/
#
# 移動アニメーション(特定地点まで)
#
# @within function asset:mob/0391.axia_first/ai/animation/

# 移動地点指定
execute if score @s AV.AnimationTick matches 1 run function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/movement_point/add_point

# 目標地点の方を向く
# 最後はプレイヤーの方を向く
tag @s add AV.Temp.This
execute if score @s AV.AnimationTick matches 1..30 as @e[type=marker,tag=AV.Marker.Movement,distance=..100] run function asset:mob/0391.axia_first/ai/general/2.rotate
execute if score @s AV.AnimationTick matches 31..36 as @p[tag=!PlayerShouldInvulnerable,distance=..100] run function asset:mob/0391.axia_first/ai/general/2.rotate

# 移動
# 別のstorageに移す
data modify storage asset:temp AV.Temp.X set from storage asset:context this.MoveDistance[0]
data modify storage asset:temp AV.Temp.Z set from storage asset:context this.MoveDistance[2]

# マクロでTP
execute if score @s AV.AnimationTick matches 6..30 run function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/move.m with storage asset:temp AV.Temp

# リセット
data remove storage asset:temp AV.Temp

# アニメーション再生
execute if score @s AV.AnimationTick matches 1 as @e[type=item_display,tag=AV.Root.This,distance=..100] run function animated_java:axia/animations/6_0_moving_forward/play

# アニメーション終了処理
execute if score @s AV.AnimationTick matches 36 run function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/end

# サウンド・VFX
execute if score @s AV.AnimationTick matches 6 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/sound
execute if score @s AV.AnimationTick matches 6 positioned ^ ^0.5 ^-0.5 run function asset:mob/0391.axia_first/ai/animation/6_0_moving_forward/vfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset:mob/0391.axia_first/ai/animation/6_1_moving_point/end
#
# 終了処理
#
# @within function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

# デバッグ用 アニメーションループ
scoreboard players set @s AV.AnimationNum 61
scoreboard players set @s AV.AnimationTick 0

# デバッグ用
kill @e[tag=AV.Marker.Movement]
data remove storage asset:context this.MoveDistance
scoreboard players reset @s AV.UUID
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/0391.axia_first/ai/animation/6_1_moving_point/move.m
#
#
#
# @within function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

# TPする
$tp @s ~$(X) ~ ~$(Z) ~ ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#> asset:mob/0391.axia_first/ai/animation/6_1_moving_point/movement_point/add_point
#
# 移動地点指定
#
# @within function asset:mob/0391.axia_first/ai/animation/6_1_moving_point/

# 移動地点指定
# セッション開ける
function lib:array/session/open

# 自身のPosを取得
function api:data_get/pos
data modify storage lib: ArrayB set from storage api: Pos
summon marker ~ ~ ~ {Tags:["AV.Marker.Movement"]}

# プレイヤーの位置からPosを取得
# 今後AI次第では調整する予定
# data modify entity @e[type=marker,tag=AV.Marker.Movement,distance=..100,limit=1] Pos set from storage asset:context this.MovementPoint
execute as @r[tag=!PlayerShouldInvulnerable,distance=..100] at @s run tp @e[type=marker,tag=AV.Marker.Movement,distance=..100] ^ ^ ^ ~ ~
execute as @e[type=marker,tag=AV.Marker.Movement,distance=..100] at @s run function api:data_get/pos
data modify storage lib: ArrayA set from storage api: Pos

# Pos差分を計算してその結果を一時保存
function lib:array/math/sub
data modify storage asset:temp AV.Temp set from storage lib: SubResult

# セッション閉じる
function lib:array/session/close

# セッション開ける
function lib:array/session/open

# Pos差分を1/25倍する
data modify storage lib: Array set from storage asset:temp AV.Temp
data modify storage lib: Mul set value 0.04
function lib:array/math/scalar_multiply

# 1tickの移動距離を保存
data modify storage asset:context this.MoveDistance set from storage lib: MulResult

# セッション閉じる
function lib:array/session/close

# リセット
data remove storage asset:temp AV.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#> asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/
#
# 居合い切り移動 アニメーション
#
# @within function asset:mob/0391.axia_first/ai/animation/

# 対象プレイヤー保存
execute if score @s AV.AnimationTick matches 1 run scoreboard players operation @s AV.UUID = @r[tag=!PlayerShouldInvulnerable,distance=..100] UserID

# 近くのプレイヤーの方を向く
tag @s add AV.Temp.This
scoreboard players operation $AV.Temp AV.UUID = @s AV.UUID
execute if score @s AV.AnimationTick matches 1..45 as @a if score @s UserID = $AV.Temp AV.UUID run function asset:mob/0391.axia_first/ai/general/2.rotate
execute if score @s AV.AnimationTick matches 57..66 as @p[tag=!PlayerShouldInvulnerable,distance=..100] run function asset:mob/0391.axia_first/ai/general/2.rotate
tag @s remove AV.Temp.This

# アニメーション再生
execute if score @s AV.AnimationTick matches 1 as @e[type=item_display,tag=AV.Root.This,distance=..100] run function animated_java:axia/animations/7_0_moving_iai/play

# アニメーション終了処理
execute if score @s AV.AnimationTick matches 66 run function asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/end

# 斬撃エフェクト
execute if score @s AV.AnimationTick matches 47 positioned ^ ^0.5 ^ run function asset:mob/0391.axia_first/ai/animation/3_0_triple_slash/slash_summon/3

# 斬撃サウンド
execute if score @s AV.AnimationTick matches 47 run function asset:mob/0391.axia_first/ai/general/5.slash_sound

# 移動
# TP
execute if score @s AV.AnimationTick matches 31..41 at @s positioned ^ ^ ^1 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 42 at @s positioned ^ ^ ^0.75 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 43 at @s positioned ^ ^ ^0.5 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 44 at @s positioned ^ ^ ^0.25 run function asset:mob/0391.axia_first/ai/general/1.teleport
execute if score @s AV.AnimationTick matches 45 at @s positioned ^ ^ ^0.1 run function asset:mob/0391.axia_first/ai/general/1.teleport
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/end
#
# 終了処理
#
# @within function asset:mob/0391.axia_first/ai/animation/6_2_moving_iai/

# デバッグ用 アニメーションループ
scoreboard players set @s AV.AnimationNum 62
scoreboard players set @s AV.AnimationTick 0

# デバッグ用
kill @e[tag=AV.Marker.Movement]
Loading

0 comments on commit 6b45016

Please sign in to comment.