Code: Select all
do
local listOfAnimations = { -- the same animation table as your first AnimationComponent
turnRightNormal = "assets/animations/monsters/fjeld_warg/fjeld_warg_turn_right.fbx",
fall = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_front_left.fbx",
attack = "assets/animations/monsters/fjeld_warg/fjeld_warg_attack.fbx",
getHitFrontLeft = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_front_left.fbx",
turnLeftNormal = "assets/animations/monsters/fjeld_warg/fjeld_warg_turn_left.fbx",
getHitFrontRight = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_front_right.fbx",
turnRight = "assets/animations/monsters/fjeld_warg/fjeld_warg_turn_right.fbx",
getHitBack = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_back.fbx",
moveForward = "assets/animations/monsters/fjeld_warg/fjeld_warg_walk.fbx",
turnLeft = "assets/animations/monsters/fjeld_warg/fjeld_warg_turn_left.fbx",
idle = "assets/animations/monsters/fjeld_warg/fjeld_warg_idle.fbx",
getHitLeft = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/fjeld_warg/fjeld_warg_get_hit_right.fbx"
}
for name,filename in pairs(listOfAnimations) do
defineAnimationEvent{
animation = filename,
event = "anim2play_"..name,
normalizedTime = 0,
}
end
end
Code: Select all
onAnimationEvent = function(self,event)
if event:find("anim2play_") then
otherAnimationComponent:play(event:sub(11))
end
end,