//!tgscript v1 //! script name=Health //! region graph //! node 1 OnStart pos=(60,80) export function onStart(ctx) { //! node 2 ConstNumber pos=(260,80) const n2_value = 3.00; //! node 3 SetGlobal pos=(460,80) global=hp ctx.setGlobal("hp", n2_value); } //! node 10 OnUpdate pos=(60,320) export function onUpdate(ctx) { //! node 11 FindEntity pos=(60,460) entity=Camera const n11_value = ctx.findEntity("Camera"); //! node 12 GetEntityPosition2D pos=(260,460) const n12_value = ctx.getEntityPosition2D(n11_value); //! node 13 GetGlobal pos=(60,560) global=hp const n13_value = ctx.getGlobal("hp"); //! node 14 GetGlobal pos=(60,660) global=started const n14_value = ctx.getGlobal("started"); //! node 15 ConstNumber pos=(60,760) const n15_value = 0.50; //! node 16 Greater pos=(260,660) const n16_out = (n14_value > n15_value); //! node 17 ConstVec2 pos=(260,760) const n17_value = ctx.vec2(200.00, 260.00); //! node 31 FindEntity pos=(260,900) entity=Heart1 const n31_value = ctx.findEntity("Heart1"); //! node 32 ConstVec2 pos=(260,1000) const n32_value = ctx.vec2(-0.70, 3.70); //! node 33 AddVec2 pos=(460,1000) const n33_out = ctx.addVec2(n12_value, n32_value); //! node 34 ConstNumber pos=(260,1100) const n34_value = 0.50; //! node 35 Greater pos=(460,1100) const n35_out = (n13_value > n34_value); //! node 36 And pos=(660,1100) const n36_out = (n35_out && n16_out); //! node 37 Branch pos=(1060,320) if (n36_out) { //! node 38 SetEntityPosition2D pos=(1260,320) ctx.setEntityPosition2D(n31_value, n33_out); } else { //! node 39 SetEntityPosition2D pos=(1260,480) ctx.setEntityPosition2D(n31_value, n17_value); } //! node 40 FindEntity pos=(260,1320) entity=Heart2 const n40_value = ctx.findEntity("Heart2"); //! node 41 ConstVec2 pos=(260,1420) const n41_value = ctx.vec2(0.00, 3.70); //! node 42 AddVec2 pos=(460,1420) const n42_out = ctx.addVec2(n12_value, n41_value); //! node 43 ConstNumber pos=(260,1520) const n43_value = 1.50; //! node 44 Greater pos=(460,1520) const n44_out = (n13_value > n43_value); //! node 45 And pos=(660,1520) const n45_out = (n44_out && n16_out); //! node 46 Branch pos=(1560,320) if (n45_out) { //! node 47 SetEntityPosition2D pos=(1760,320) ctx.setEntityPosition2D(n40_value, n42_out); } else { //! node 48 SetEntityPosition2D pos=(1760,480) ctx.setEntityPosition2D(n40_value, n17_value); } //! node 49 FindEntity pos=(260,1740) entity=Heart3 const n49_value = ctx.findEntity("Heart3"); //! node 50 ConstVec2 pos=(260,1840) const n50_value = ctx.vec2(0.70, 3.70); //! node 51 AddVec2 pos=(460,1840) const n51_out = ctx.addVec2(n12_value, n50_value); //! node 52 ConstNumber pos=(260,1940) const n52_value = 2.50; //! node 53 Greater pos=(460,1940) const n53_out = (n13_value > n52_value); //! node 54 And pos=(660,1940) const n54_out = (n53_out && n16_out); //! node 55 Branch pos=(2060,320) if (n54_out) { //! node 56 SetEntityPosition2D pos=(2260,320) ctx.setEntityPosition2D(n49_value, n51_out); } else { //! node 57 SetEntityPosition2D pos=(2260,480) ctx.setEntityPosition2D(n49_value, n17_value); } //! node 66 KeyDown pos=(260,2500) key=Q const n66_value = ctx.keyDown("Q"); //! node 67 GetGlobal pos=(260,2600) global=potions const n67_value = ctx.getGlobal("potions"); //! node 68 Greater pos=(460,2600) const n68_out = (n67_value > n15_value); //! node 69 ConstNumber pos=(260,2700) const n69_value = 2.50; //! node 70 Less pos=(460,2700) const n70_out = (n13_value < n69_value); //! node 71 And pos=(660,2550) const n71_out = (n66_value && n68_out); //! node 72 And pos=(860,2600) const n72_out = (n71_out && n70_out); //! node 73 Branch pos=(3200,320) if (n72_out) { //! node 74 ConstNumber pos=(3200,480) const n74_value = 3.00; //! node 75 SetGlobal pos=(3400,320) global=hp ctx.setGlobal("hp", n74_value); //! node 76 ConstNumber pos=(3200,580) const n76_value = 1.00; //! node 77 SubNumber pos=(3400,580) const n77_out = (n67_value - n76_value); //! node 78 SetGlobal pos=(3600,320) global=potions ctx.setGlobal("potions", n77_out); //! node 100 FindEntity pos=(3800,480) entity=SfxDrink const n100_value = ctx.findEntity("SfxDrink"); //! node 101 PlayAudio pos=(3800,320) ctx.playAudio(n100_value); } } //! endregion