Fireandthethud Posted June 23, 2015 Share Posted June 23, 2015 (edited) 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? Edited June 23, 2015 by Fireandthethud Link to comment https://forums.kleientertainment.com/forums/topic/55594-in-stategraphs-how-would-i-distinguish-animation-from-the-front-side-and-back-views/ Share on other sites More sharing options...
Amalleus Posted June 23, 2015 Share Posted June 23, 2015 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 https://forums.kleientertainment.com/forums/topic/55594-in-stategraphs-how-would-i-distinguish-animation-from-the-front-side-and-back-views/#findComment-649321 Share on other sites More sharing options...
Fireandthethud Posted June 23, 2015 Author Share Posted June 23, 2015 Huh okay that makes sense, now to go filter through stategraphs and find something similar I guess Link to comment https://forums.kleientertainment.com/forums/topic/55594-in-stategraphs-how-would-i-distinguish-animation-from-the-front-side-and-back-views/#findComment-649400 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now