Platformer but it's upgrading

Instructions: Use [Arrow keys] to move, [WASD] when you unlock\nUse Space to Dash (when you unlock dashing),\nUse [R] to reset level if you're stuck\nUse [N] to skip level if you can't win it.\nGame is completed once "You win" text appear.\nThere are 20 levels (5 of each upgrade)\nUse [T] to teleport to mouse if level is too hard\n

@Stage\n\nwhen I receive [startlevel v]\nswitch backdrop to (join [lvl] (Level))\n\n@Main\n\nwhen flag clicked\nbroadcast (init v) and wait\nbroadcast (StartGame v)\nforever\n    set [~oldtime v] to (days since 2000)\n    broadcast (update v) and wait\n    erase all\n    broadcast (draw v) and wait\n    set [#deltatime v] to ((86400) * ((days since 2000) - (~oldTime)))\n    if <(EndState) = [-1]> then\n        set volume to (100) %\n    else\n        set volume to ((EndState) * (50)) %\n    end\nend\n\nwhen I receive [init v]\nset [level v] to [1]\nGetDash\nCalculate upgrade\nbroadcast (StartLevel v) and wait\n\nwhen I receive [upgrade v]\nstop all sounds\n\ndefine Calculate upgrade\nset [everythingsize v] to [1]\nif <(Level) < [6]> then\n    set [upgraded v] to [0]\nelse\n    if <(Level) < [11]> then\n        set [upgraded v] to [1]\n    else\n        if <(Level) < [16]> then\n            set [upgraded v] to [2]\n        else\n            set [upgraded v] to [3]\n            set [everythingsize v] to [0.7]\n        end\n    end\nend\n\nwhen I receive [startgame v]\nforever\n    if <(Upgraded) = [1]> then\n        play sound [Vexento - Lonely Dance v] until done\n    end\n    if <(Upgraded) = [2]> then\n        play sound [Castle Theme \(8-BIT\) - Newer Super Mario Bros v] until done\n    end\n    if <(Upgraded) = [3]> then\n        play sound [Minigame v] until done\n    end\nend\n\ndefine GetDash\nset [havedash v] to [0]\nif <(Level) > [12]> then\n    set [havedash v] to [1]\nend\n\nset [havekey v] to [0]\n\n@Player\n\ndefine Touch Ground <up?>\nif <<touching (flag v)?> and <not <up?>>> then\n    set [vy v] to [12]\n    change y by (4)\n    start sound [flag v]\n    set [candash v] to [1 ]\nend\nchange [falling? v] by (1)\nrepeat until <not <<<touching (ground v)?> or <touching (keydoor v)?>> or <<touching (flag v)?> and <not <up?>>>>>\n    if <up?> then\n        change y by (-1)\n    else\n        if <not <touching (flag v)?>> then\n            set [falling? v] to [0]\n        end\n        change y by (1)\n        set [candash v] to [1 ]\n    end\n    set [vy v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <<touching (ground v)?> or <touching (keydoor v)?>>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\n\nwhen I receive [startgame v]\nrepeat until <not <(Upgraded) = [0]>>\n    Physics 1\n    if <(x position) > [230]> then\n        Next Level\n    end\nend\nrepeat until <(Upgraded) > [3]>\n    Physics2\n    if <(Upgraded) = [3]> then\n        if <(EndState) = [1]> then\n            Next Level\n        end\n    else\n        if <(x position) > [235]> then\n            Next Level\n        end\n    end\nend\n\ndefine Physics 1\nif <key (left arrow v) pressed?> then\n    change x by (-4)\nend\nif <key (right arrow v) pressed?> then\n    change x by (4)\nend\nif <touching (ground v)?> then\n    change y by (2)\n    if <touching (ground v)?> then\n        change y by (2)\n        if <touching (ground v)?> then\n            change y by (2)\n            if <touching (ground v)?> then\n                change y by (2)\n                if <touching (ground v)?> then\n                    change y by (2)\n                    if <touching (ground v)?> then\n                        change y by (2)\n                        if <touching (ground v)?> then\n                            change y by (2)\n                            if <touching (ground v)?> then\n                                change y by (2)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [vy v] by (-1)\nchange y by (Vy)\nif <touching (ground v)?> then\n    set [vy v] to [0]\n    if <key (up arrow v) pressed?> then\n        set [vy v] to [15]\n    end\nend\nif <touching (spikes v)?> then\n    Reset position\nend\nif <touching (bouncy v)?> then\n    set [vy v] to [22]\nend\n\nwhen I receive [startlevel v]\nset [vy v] to [0]\nReset position\nset size to ((EverythingSize) * (100)) %\n\ndefine Reset position\ngo to x: (-200) y: ((-180) + ((EverythingSize) * (59)))\nset [dashstate v] to [0]\n\nset [upgraded v] to [0]\n\ndefine Physics2\nif <(Upgraded) > [1]> then\n    switch costume to (player3collision v)\nend\nif <(DashState) = [0]> then\n    change [vy v] by ((-1) * (EverythingSize))\nelse\n    change [vy v] by ((-0.3333) * (EverythingSize))\nend\nchange y by (Vy)\nTouch Ground <(Vy) > [0]>\nif <(EndState) = [-1]> then\n    if <(DashState) = [0]> then\n        if <<key (left arrow v) pressed?> or <<(Upgraded) > [1]> and <key (a v) pressed?>>> then\n            Walk (-90) ((-4) * (EverythingSize))\n        end\n        if <<key (right arrow v) pressed?> or <<(Upgraded) > [1]> and <key (d v) pressed?>>> then\n            Walk (90) ((4) * (EverythingSize))\n        end\n        if <<<key (up arrow v) pressed?> or <<(Upgraded) > [1]> and <key (w v) pressed?>>> and <<(falling?) < [3]> and <(DashState) = [0]>>> then\n            set [vy v] to ((12) * (EverythingSize))\n            if <<(Upgraded) > [1]> and <(falling?) = [0]>> then\n                start sound [jump v]\n            end\n        end\n        if <<<(HaveDash) = [1]> and <(CanDash) = [1]>> and <key (space v) pressed?>> then\n            set [candash v] to [0]\n            set [dashdirection v] to ((direction) / (90))\n            set [dashstate v] to [1]\n            set [vy v] to [0]\n            start sound [Slash v]\n        end\n    else\n        if <(DashDirection) = [1]> then\n            Walk (90) ((12) * (EverythingSize))\n        else\n            Walk (-90) ((-12) * (EverythingSize))\n        end\n        change [dashstate v] by (-0.1)\n        if <(DashState) < [0]> then\n            set [dashstate v] to [0]\n        end\n    end\n    if <(y position) < [-180]> then\n        broadcast (ResetLevel v)\n        set [vy v] to [0]\n    end\n    if <touching (spikes v)?> then\n        broadcast (ResetLevel v)\n    end\n    if <touching (bouncy v)?> then\n        set [vy v] to [22]\n    end\nend\nif <<(Upgraded) = [2]> or <(Upgraded) > [1]>> then\n    switch costume to (join [player3_] ([ceiling v] of (PlayerAnimation) ))\n    change [playeranimation v] by (0.3)\n    if <(PlayerAnimation) > [4]> then\n        set [playeranimation v] to [0.0001]\n    end\nend\n\nwhen I receive [startgame v]\nset rotation style [left-right v]\nset [playeranimation v] to [1]\nset [falling? v] to [10]\nset [vx v] to [0]\nset [vy v] to [0]\nset [dashstate v] to [0]\nset [candash v] to [0]\nReset position\nswitch costume to ((Upgraded) + (1))\nshow\n\nwhen [n v] key pressed\nif <(Level) < [21]> then\n    Next Level\nend\n\nwhen [r v] key pressed\nbroadcast (ResetLevel v) and wait\nwait until <not <key (r v) pressed?>>\n\nwhen I receive [resetlevel v]\nReset position\n\ndefine Check Upgrade\nif <(Level) = [6]> then\n    switch costume to (player2 v)\n    change [upgraded v] by (1)\n    broadcast (Upgrade v)\nend\nif <(Level) = [11]> then\n    switch costume to (player3_1 v)\n    change [upgraded v] by (1)\n    broadcast (Upgrade v)\nend\nif <(Level) > [12]> then\n    set [havedash v] to [1]\nend\nif <(Level) = [16]> then\n    change [upgraded v] by (1)\n    set [everythingsize v] to [0.7]\n    broadcast (Upgrade v)\nend\n\ndefine Next Level\nchange [level v] by (1)\nCheck Upgrade\nbroadcast (StartLevel v)\n\nwhen [t v] key pressed\ngo to (mouse-pointer v)\n\n@Ground\n\nwhen I receive [startlevel v]\nswitch costume to (join [lvl] (Level))\n\nwhen I receive [startgame v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (join [lvl] (Level))\n\n@Spikes\n\nwhen I receive [startlevel v]\nswitch costume to (lvl v)\nswitch costume to (join [lvl] (Level))\n\nwhen I receive [startgame v]\nshow\n\n@Bouncy\n\nwhen I receive [startgame v]\nshow\ngo to x: (0) y: (0)\n\nwhen I receive [startlevel v]\nswitch costume to (lvl v)\nswitch costume to (join [lvl] (Level))\n\n@SwordLevel\n\nwhen I receive [startlevel v]\nif <(Level) = [12]> then\n    show\n    create clone of (_myself_ v)\n    switch costume to (sword v)\n    wait until <(HaveDash) = [1]>\n    hide\nelse\n    hide\n    delete this clone\nend\n\nwhen I start as a clone\nwait until <touching (player v)?>\nstart sound [Collect v]\nset [havedash v] to [1]\ndelete this clone\n\nwhen I receive [startgame v]\ngo to x: (13) y: (-110)\nswitch costume to (light v)\nhide\n\n@Sword\n\nwhen I receive [startgame v]\nhide\nwait until <(HaveDash) = [1]>\nforever\n    show\n    go to (player v)\n    if <(DashState) > [0.5]> then\n        point in direction ((90) + ((((1) - (DashState)) * ([direction v] of [player v])) * (2)))\n    else\n        point in direction ((90) + (((DashState) * ([direction v] of [player v])) * (2)))\n    end\nend\n\nwhen I receive [startlevel v]\nset size to ((EverythingSize) * (100)) %\n\n@BatEnemy\n\ndefine [T] Atan2 (y) (x)\nif <(x) = [0]> then\n    if <(y) < [0]> then\n        set [~getangle v] to [-90]\n    else\n        set [~getangle v] to [90]\n    end\nelse\n    if <(x) > [0]> then\n        set [~getangle v] to ([atan v] of ((y) / (x)) )\n    else\n        set [~getangle v] to (([atan v] of ((y) / (x)) ) + (180))\n    end\nend\n\nwhen I receive [init v]\nset [~isclone v] to [0]\nset rotation style [left-right v]\nhide\n\nwhen I receive [startlevel v]\nset size to ((EverythingSize) * (100)) %\nif <(~isClone) = [0]> then\n    if <(Level) = [14]> then\n        Add bat - path: [-100] [-120] [200] [-120]\n        Add bat - path: [59] [0] [200] [120]\n        Add bat - path: [-220] [0] [-210] [120]\n    end\n    if <(Level) = [15]> then\n        Add bat - path: [90] [85] [180] [-70]\n        Add bat - path: [-120] [10] [85] [-46]\n        Add bat - path: [-24] [141] [190] [86]\n    end\n    if <(Level) = [16]> then\n        Add bat - path: [-119] [-30] [-100] [-140]\n        Add bat - path: [-13] [78] [-22] [-90]\n        Add bat - path: [-140] [94] [205] [96]\n    end\n    if <(Level) = [17]> then\n        Add bat - path: [-200] [0] [200] [0]\n        Add bat - path: [200] [-90] [-200] [-90]\n        Add bat - path: [210] [-148] [-177] [126]\n    end\n    if <(Level) = [18]> then\n        Add bat - path: [-84] [166] [-84] [-166]\n        Add bat - path: [60] [166] [60] [-166]\n        Add bat - path: [-84] [-166] [-84] [166]\n        Add bat - path: [60] [-166] [60] [166]\n        Add bat - path: [-84] [-166] [60] [166]\n        Add bat - path: [60] [166] [-84] [-166]\n    end\n    if <(Level) = [19]> then\n        Add bat - path: [-171] [-59] [161] [-59]\n        Add bat - path: [171] [-59] [-169] [-59]\n        Add bat - path: [-217] [139] [218] [63]\n        Add bat - path: [-120] [164] [-120] [0]\n        Add bat - path: [170] [164] [170] [0]\n    end\n    if <(Level) = [20]> then\n        Add bat - path: [-173] [160] [-173] [-59]\n    end\n    if <(Level) = [21]> then\n        Add bat - path: [-56] [55] [221] [55]\n    end\nelse\n    delete this clone\nend\n\nwhen I start as a clone\nset [~isclone v] to [1]\nset [~deadstate v] to [-1]\nshow\nset [ghost v] effect to (0)\ngo to x: (~pathX1) y: (~pathY1)\nset [~movestate v] to [0]\nforever\n    if <(~deadState) = [-1]> then\n        if <(~moveState) = [0]> then\n            [T] Atan2 ((~pathX2) - (~pathX1)) ((~pathY2) - (~pathY1))\n            point in direction ((~getAngle) + (0))\n            move ((4) * (EverythingSize)) steps\n            if <((((~pathX2) - (x position)) * ((~pathX2) - (x position))) + (((~pathY2) - (y position)) * ((~pathY2) - (y position)))) < [100]> then\n                set [~movestate v] to [1]\n            end\n        else\n            [T] Atan2 ((~pathX1) - (~pathX2)) ((~pathY1) - (~pathY2))\n            point in direction ((~getAngle) + (0))\n            move ((4) * (EverythingSize)) steps\n            if <((((~pathX1) - (x position)) * ((~pathX1) - (x position))) + (((~pathY1) - (y position)) * ((~pathY1) - (y position)))) < [100]> then\n                set [~movestate v] to [0]\n            end\n        end\n        Collision\n    else\n        change [~deadstate v] by (0.033)\n        set [ghost v] effect to ((100) * (~deadState))\n        change y by ((5) - ((~deadState) * (20)))\n        if <(direction) > [0]> then\n            change x by (4)\n        else\n            change x by (-4)\n        end\n    end\nend\n\nwhen I start as a clone\nset [~anim v] to [0]\nforever\n    wait (0.033) seconds\n    switch costume to (join [bat] (~anim))\n    change [~anim v] by (1)\n    set [~anim v] to ((~anim) mod (4))\nend\n\ndefine Collision\nset [~costumetemp v] to (costume [number v])\nif <(DashState) = [0]> then\n    switch costume to (hitbox v)\n    if <touching (player v)?> then\n        broadcast (ResetLevel v)\n    end\nelse\n    switch costume to (hitbox v)\n    if <touching (player v)?> then\n        if <(Upgraded) = [3]> then\n            start sound [bat hit v]\n            set [~deadstate v] to [0]\n        else\n            hide\n        end\n    end\nend\nswitch costume to (~costumeTemp)\n\nwhen I receive [resetlevel v]\nif <(~isClone) = [1]> then\n    show\n    set [ghost v] effect to (0)\n    go to x: (~pathX1) y: (~pathY1)\n    set [~movestate v] to [0]\n    set [~deadstate v] to [-1]\nend\n\ndefine Add bat - path: (x1) (y1) (x2) (y2)\nset [~pathx1 v] to (x1)\nset [~pathy1 v] to (y1)\nset [~pathx2 v] to (x2)\nset [~pathy2 v] to (y2)\ncreate clone of (_myself_ v)\n\n@Key\n\nwhen I receive [init v]\nset [havekey v] to [0]\nset [~isclone v] to [0]\nhide\n\nwhen I receive [startlevel v]\nif <(~isClone) = [0]> then\n    hide\n    set size to ((EverythingSize) * (100)) %\n    set [levelhaskey v] to [0]\n    if <(Level) = [15]> then\n        Set Key [158] [152]\n    end\n    if <(Level) = [16]> then\n        Set Key [124] [143]\n    end\n    if <(Level) = [17]> then\n        Set Key [210] [-146]\n    end\n    if <(Level) = [18]> then\n        Set Key [-210] [157]\n        Set Key [213] [-147]\n        Set Key [174] [-147]\n    end\n    if <(Level) = [19]> then\n        Set Key [206] [-155]\n        Set Key [206] [7]\n    end\n    if <(Level) = [20]> then\n        Set Key [-215] [136]\n    end\nelse\n    delete this clone\nend\n\nwhen I receive [resetlevel v]\nif <(~isClone) = [0]> then\n    set [havekey v] to [0]\nelse\n    show\nend\n\ndefine Set Key (x) (y)\ngo to x: (x) y: (y)\nset [levelhaskey v] to [1]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [~isclone v] to [1]\nshow\nforever\n    if <touching (player v)?> then\n        change [havekey v] by (1)\n        start sound [keyCollect v]\n        hide\n    end\nend\n\n@KeyUI\n\nwhen I receive [draw v]\nDraw\n\ndefine Draw\ngo to x: (-220) y: (165)\nrepeat (HaveKey)\n    stamp\n    change x by (41)\nend\n\n@Keydoor\n\nwhen I receive [startlevel v]\nset size to ((EverythingSize) * (100)) %\nif <(~isClone) = [0]> then\n    if <(Level) = [15]> then\n        Add Door [225] [-142]\n    end\n    if <(Level) = [16]> then\n        Add Door [112] [-159]\n    end\n    if <(Level) = [17]> then\n        Add Door [-122] [-170]\n    end\n    if <(Level) = [18]> then\n        Add Door [130] [130]\n        Add Door [150] [130]\n        Add Door [144] [-166]\n    end\n    if <(Level) = [19]> then\n        Add Door [-151] [-8]\n        Add Door [-184] [46]\n    end\n    if <(Level) = [20]> then\n        Add Door [124] [-169]\n    end\nelse\n    delete this clone\nend\n\nwhen I receive [init v]\nset [~isclone v] to [0]\nhide\n\nwhen I start as a clone\nset [~isclone v] to [1]\nshow\nforever\n    Collision\nend\n\ndefine Add Door (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [resetlevel v]\nif <(~isClone) = [1]> then\n    show\nend\n\nset size to ((EverythingSize) * (100)) %\n\ndefine Collision\nif <(HaveKey) > [0]> then\n    set size to ((size) * (1.3)) %\n    if <touching (player v)?> then\n        change [havekey v] by (-1)\n        start sound [open door v]\n        hide\n    end\n    set size to ((size) / (1.3)) %\nend\n\n@Dash animation\n\nwhen I receive [startlevel v]\ndelete this clone\n\nwhen I receive [resetlevel v]\ndelete this clone\n\nwhen I receive [startgame v]\nhide\nwait until <(Upgraded) = [3]>\nrepeat until <not <(Upgraded) = [3]>>\n    if <(DashState) > [0]> then\n        go to (player v)\n        change y by (10)\n        point in direction ([direction v] of [player v])\n        go to [back v] layer\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (50)\nrepeat (10)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\n@End door\n\nwhen I receive [startlevel v]\nset [endstate v] to [-1]\nhide\nif <(Level) = [16]> then\n    show\n    go to x: (186) y: (-158)\nend\nif <(Level) = [17]> then\n    show\n    go to x: (-70) y: (-168)\nend\nif <(Level) = [18]> then\n    show\n    go to x: (207) y: (131)\nend\nif <(Level) = [19]> then\n    show\n    go to x: (-213) y: (46)\nend\nif <(Level) = [20]> then\n    show\n    go to x: (100) y: (120)\nend\n\nwhen I receive [resetlevel v]\nset [endstate v] to [-1]\n\nwhen I receive [startgame v]\nset [endstate v] to [-1]\ngo to [back v] layer\ngo [forward v] (1) layers\nforever\n    if <(EndState) = [-1]> then\n        switch costume to (collision v)\n        if <touching (player v)?> then\n            set [endstate v] to [0]\n            set [dashstate v] to [0]\n            start sound [complete v]\n        end\n        switch costume to (door1 v)\n    else\n        change [endstate v] by (0.01)\n        if <(EndState) > [1]> then\n            set [endstate v] to [1]\n        end\n        switch costume to (join [door] ([ceiling v] of ((EndState) * (10)) ))\n    end\nend\n\nwhen I start as a clone\n\n@Flag\n\nwhen I receive [startlevel v]\nswitch costume to (flag1 v)\n\nwhen I receive [startlevel v]\nset size to ((EverythingSize) * (100)) %\nif <(~isClone) = [0]> then\n    if <(Level) = [17]> then\n        Add flag [-180] [-100] dir [90]\n        Add flag [-180] [-20] dir [90]\n        Add flag [-180] [60] dir [90]\n        Add flag [-180] [60] dir [90]\n        Add flag [-30] [40] dir [90]\n        Add flag [65] [-45] dir [90]\n        Add flag [151] [-110] dir [90]\n    end\n    if <(Level) = [18]> then\n        Add flag [50] [-70] dir [-90]\n        Add flag [-73] [0] dir [90]\n        Add flag [50] [70] dir [-90]\n        Add flag [-94] [-100] dir [-90]\n    end\n    if <(Level) = [19]> then\n        Add flag [-187] [-95] dir [90]\n        Add flag [0] [-90] dir [90]\n        Add flag [163] [-95] dir [90]\n        Add flag [-17] [90] dir [-90]\n        Add flag [0] [90] dir [90]\n    end\n    if <(Level) = [20]> then\n        Add flag [-181] [-33] dir [-90]\n        Add flag [-163] [66] dir [90]\n        Add flag [-163] [66] dir [90]\n        Add flag [164] [2] dir [90]\n    end\n    if <(Level) = [21]> then\n        Add flag [-107] [-33] dir [-90]\n        Add flag [-107] [89] dir [-90]\n    end\nelse\n    delete this clone\nend\n\nwhen I receive [init v]\nset rotation style [left-right v]\nset [~isclone v] to [0]\nhide\n\nwhen I start as a clone\nset [~isclone v] to [1]\nswitch costume to (collider v)\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [resetlevel v]\nif <(~isClone) = [1]> then\n    show\nend\n\nset size to ((EverythingSize) * (100)) %\n\ndefine Add flag (x) (y) dir (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I receive [draw v]\nDraw\n\n\n\ndefine Draw\nif <(~isClone) = [1]> then\n    switch costume to (collider2 v)\n    set [ghost v] effect to (0)\n    if <touching (player v)?> then\n        set [~flagstate v] to [4]\n    end\n    change [~flagstate v] by (() - ((#DeltaTime) * (10)))\n    if <(~flagState) < [0.0001]> then\n        set [~flagstate v] to [0.0001]\n    end\n    switch costume to (join [flag] ([ceiling v] of (~flagState) ))\n    stamp\n    switch costume to (collider v)\n    set [ghost v] effect to (100)\nend\n\n@FireBar\n\ndefine Dist from point to line segment (px) (py) Line: (x1) (y1) | (x2) (y2)\nset [~vx v] to ((x2) - (x1))\nset [~vy v] to ((y2) - (y1))\nset [~t v] to (((((px) - (x1)) * (~vx)) + (((py) - (y1)) * (~vy))) / (((~vx) * (~vx)) + ((~vy) * (~vy))))\nif <(~T) > [1]> then\n    set [~t v] to [1]\nend\nif <(~T) < [0]> then\n    set [~t v] to [0]\nend\nset [*returnx v] to ((x1) + ((~vx) * (~T)))\nset [*returny v] to ((y1) + ((~vy) * (~T)))\nset [*dist v] to ([sqrt v] of ((((px) - (*returnX)) * ((px) - (*returnX))) + (((py) - (*returnY)) * ((py) - (*returnY)))) )\n\nwhen I receive [startlevel v]\nset size to ((EverythingSize) * (100)) %\nif <(~isClone) = [0]> then\n    if <(Level) = [19]> then\n        Add bar [-170] [-185] size [340] direction [0] speed [0]\n        Add bar [-80] [-12] size [200] direction [0] speed [0]\n    end\n    if <(Level) = [20]> then\n        Add bar [-100] [-120] size [70] direction [0] speed [240]\n        Add bar [-100] [24] size [150] direction [0] speed [-80]\n        Add bar [157] [30] size [75] direction [0] speed [150]\n        Add bar [157] [-60] size [75] direction [0] speed [-150]\n    end\n    if <(Level) = [21]> then\n        Add bar [200] [120] size [100] direction [0] speed [1000]\n        Add bar [200] [120] size [100] direction [20] speed [1000]\n        Add bar [200] [120] size [100] direction [40] speed [1000]\n    end\nelse\n    delete this clone\nend\n\nwhen I receive [resetlevel v]\nif <(~isClone) = [1]> then\n    set [~dir v] to (~startDir)\nend\n\nwhen I receive [startlevel v]\ndelete all of [particledata v]\n\ndefine Add bar (x) (y) size (size) direction (dir) speed (speed)\nset [~x v] to (x)\nset [~y v] to (y)\nset [~size v] to (size)\nset [~startdir v] to (dir)\nset [~dir v] to (dir)\nset [~speed v] to (speed)\ncreate clone of (_myself_ v)\n\nwhen I receive [init v]\nset rotation style [all around v]\nset [~isclone v] to [0]\nhide\n\nwhen I start as a clone\nset [~isclone v] to [1]\nhide\nforever\n    Update\nend\n\ndefine Draw\nAdd Particle (~x) (~y)\nset [~d v] to [0]\nrepeat ((~size) / (15))\n    change [~d v] by ((15) / (~size))\n    Add Particle ((~x) + ((([cos v] of (~dir) ) * (~size)) * (~d))) ((~y) + ((([sin v] of (~dir) ) * (~size)) * (~d)))\nend\n\ndefine Update\nchange [~dir v] by ((#DeltaTime) * (~speed))\nDist from point to line segment ([x position v] of [player v]) ([y position v] of [player v]) Line: (~x) (~y) | ((~x) + (([cos v] of (~dir) ) * (~size))) ((~y) + (([sin v] of (~dir) ) * (~size)))\nif <(*dist) < [20]> then\n    broadcast (ResetLevel v)\nend\nDraw\n\nshow\n\nwhen I receive [init v]\nswitch costume to (costume1 v)\ndelete all of [particledata v]\n\ndefine Add Particle (x) (y)\nadd (x) to [particledata v]\nadd (y) to [particledata v]\nadd [100] to [particledata v]\n\n@Particle\n\nwhen flag clicked\nclear graphic effects\nhide\nset size to (100) %\ndelete all of [particledata v]\nset [particledatacount v] to [3]\n\ndefine Draw\nset [~id v] to ((length of [particledata v]) / (ParticleDataCount))\nrepeat ((length of [particledata v]) / (ParticleDataCount))\n    set [~getdata v] to (((~ID) - (1)) * (ParticleDataCount))\n    go to x: (item ((~getData) + (1)) of [particledata v]) y: (item ((~getData) + (2)) of [particledata v])\n    replace item ((~getData) + (3)) of [particledata v] with ((item ((~getData) + (3)) of [particledata v]) - ((pick random (300) to (500)) * (#DeltaTime)))\n    set [brightness v] effect to ((-40) + ((item ((~getData) + (3)) of [particledata v]) * (1)))\n    set [ghost v] effect to ((50) + (((100) - (item ((~getData) + (3)) of [particledata v])) / (2)))\n    set [color v] effect to ((item ((~getData) + (3)) of [particledata v]) / (pick random (2) to (5)))\n    replace item ((~getData) + (2)) of [particledata v] with ((item ((~getData) + (2)) of [particledata v]) + ((240) * (#DeltaTime)))\n    replace item ((~getData) + (1)) of [particledata v] with ((item ((~getData) + (1)) of [particledata v]) + ((pick random (-20) to (20)) * (#DeltaTime)))\n    stamp\n    if <(item ((~getData) + (3)) of [particledata v]) < [0]> then\n        repeat (ParticleDataCount)\n            delete ((~getData) + (1)) of [particledata v]\n        end\n    end\n    change [~id v] by (-1)\nend\n\nwhen I receive [draw v]\nDraw\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n