//!tgscript v1 //! script name=Farmer //! region graph //! node 1 OnUpdate pos=(60,80) export function onUpdate(ctx) { //! node 2 FindEntity pos=(60,240) entity=Hero const n2_value = ctx.findEntity("Hero"); //! node 3 GetEntityPosition2D pos=(260,240) const n3_value = ctx.getEntityPosition2D(n2_value); //! node 4 GetPosition2D pos=(260,360) const n4_value = ctx.getPosition2D(); //! node 5 Vec2Distance pos=(460,300) const n5_out = ctx.vec2Distance(n3_value, n4_value); //! node 6 ConstNumber pos=(460,420) const n6_value = 1.80; //! node 7 Less pos=(660,300) const n7_out = (n5_out < n6_value); //! node 8 GetGlobal pos=(460,540) global=hasSword const n8_value = ctx.getGlobal("hasSword"); //! node 9 ConstNumber pos=(460,640) const n9_value = 0.50; //! node 10 Less pos=(660,540) const n10_out = (n8_value < n9_value); //! node 40 GetGlobal pos=(460,940) global=started const n40_value = ctx.getGlobal("started"); //! node 41 Greater pos=(660,940) const n41_out = (n40_value > n9_value); //! node 42 And pos=(860,240) const n42_out = (n7_out && n41_out); //! node 11 And pos=(860,360) const n11_out = (n42_out && n10_out); //! node 12 Not pos=(860,540) const n12_out = (!n10_out); //! node 13 And pos=(1060,480) const n13_out = (n42_out && n12_out); //! node 14 FindEntity pos=(860,700) entity=BubbleHello const n14_value = ctx.findEntity("BubbleHello"); //! node 15 FindEntity pos=(860,800) entity=BubbleSword const n15_value = ctx.findEntity("BubbleSword"); //! node 16 ConstVec2 pos=(460,760) const n16_value = ctx.vec2(2.20, 1.90); //! node 17 AddVec2 pos=(660,700) const n17_out = ctx.addVec2(n4_value, n16_value); //! node 18 ConstVec2 pos=(660,860) const n18_value = ctx.vec2(200.00, 240.00); //! node 19 Branch pos=(1260,80) if (n11_out) { //! node 20 SetEntityPosition2D pos=(1460,80) ctx.setEntityPosition2D(n14_value, n17_out); //! node 21 ActionPressed pos=(1460,240) action=Jump const n21_value = ctx.actionPressed("Jump"); //! node 22 Branch pos=(1660,80) if (n21_value) { //! node 23 ConstNumber pos=(1660,240) const n23_value = 1.00; //! node 24 SetGlobal pos=(1860,80) global=hasSword ctx.setGlobal("hasSword", n23_value); } } else { //! node 25 SetEntityPosition2D pos=(1460,320) ctx.setEntityPosition2D(n14_value, n18_value); } //! node 26 Branch pos=(2060,80) if (n13_out) { //! node 27 SetEntityPosition2D pos=(2260,80) ctx.setEntityPosition2D(n15_value, n17_out); } else { //! node 28 SetEntityPosition2D pos=(2260,240) ctx.setEntityPosition2D(n15_value, n18_value); } } //! endregion