//!tgscript v1 //! script name=Slime //! 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 SubVec2 pos=(460,300) const n5_out = ctx.subVec2(n3_value, n4_value); //! node 6 Vec2Length pos=(660,300) const n6_out = ctx.vec2Length(n5_out); //! node 7 Vec2Normalize pos=(660,420) const n7_out = ctx.vec2Normalize(n5_out); //! node 8 ConstNumber pos=(660,540) const n8_value = 4.00; //! node 9 Less pos=(860,300) const n9_out = (n6_out < n8_value); //! node 10 GetGlobal pos=(660,640) global=started const n10_value = ctx.getGlobal("started"); //! node 11 ConstNumber pos=(660,740) const n11_value = 0.50; //! node 12 Greater pos=(860,420) const n12_out = (n10_value > n11_value); //! node 13 And pos=(1060,300) const n13_out = (n9_out && n12_out); //! node 29 ConstNumber pos=(860,840) const n29_value = 1.00; //! node 36 Time pos=(860,940) const n36_value = ctx.time(); //! node 14 Branch pos=(1260,80) if (n13_out) { //! node 15 ConstNumber pos=(1060,420) const n15_value = 1.80; //! node 16 ScaleVec2 pos=(1260,320) const n16_out = ctx.scaleVec2(n7_out, n15_value); //! node 17 SetVelocity2D pos=(1460,80) ctx.setVelocity2D(n16_out); } else { //! node 18 ConstVec2 pos=(1260,460) const n18_value = ctx.vec2(0.00, 0.00); //! node 19 SetVelocity2D pos=(1460,240) ctx.setVelocity2D(n18_value); } //! node 20 ActionPressed pos=(1060,560) action=Jump const n20_value = ctx.actionPressed("Jump"); //! node 21 GetGlobal pos=(1060,660) global=hasSword const n21_value = ctx.getGlobal("hasSword"); //! node 22 Greater pos=(1260,620) const n22_out = (n21_value > n11_value); //! node 23 ConstNumber pos=(1060,760) const n23_value = 1.50; //! node 24 Less pos=(1260,740) const n24_out = (n6_out < n23_value); //! node 25 And pos=(1460,600) const n25_out = (n20_value && n22_out); //! node 26 And pos=(1660,640) const n26_out = (n25_out && n24_out); //! node 27 Branch pos=(1860,80) if (n26_out) { //! node 28 GetGlobal pos=(1860,240) global=slain const n28_value = ctx.getGlobal("slain"); //! node 30 AddNumber pos=(2060,240) const n30_out = (n28_value + n29_value); //! node 31 SetGlobal pos=(2260,80) global=slain ctx.setGlobal("slain", n30_out); //! node 32 ConstVec2 pos=(2260,240) const n32_value = ctx.vec2(200.00, 230.00); //! node 33 SetPosition2D pos=(2460,80) ctx.setPosition2D(n32_value); //! node 100 FindEntity pos=(2660,680) entity=SfxDefeat const n100_value = ctx.findEntity("SfxDefeat"); //! node 101 PlayAudio pos=(2660,520) ctx.playAudio(n100_value); } //! node 34 ConstNumber pos=(1660,860) const n34_value = 0.95; //! node 35 Less pos=(1860,860) const n35_out = (n6_out < n34_value); //! node 37 GetGlobal pos=(1660,960) global=hurtUntil const n37_value = ctx.getGlobal("hurtUntil"); //! node 38 Greater pos=(1860,960) const n38_out = (n36_value > n37_value); //! node 39 And pos=(2060,900) const n39_out = (n35_out && n38_out); //! node 40 Branch pos=(2660,80) if (n39_out) { //! node 41 GetGlobal pos=(2660,240) global=hp const n41_value = ctx.getGlobal("hp"); //! node 42 SubNumber pos=(2860,240) const n42_out = (n41_value - n29_value); //! node 43 SetGlobal pos=(3060,80) global=hp ctx.setGlobal("hp", n42_out); //! node 44 AddNumber pos=(2860,360) const n44_out = (n36_value + n29_value); //! node 45 SetGlobal pos=(3260,80) global=hurtUntil ctx.setGlobal("hurtUntil", n44_out); //! node 46 ConstNumber pos=(2860,480) const n46_value = 1.20; //! node 47 ScaleVec2 pos=(3060,440) const n47_out = ctx.scaleVec2(n7_out, n46_value); //! node 48 AddVec2 pos=(3260,400) const n48_out = ctx.addVec2(n3_value, n47_out); //! node 49 SetEntityPosition2D pos=(3460,80) ctx.setEntityPosition2D(n2_value, n48_out); //! node 102 FindEntity pos=(3660,240) entity=SfxHurt const n102_value = ctx.findEntity("SfxHurt"); //! node 103 PlayAudio pos=(3660,80) ctx.playAudio(n102_value); } } //! endregion