Jump to content

Help With Stategraphs!

Recommended Posts

need help with stategraphs, the creature of the mod does not want to turn.I don't know what name to put in spriter to fix. here's the code:

require("stategraphs/commonstates")local states={    State{        name = "idle",        tags = {"idle"},        onenter = function(inst, playanim)            inst.AnimState:PlayAnimation("idle")        end,    },        State{        name = "attack",        tags = {"attack", "canrotate"},                onenter = function(inst)            inst.components.combat:StartAttack()            inst.Physics:Stop()            inst.AnimState:PlayAnimation("atk")        end,                timeline=        {            TimeEvent(20*FRAMES, function(inst) inst.components.combat:DoAttack() inst.sg:RemoveStateTag("attack") inst.sg:RemoveStateTag("busy") end),        },                events=        {            EventHandler("animqueueover", function(inst) inst.sg:GoToState("idle") end),        },    },State{        name = "death",        tags = {"busy"},                onenter = function(inst)            inst.AnimState:PlayAnimation("dead")            inst.Physics:Stop()            RemovePhysicsColliders(inst)                        inst.components.lootdropper:DropLoot(Vector3(inst.Transform:GetWorldPosition()))                    end,            },     State{        name = "hit",        tags = {"busy"},        onenter = function(inst)            inst.AnimState:PlayAnimation("hit")            inst.Physics:Stop()        end,        events=        {            EventHandler("animover", function(inst) inst.sg:GoToState("idle") end ),        },    },}local event_handlers={EventHandler("death", function(inst) inst.sg:GoToState("death") end),    EventHandler("doattack", function(inst) if inst.components.health:GetPercent() > 0 and not inst.sg:HasStateTag("busy") then inst.sg:GoToState("attack") end end),}return StateGraph("SGmimic", states, event_handlers, "idle", {})

Sorry for my bad english, i am from brazil. used google translate.

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...