Jump to content

In Stategraphs, how would I distinguish animation from the front, side, and back views?

Recommended Posts

I feel like this is a silly question, and I have only really skimmed the tutorials I have found on the subject but...


Suppose my Stategraph had a State like:

    State    {         name = "attack",        tags = {"attack", "canrotate"},        onenter = function(inst)            inst.components.lighttweener:StartTween(nil, 0, .65, .7, nil, 0, function(inst, light) if light then light:Enable(true) end end)            inst.components.lighttweener:StartTween(nil, 3.5, .9, .9, nil, .66, inst.dotweenin)            inst.AnimState:PlayAnimation("attack", true)--Meh            inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/charge")        end,                timeline=        {            TimeEvent(22*FRAMES, function(inst) 				--inst.components.fueled:DoDelta(-1)				if inst.on then                inst.components.combat:StartAttack()                inst.components.combat:DoAttack()				end                inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shoot")            end),        },                events=        {            EventHandler("animover", function(inst) inst.sg:GoToState("watch") end),        },    },

and I wanted it to have an attack animation from the back, as well as from the front, how would I let the game know which to play?

Link to comment
Share on other sites

I think you need to know in which direction do target and attacker look and after that you can do the code i think.

f.e. if attacker looks forward and target looks the same direction = attack animation from the back. target looks in the direction under the angle of ~90 degrees to you = side attack. This is the algorithm, it must work if you know how to find direction of look

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...