Box Blaster - a platformer (100% pen!) v1.4
@Stage\n\n@Pen\n\nwhen flag clicked\nStart\nforever\n    Main\nend\n\ndefine Render\nerase all\nRender background\nRender arrows\nRender bullets\nRender player\nRender coins\nRender platforms\nRender particles\n Draw buttons\nif <(Scene) = [menu]> then\n    Menu\nend\n\ndefine Render background\nset pen color to (#e4f3ff)\nset pen size to (360)\ngo to x: (-240) y: (0)\npen down\ngo to x: (240) y: (0)\npen up\n\ndefine Render player\nset pen color to (#000000)\nset pen size to ((2) * (Zoom))\ngo to x: ((((Player X) - (Camera X)) + ((Player X size) / (-2))) * (Zoom)) y: ((((Player Y) - (Camera Y)) + ((Player Y size) / (-2))) * (Zoom))\npen down\ngo to x: ((((Player X) - (Camera X)) + ((Player X size) / (2))) * (Zoom)) y: ((((Player Y) - (Camera Y)) + ((Player Y size) / (-2))) * (Zoom))\ngo to x: ((((Player X) - (Camera X)) + ((Player X size) / (2))) * (Zoom)) y: ((((Player Y) - (Camera Y)) + ((Player Y size) / (2))) * (Zoom))\ngo to x: ((((Player X) - (Camera X)) + ((Player X size) / (-2))) * (Zoom)) y: ((((Player Y) - (Camera Y)) + ((Player Y size) / (2))) * (Zoom))\ngo to x: ((((Player X) - (Camera X)) + ((Player X size) / (-2))) * (Zoom)) y: ((((Player Y) - (Camera Y)) + ((Player Y size) / (-2))) * (Zoom))\npen up\n\ndefine Create horizontal platform X1 (x1) X2 (x2) Y (y) Type (type)\nadd (x1) to [horizontal x1 v]\nadd (x2) to [horizontal x2 v]\nadd (y) to [horizontal y v]\nadd (type) to [horizontal type v]\n\ndefine Render horizontal platform X1 (x1) X2 (x2) Y (y) Type (type)\nChoose platform colour (type)\nset pen size to ((4) * (Zoom))\ngo to x: (((x1) - (Camera X)) * (Zoom)) y: (((y) - (Camera Y)) * (Zoom))\npen down\ngo to x: (((x2) - (Camera X)) * (Zoom)) y: (((y) - (Camera Y)) * (Zoom))\npen up\n\ndefine Render platforms\nset [i v] to [0]\nrepeat (length of [horizontal x1 v])\n    change [i v] by (1)\n    Render horizontal platform X1 (item (i) of [horizontal x1 v]) X2 (item (i) of [horizontal x2 v]) Y (item (i) of [horizontal y v]) Type (item (i) of [horizontal type v])\nend\nset [i v] to [0]\nrepeat (length of [vertical y1 v])\n    change [i v] by (1)\n    Render vertical platform Y1 (item (i) of [vertical y1 v]) Y2 (item (i) of [vertical y2 v]) X (item (i) of [vertical x v]) Type (item (i) of [vertical type v])\nend\n\ndefine Reset map\ndelete all of [horizontal x1 v]\ndelete all of [horizontal x2 v]\ndelete all of [horizontal y v]\ndelete all of [horizontal type v]\ndelete all of [vertical y1 v]\ndelete all of [vertical y2 v]\ndelete all of [vertical x v]\ndelete all of [vertical type v]\ndelete all of [bullet lifespan v]\ndelete all of [bullet power v]\ndelete all of [bullet xv v]\ndelete all of [bullet yv v]\ndelete all of [bullet x v]\ndelete all of [bullet y v]\ndelete all of [arrow x1 v]\ndelete all of [arrow y1 v]\ndelete all of [arrow x2 v]\ndelete all of [arrow y2 v]\n\ndefine Create vertical platform Y1 (y1) Y2 (y2) X (x) Type (type)\nadd (y1) to [vertical y1 v]\nadd (y2) to [vertical y2 v]\nadd (x) to [vertical x v]\nadd (type) to [vertical type v]\n\ndefine Choose platform colour (type)\nif <(type) = [normal]> then\n    set pen color to (#000000)\nend\nif <(type) = [bad]> then\n    set pen color to (#ff0000)\nend\nif <(type) = [goal]> then\n    set pen color to (#33d200)\nend\nif <(type) = [sticky]> then\n    set pen color to (#c400de)\nend\n\ndefine Render vertical platform Y1 (y1) Y2 (y2) X (x) Type (type)\nChoose platform colour (type)\nset pen size to ((4) * (Zoom))\ngo to x: (((x) - (Camera X)) * (Zoom)) y: (((y1) - (Camera Y)) * (Zoom))\npen down\ngo to x: (((x) - (Camera X)) * (Zoom)) y: (((y2) - (Camera Y)) * (Zoom))\npen up\n\ndefine Main\nTick\nRender\n\ndefine Tick\nif <[30] < (Frames since level start)> then\n    set [zoom v] to ((((Zoom) - (1)) * (0.98)) + (1))\n    if <<(Frames since death) < [20]> and <[60] < (Frames since level start)>> then\n        change [camera x v] by (((Player X) - (Camera X)) * (0.07))\n        change [camera y v] by (((Player Y) - (Camera Y)) * (0.07))\n    else\n        change [camera x v] by (((Player X) - (Camera X)) * (0.3))\n        change [camera y v] by (((Player Y) - (Camera Y)) * (0.3))\n    end\nend\nif <<(Frames since level start) < [60]> and <[15] < (Frames since level start)>> then\n    change [camera x v] by (((Player X) - (Camera X)) * (0.01))\n    change [camera y v] by (((Player Y) - (Camera Y)) * (0.01))\nend\nchange [player x v] by (Player X Velocity)\nCheck for collisions\nif <(Colliding?) = [1]> then\n    change [player x v] by ((Player X Velocity) * (-1))\n    if <[collided with v] contains [sticky]?> then\n        set [player x velocity v] to [0]\n        set [player y velocity v] to ((Player Y Velocity) * (0.9))\n    else\n        set [player x velocity v] to ((Player X Velocity) * (-0.5))\n    end\nend\nchange [player y v] by (Player Y Velocity)\nCheck for special platforms\nCheck for collisions\nif <(Colliding?) = [1]> then\n    change [player y v] by ((Player Y Velocity) * (-1))\n    if <([abs v] of (Player Y Velocity) ) < [5]> then\n        set [player y velocity v] to [0]\n    else\n        if <[collided with v] contains [sticky]?> then\n            set [player y velocity v] to [0]\n            repeat (5)\n                New particle X ((Player X) + ((pick random ((-1) * (Player X size)) to (Player X size)) / (2))) Y ((Player Y) - ((Player Y size) / (2))) XV (pick random (-5) to (5)) YV (pick random (0) to (5)) Lifespan [20] Size [5] Colour [880088] Gravity [0.3] Resistance [0.98] Transparency [128]\n            end\n        else\n            set [player y velocity v] to ((Player Y Velocity) * (-0.65))\n            repeat (5)\n                New particle X ((Player X) + ((pick random ((-1) * (Player X size)) to (Player X size)) / (2))) Y ((Player Y) - ((Player Y size) / (2))) XV (pick random (-5) to (5)) YV (pick random (0) to (5)) Lifespan [20] Size [5] Colour [000000] Gravity [0.3] Resistance [0.98] Transparency [128]\n            end\n        end\n    end\n    set [player x velocity v] to ((Player X Velocity) * (0.9))\n    set [last touched ground v] to [0]\n    if <[collided with v] contains [sticky]?> then\n        set [player x velocity v] to ((Player X Velocity) * (0.9))\n    end\nelse\n    if <not <[collided with v] contains [sticky]?>> then\n        change [player y velocity v] by (-0.7)\n    end\n    if <[5] < (Last touched ground)> then\n        set [player x velocity v] to ((Player X Velocity) * (0.98))\n    else\n        set [player x velocity v] to ((Player X Velocity) * (0.9))\n    end\n    change [last touched ground v] by (1)\nend\nCheck for special platforms\nchange [last fired bullet v] by (1)\nchange [frames since death v] by (1)\nchange [frames since level start v] by (1)\nMouse\nUpdate bullets\nTick particles\nTick coins\n\ndefine Start\nhide\nReset camera\nReset player\nReset particles\nset [scene v] to [menu]\nset [level v] to [1]\nset [frames since level start v] to [0]\nset [zoom v] to [0.25]\nset [coins spawned? v] to [0]\nReset coins\nRefresh level\n\ndefine Reset player\nset [player x size v] to [40]\nset [player y size v] to [40]\nset [player x v] to [0]\nset [player y v] to [0]\nset [player x velocity v] to [0]\nset [player y velocity v] to [0]\n\ndefine Check for collisions\ndelete all of [collided with v]\nset [colliding? v] to [0]\nset [i v] to [0]\nrepeat (length of [horizontal x1 v])\n    change [i v] by (1)\n    if <<<((Player Y) + ((Player Y size) / (2))) > (item (i) of [horizontal y v])> and <(item (i) of [horizontal y v]) > ((Player Y) - ((Player Y size) / (2)))>> and <<((Player X) + ((Player X size) / (2))) > (item (i) of [horizontal x1 v])> and <(item (i) of [horizontal x2 v]) > ((Player X) - ((Player X size) / (2)))>>> then\n        set [colliding? v] to [1]\n        add (item (i) of [horizontal type v]) to [collided with v]\n    end\nend\nset [i v] to [0]\nrepeat (length of [vertical y1 v])\n    change [i v] by (1)\n    if <<<((Player X) + ((Player X size) / (2))) > (item (i) of [vertical x v])> and <(item (i) of [vertical x v]) > ((Player X) - ((Player X size) / (2)))>> and <<((Player Y) + ((Player Y size) / (2))) > (item (i) of [vertical y1 v])> and <(item (i) of [vertical y2 v]) > ((Player Y) - ((Player Y size) / (2)))>>> then\n        set [colliding? v] to [1]\n        add (item (i) of [vertical type v]) to [collided with v]\n    end\nend\n\ndefine New bullet X (x) Y (y) XV (xv) YV (yv) Power (power) Lifespan (lifespan)\nadd (x) to [bullet x v]\nadd (y) to [bullet y v]\nadd (xv) to [bullet xv v]\nadd (yv) to [bullet yv v]\nadd (power) to [bullet power v]\nadd (lifespan) to [bullet lifespan v]\n\ndefine Render bullets\nset [i v] to [0]\nrepeat (length of [bullet x v])\n    change [i v] by (1)\n    Go to X (item (i) of [bullet x v]) Y (item (i) of [bullet y v])\n    set pen color to (((round ((64) * ((item (i) of [bullet lifespan v]) / (60)))) * (16777216)) + (join [0x] [FF8800]))\n    set pen size to ((9) * (Zoom))\n    pen down\n    pen up\n    set pen color to (((round ((255) * ((item (i) of [bullet lifespan v]) / (60)))) * (16777216)) + (join [0x] [FF8800]))\n    set pen size to ((7.5) * (Zoom))\n    pen down\n    pen up\nend\n\ndefine Go to X (x) Y (y)\ngo to x: (((x) - (Camera X)) * (Zoom)) y: (((y) - (Camera Y)) * (Zoom))\n\ndefine Update bullets\ndelete all of [bullets to destroy v]\nset [i v] to [0]\nrepeat (length of [bullet x v])\n    change [i v] by (1)\n    replace item (i) of [bullet lifespan v] with ((item (i) of [bullet lifespan v]) - (1))\n    if <(item (i) of [bullet lifespan v]) < [1]> then\n        add (i) to [bullets to destroy v]\n    end\n    set [old x v] to (item (i) of [bullet x v])\n    set [old y v] to (item (i) of [bullet y v])\n    replace item (i) of [bullet x v] with ((item (i) of [bullet x v]) + (item (i) of [bullet xv v]))\n    replace item (i) of [bullet y v] with ((item (i) of [bullet y v]) + (item (i) of [bullet yv v]))\n    set [new x v] to (item (i) of [bullet x v])\n    set [new y v] to (item (i) of [bullet y v])\n    set [ii v] to [0]\n    repeat (length of [horizontal x1 v])\n        change [ii v] by (1)\n        if <<<(New Y) < (item (ii) of [horizontal y v])> and <(item (ii) of [horizontal y v]) < (Old Y)>> or <<(Old Y) < (item (ii) of [horizontal y v])> and <(item (ii) of [horizontal y v]) < (New Y)>>> then\n            set [temp v] to (((((Old Y) - (item (ii) of [horizontal y v])) / ((Old Y) - (New Y))) * ((Old X) - (New X))) + (New X))\n            if <<(item (ii) of [horizontal x1 v]) < (Temp)> and <(Temp) < (item (ii) of [horizontal x2 v])>> then\n                add (i) to [bullets to destroy v]\n                Explosion X (item (i) of [bullet x v]) Y (item (i) of [bullet y v]) Power (item (i) of [bullet power v])\n            end\n        end\n    end\n    set [ii v] to [0]\n    repeat (length of [vertical y1 v])\n        change [ii v] by (1)\n        if <<<(New X) < (item (ii) of [vertical x v])> and <(item (ii) of [vertical x v]) < (Old X)>> or <<(Old X) < (item (ii) of [vertical x v])> and <(item (ii) of [vertical x v]) < (New X)>>> then\n            set [temp v] to (((((New X) - (item (ii) of [vertical x v])) / ((Old X) - (New X))) * ((Old Y) - (New Y))) + (New Y))\n            if <<(item (ii) of [vertical y1 v]) < (Temp)> and <(Temp) < (item (ii) of [vertical y2 v])>> then\n                add (i) to [bullets to destroy v]\n                Explosion X (item (i) of [bullet x v]) Y (item (i) of [bullet y v]) Power (item (i) of [bullet power v])\n            end\n        end\n    end\nend\nset [i v] to (length of [bullets to destroy v])\nrepeat (length of [bullets to destroy v])\n    delete (item (i) of [bullets to destroy v]) of [bullet lifespan v]\n    delete (item (i) of [bullets to destroy v]) of [bullet power v]\n    delete (item (i) of [bullets to destroy v]) of [bullet x v]\n    delete (item (i) of [bullets to destroy v]) of [bullet xv v]\n    delete (item (i) of [bullets to destroy v]) of [bullet y v]\n    delete (item (i) of [bullets to destroy v]) of [bullet yv v]\n    change [i v] by (-1)\nend\n\ndefine Explosion X (x) Y (y) Power (power)\nset [temp v] to (((((Player X) - (x)) * ((Player X) - (x))) + (((Player Y) - (y)) * ((Player Y) - (y)))) + (100))\nchange [player x velocity v] by (((Player X) - (x)) * ((power) / (Temp)))\nchange [player y velocity v] by (((Player Y) - (y)) * ((power) / (Temp)))\nNew particle X (x) Y (y) XV [0] YV [0] Lifespan [10] Size [30] Colour [FF8800] Gravity [0] Resistance [0] Transparency [64]\nrepeat (10)\n    set [temp v] to (pick random (0) to (360))\n    New particle X (x) Y (y) XV (([sin v] of (Temp) ) * (pick random (1) to (10))) YV (([cos v] of (Temp) ) * (pick random (1) to (10))) Lifespan [10] Size (pick random (3) to (9)) Colour [FF2200] Gravity [0.5] Resistance [0.99] Transparency [64]\nend\n\ndefine New particle X (x) Y (y) XV (xv) YV (yv) Lifespan (lifespan) Size (size) Colour (colour) Gravity (gravity) Resistance (resistance) Transparency (transparency)\nadd (x) to [particle x v]\nadd (y) to [particle y v]\nadd (xv) to [particle xv v]\nadd (yv) to [particle yv v]\nadd (lifespan) to [particle lifespan v]\nadd (size) to [particle size v]\nadd (colour) to [particle colour v]\nadd (gravity) to [particle gravity v]\nadd (resistance) to [particle resistance v]\nadd (lifespan) to [particle lifespan left v]\nadd (transparency) to [particle transparency v]\n\ndefine Render particles\nset [i v] to [0]\nrepeat (length of [particle x v])\n    change [i v] by (1)\n    Go to X (item (i) of [particle x v]) Y (item (i) of [particle y v])\n    set pen color to (((round ((item (i) of [particle transparency v]) * ((item (i) of [particle lifespan left v]) / (item (i) of [particle lifespan v])))) * (16777216)) + (join [0x] (item (i) of [particle colour v])))\n    set pen size to ((item (i) of [particle size v]) * (Zoom))\n    pen down\n    pen up\nend\n\ndefine Delete particle (i)\ndelete (i) of [particle colour v]\ndelete (i) of [particle gravity v]\ndelete (i) of [particle lifespan v]\ndelete (i) of [particle lifespan left v]\ndelete (i) of [particle resistance v]\ndelete (i) of [particle size v]\ndelete (i) of [particle transparency v]\ndelete (i) of [particle x v]\ndelete (i) of [particle xv v]\ndelete (i) of [particle y v]\ndelete (i) of [particle yv v]\n\ndefine Tick particles\nset [i v] to (length of [particle size v])\nrepeat (length of [particle size v])\n    replace item (i) of [particle x v] with ((item (i) of [particle xv v]) + (item (i) of [particle x v]))\n    replace item (i) of [particle y v] with ((item (i) of [particle yv v]) + (item (i) of [particle y v]))\n    replace item (i) of [particle xv v] with ((item (i) of [particle resistance v]) * (item (i) of [particle xv v]))\n    replace item (i) of [particle yv v] with ((item (i) of [particle resistance v]) * (item (i) of [particle yv v]))\n    replace item (i) of [particle yv v] with ((item (i) of [particle yv v]) - (item (i) of [particle gravity v]))\n    replace item (i) of [particle lifespan left v] with ((item (i) of [particle lifespan left v]) - (1))\n    if <(item (i) of [particle lifespan left v]) < [1]> then\n        Delete particle (i)\n    end\n    change [i v] by (-1)\nend\n\ndefine Die\nstart sound [Die v]\nrepeat (45)\n    set [temp v] to (pick random (0) to (360))\n    New particle X (Player X) Y (Player Y) XV (([sin v] of (Temp) ) * (pick random (1) to (10))) YV (([cos v] of (Temp) ) * (pick random (1) to (10))) Lifespan (pick random (5) to (20)) Size (pick random (1) to (10)) Colour [000000] Gravity [0.5] Resistance [0.99] Transparency [64]\nend\nset [frames since death v] to [0]\nReset player\nRefresh level\n\ndefine Level 1\nCreate horizontal platform X1 [-50] X2 [550] Y [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [0] X [100] Type [bad]\nCreate vertical platform Y1 [-50] Y2 [200] X [-50] Type [normal]\nCreate horizontal platform X1 [-50] X2 [550] Y [200] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [200] X [550] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [250] Y [50]\nend\n\ndefine Reset particles\ndelete all of [particle colour v]\ndelete all of [particle gravity v]\ndelete all of [particle lifespan v]\ndelete all of [particle lifespan left v]\ndelete all of [particle resistance v]\ndelete all of [particle size v]\ndelete all of [particle x v]\ndelete all of [particle y v]\ndelete all of [particle xv v]\ndelete all of [particle yv v]\ndelete all of [particle transparency v]\n\ndefine Reset camera\nset [zoom v] to [1]\nset [camera x v] to [0]\nset [camera y v] to [0]\n\ndefine Check for special platforms\nif <[collided with v] contains [goal]?> then\n    change [level v] by (1)\n    set [coins spawned? v] to [0]\n    Reset coins\n    Reset camera\n    Reset player\n    Refresh level\n    Reset particles\n    set [zoom v] to [0.25]\n    set [frames since level start v] to [0]\n    start sound [Win v]\nelse\n    if <<[collided with v] contains [bad]?> and <not <[collided with v] contains [normal]?>>> then\n        Die\n    end\nend\n\ndefine Refresh level\nReset map\nif <(Level) = [1]> then\n    Level 1\nend\nif <(Level) = [2]> then\n    Level 2\nend\nif <(Level) = [3]> then\n    Level 3\nend\nif <(Level) = [4]> then\n    Level 4\nend\nif <(Level) = [5]> then\n    Level 5\nend\nif <(Level) = [6]> then\n    Level 6\nend\nif <(Level) = [7]> then\n    Level 7\nend\nif <(Level) = [8]> then\n    Level 8\nend\nif <(Level) = [9]> then\n    Level 9\nend\nif <(Level) = [10]> then\n    Level 10\nend\nif <(Level) = [11]> then\n    Level 11\nend\nif <(Level) = [12]> then\n    Level 12\nend\nif <(Level) = [13]> then\n    Level 13\nend\nif <(Level) = [14]> then\n    set [level v] to [1]\n    set [scene v] to [menu]\n    Refresh level\nend\n\ndefine Level 2\nCreate horizontal platform X1 [-100] X2 [100] Y [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [450] X [-100] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [250] X [100] Type [normal]\nCreate horizontal platform X1 [-100] X2 [200] Y [450] Type [normal]\nCreate horizontal platform X1 [100] X2 [200] Y [250] Type [normal]\nCreate vertical platform Y1 [250] Y2 [450] X [200] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [50] Y [400]\nend\n\ndefine Level 4\nCreate horizontal platform X1 [-50] X2 [150] Y [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [250] X [-50] Type [normal]\nCreate horizontal platform X1 [150] X2 [500] Y [-50] Type [bad]\nCreate horizontal platform X1 [-50] X2 [600] Y [250] Type [normal]\nCreate horizontal platform X1 [500] X2 [600] Y [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [250] X [600] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [200] Y [100]\n    Create coin X [400] Y [100]\nend\n\ndefine Level 6\nCreate horizontal platform X1 [-50] X2 [50] Y [-50] Type [normal]\nCreate horizontal platform X1 [50] X2 [150] Y [50] Type [normal]\nCreate horizontal platform X1 [150] X2 [250] Y [150] Type [normal]\nCreate horizontal platform X1 [250] X2 [350] Y [250] Type [normal]\nCreate horizontal platform X1 [-50] X2 [50] Y [150] Type [normal]\nCreate horizontal platform X1 [50] X2 [150] Y [250] Type [normal]\nCreate horizontal platform X1 [150] X2 [350] Y [350] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [150] X [-50] Type [bad]\nCreate vertical platform Y1 [-50] Y2 [50] X [50] Type [bad]\nCreate vertical platform Y1 [50] Y2 [150] X [150] Type [bad]\nCreate vertical platform Y1 [150] Y2 [250] X [50] Type [bad]\nCreate vertical platform Y1 [150] Y2 [250] X [250] Type [bad]\nCreate vertical platform Y1 [250] Y2 [350] X [150] Type [bad]\nCreate vertical platform Y1 [250] Y2 [350] X [350] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\nend\n\ndefine Create coin X (x) Y (y)\nadd (x) to [coin x v]\nadd (y) to [coin y v]\n\ndefine Render coins\nset [i v] to [0]\nrepeat (length of [coin x v])\n    change [i v] by (1)\n    Go to X (item (i) of [coin x v]) Y (item (i) of [coin y v])\n    set pen color to (#000000)\n    set pen size to ((16) * (Zoom))\n    pen down\n    pen up\n    set pen color to (#ffc816)\n    if <[0.4] < (Zoom)> then\n        set pen size to ((12) * (Zoom))\n    else\n        set pen size to ((8) * (Zoom))\n    end\n    pen down\n    pen up\nend\n\ndefine Tick coins\nset [i v] to (length of [coin x v])\nrepeat (length of [coin x v])\n    if <<<(item (i) of [coin x v]) > ((Player X) - (((Player X size) / (2)) + (12)))> and <(item (i) of [coin x v]) < ((Player X) + (((Player X size) / (2)) + (12)))>> and <<(item (i) of [coin y v]) > ((Player Y) - (((Player Y size) / (2)) + (12)))> and <(item (i) of [coin y v]) < ((Player Y) + (((Player Y size) / (2)) + (12)))>>> then\n        repeat (45)\n            set [temp v] to (pick random (0) to (360))\n            set [ii v] to (pick random (1) to (7))\n            New particle X (Player X) Y (Player Y) XV (([sin v] of (Temp) ) * (ii)) YV (([cos v] of (Temp) ) * (ii)) Lifespan (pick random (5) to (40)) Size (pick random (1) to (5)) Colour [FFAA00] Gravity [0.1] Resistance [0.99] Transparency [128]\n        end\n        delete (i) of [coin x v]\n        delete (i) of [coin y v]\n        start sound [Coin v]\n    end\n    change [i v] by (-1)\nend\n\ndefine Reset coins\ndelete all of [coin x v]\ndelete all of [coin y v]\n\ndefine Level 8\nCreate horizontal platform X1 [-50] X2 [100] Y [-50] Type [normal]\nCreate horizontal platform X1 [-50] X2 [400] Y [200] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [200] X [-50] Type [normal]\nCreate vertical platform Y1 [-450] Y2 [-50] X [100] Type [normal]\nCreate horizontal platform X1 [100] X2 [250] Y [-50] Type [bad]\nCreate horizontal platform X1 [250] X2 [400] Y [-300] Type [bad]\nCreate horizontal platform X1 [100] X2 [400] Y [-450] Type [goal]\nCreate vertical platform Y1 [-450] Y2 [200] X [400] Type [normal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [250] Y [-125]\nend\n\ndefine Level 9\nCreate horizontal platform X1 [-50] X2 [50] Y [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [950] X [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [800] X [50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [950] X [150] Type [normal]\nCreate horizontal platform X1 [-50] X2 [150] Y [950] Type [bad]\nCreate horizontal platform X1 [125] X2 [150] Y [450] Type [bad]\nCreate horizontal platform X1 [50] X2 [150] Y [-50] Type [goal]\nCreate arrow X1 [-25] Y1 [0] X2 [25] Y2 [50]\nCreate arrow X1 [25] Y1 [100] X2 [-25] Y2 [150]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    set [camera y v] to [850]\nend\n\ndefine Level 3\nCreate horizontal platform X1 [-150] X2 [250] Y [-150] Type [normal]\nCreate horizontal platform X1 [-50] X2 [150] Y [-50] Type [normal]\nCreate horizontal platform X1 [-50] X2 [50] Y [50] Type [normal]\nCreate horizontal platform X1 [-150] X2 [150] Y [150] Type [normal]\nCreate horizontal platform X1 [-150] X2 [150] Y [250] Type [normal]\nCreate horizontal platform X1 [150] X2 [250] Y [350] Type [normal]\nCreate vertical platform Y1 [-150] Y2 [150] X [-150] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [50] X [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [150] X [150] Type [normal]\nCreate vertical platform Y1 [250] Y2 [350] X [150] Type [normal]\nCreate vertical platform Y1 [-150] Y2 [350] X [250] Type [normal]\nCreate vertical platform Y1 [150] Y2 [250] X [-150] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [200] Y [300]\nend\n\ndefine Level 5\nCreate horizontal platform X1 [-50] X2 [50] Y [-50] Type [normal]\nCreate horizontal platform X1 [50] X2 [150] Y [50] Type [normal]\nCreate horizontal platform X1 [150] X2 [250] Y [150] Type [normal]\nCreate horizontal platform X1 [250] X2 [350] Y [250] Type [normal]\nCreate horizontal platform X1 [-50] X2 [50] Y [150] Type [normal]\nCreate horizontal platform X1 [50] X2 [150] Y [250] Type [normal]\nCreate horizontal platform X1 [150] X2 [350] Y [350] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [150] X [-50] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [50] X [50] Type [normal]\nCreate vertical platform Y1 [50] Y2 [150] X [150] Type [normal]\nCreate vertical platform Y1 [150] Y2 [250] X [50] Type [normal]\nCreate vertical platform Y1 [150] Y2 [250] X [250] Type [normal]\nCreate vertical platform Y1 [250] Y2 [350] X [150] Type [normal]\nCreate vertical platform Y1 [250] Y2 [350] X [350] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\nend\n\ndefine Level 7\nCreate horizontal platform X1 [-50] X2 [100] Y [-50] Type [normal]\nCreate horizontal platform X1 [-50] X2 [400] Y [100] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [100] X [-50] Type [normal]\nCreate vertical platform Y1 [-450] Y2 [-50] X [100] Type [normal]\nCreate vertical platform Y1 [-450] Y2 [100] X [400] Type [normal]\nCreate horizontal platform X1 [100] X2 [250] Y [-50] Type [normal]\nCreate horizontal platform X1 [250] X2 [400] Y [-300] Type [bad]\nCreate horizontal platform X1 [100] X2 [400] Y [-450] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [250] Y [-125]\nend\n\ndefine Level 11\nCreate horizontal platform X1 [-50] X2 [50] Y [-50] Type [normal]\nCreate horizontal platform X1 [50] X2 [550] Y [-50] Type [bad]\nCreate horizontal platform X1 [-50] X2 [650] Y [50] Type [sticky]\nCreate vertical platform Y1 [-50] Y2 [50] X [650] Type [normal]\nCreate vertical platform Y1 [-50] Y2 [50] X [-50] Type [normal]\nCreate horizontal platform X1 [550] X2 [650] Y [-50] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\nend\n\ndefine Level 10\nCreate horizontal platform X1 [-150] X2 [250] Y [-150] Type [sticky]\nCreate horizontal platform X1 [-50] X2 [150] Y [-50] Type [sticky]\nCreate horizontal platform X1 [-50] X2 [50] Y [50] Type [sticky]\nCreate horizontal platform X1 [-150] X2 [150] Y [150] Type [sticky]\nCreate horizontal platform X1 [-150] X2 [150] Y [250] Type [sticky]\nCreate horizontal platform X1 [150] X2 [250] Y [350] Type [sticky]\nCreate vertical platform Y1 [-150] Y2 [150] X [-150] Type [sticky]\nCreate vertical platform Y1 [-50] Y2 [50] X [-50] Type [sticky]\nCreate vertical platform Y1 [-50] Y2 [150] X [150] Type [sticky]\nCreate vertical platform Y1 [250] Y2 [350] X [150] Type [sticky]\nCreate vertical platform Y1 [-150] Y2 [350] X [250] Type [sticky]\nCreate vertical platform Y1 [150] Y2 [250] X [-150] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\n    Create coin X [200] Y [300]\nend\n\ndefine Menu\nset pen color to (join [0x] [BB000000])\nset pen size to (0)\ngo to x: (-240) y: (0)\npen down\nset pen size to (360)\ngo to x: (240) y: (0)\npen up\ngo to x: (40) y: (0)\nset pen color to (join [0x] [FFFFFF])\nset pen size to (10)\npen down\ngo to x: (-30) y: (40)\ngo to x: (-30) y: (-40)\ngo to x: (40) y: (0)\npen up\ngo to x: (0) y: (0)\nset pen size to (50)\npen down\npen up\nset pen size to (20)\ngo to x: (-20) y: (25)\npen down\ngo to x: (-20) y: (-25)\ngo to x: (20) y: (0)\npen up\n\ndefine Mouse\nif <(Scene) = [menu]> then\n    if <<not <mouse down?>> and <(Previous mouse state) = [true]>> then\n        set [scene v] to [game]\n    end\nelse\n    if <<not <mouse down?>> and <(Previous mouse state) = [true]>> then\n        if <((((210) - (mouse x)) * ((210) - (mouse x))) + (((150) - (mouse y)) * ((150) - (mouse y)))) < [169]> then\n            change [level v] by (1)\n            set [coins spawned? v] to [0]\n            Reset coins\n            Reset camera\n            Reset player\n            Refresh level\n            Reset particles\n            set [zoom v] to [0.25]\n            set [frames since level start v] to [0]\n            set [previous mouse state v] to <mouse down?>\n            stop [this script v]\n        end\n        if <((((180) - (mouse x)) * ((180) - (mouse x))) + (((150) - (mouse y)) * ((150) - (mouse y)))) < [169]> then\n            change [level v] by (-1)\n            if <(Level) = [0]> then\n                set [level v] to [1]\n            end\n            set [coins spawned? v] to [0]\n            Reset coins\n            Reset camera\n            Reset player\n            Refresh level\n            Reset particles\n            set [zoom v] to [0.25]\n            set [frames since level start v] to [0]\n            set [previous mouse state v] to <mouse down?>\n            stop [this script v]\n        end\n    end\n    if <<<mouse down?> or <key (space v) pressed?>> and <[3] < (Last fired bullet)>> then\n        set [temp v] to ([sqrt v] of (((mouse x) * (mouse x)) + ((mouse y) * (mouse y))) )\n        New bullet X (Player X) Y (Player Y) XV ((mouse x) * ((5) / (Temp))) YV ((mouse y) * ((5) / (Temp))) Power [250] Lifespan [60]\n        change [player x velocity v] by ((mouse x) * ((-1) / (Temp)))\n        change [player y velocity v] by ((mouse y) * ((-1) / (Temp)))\n        set [last fired bullet v] to [0]\n        start sound [Shoot v]\n    end\nend\nset [previous mouse state v] to <mouse down?>\n\ndefine Create arrow X1 (x1) Y1 (y1) X2 (x2) Y2 (y2)\nadd (x1) to [arrow x1 v]\nadd (y1) to [arrow y1 v]\nadd (x2) to [arrow x2 v]\nadd (y2) to [arrow y2 v]\n\ndefine Render arrows\nset [i v] to [0]\nrepeat (length of [arrow x1 v])\n    change [i v] by (1)\n    Go to X (item (i) of [arrow x1 v]) Y (item (i) of [arrow y1 v])\n    set pen size to ((5) * (Zoom))\n    set pen color to (#d1d4e0)\n    pen down\n    Go to X (item (i) of [arrow x2 v]) Y (item (i) of [arrow y2 v])\n    set [temp v] to ([sqrt v] of ((((item (i) of [arrow x2 v]) - (item (i) of [arrow x1 v])) * ((item (i) of [arrow x2 v]) - (item (i) of [arrow x1 v]))) + (((item (i) of [arrow y2 v]) - (item (i) of [arrow y1 v])) * ((item (i) of [arrow y2 v]) - (item (i) of [arrow y1 v])))) )\n    set [new x v] to (((item (i) of [arrow x2 v]) - (item (i) of [arrow x1 v])) * ((40) / (Temp)))\n    set [new y v] to (((item (i) of [arrow y2 v]) - (item (i) of [arrow y1 v])) * ((40) / (Temp)))\n    Go to X ((item (i) of [arrow x2 v]) + (((New Y) - (New X)) / (2))) Y ((item (i) of [arrow y2 v]) - (((New X) + (New Y)) / (2)))\n    Go to X (item (i) of [arrow x2 v]) Y (item (i) of [arrow y2 v])\n    Go to X ((item (i) of [arrow x2 v]) - (((New X) + (New Y)) / (2))) Y ((item (i) of [arrow y2 v]) + (((New X) - (New Y)) / (2)))\n    pen up\nend\n\nwhen flag clicked\nforever\n    play sound [Rock It v] until done\nend\n\ndefine Level 12\nset [player y v] to [-150]\nCreate horizontal platform X1 [-200] X2 [200] Y [-300] Type [bad]\nCreate horizontal platform X1 [-200] X2 [200] Y [300] Type [bad]\nCreate vertical platform Y1 [-300] Y2 [300] X [-200] Type [bad]\nCreate vertical platform Y1 [-300] Y2 [300] X [200] Type [bad]\nCreate horizontal platform X1 [-100] X2 [100] Y [-200] Type [normal]\nCreate horizontal platform X1 [-80] X2 [80] Y [-100] Type [normal]\nCreate horizontal platform X1 [-60] X2 [60] Y [0] Type [normal]\nCreate horizontal platform X1 [-40] X2 [40] Y [100] Type [normal]\nCreate vertical platform Y1 [110] Y2 [150] X [0] Type [goal]\nif <(Coins Spawned?) = [0]> then\n    Create coin X [125] Y [200]\n    set [coins spawned? v] to [1]\nend\n\ndefine Level 13\nCreate horizontal platform X1 [-50] X2 [150] Y [-50] Type [sticky]\nCreate vertical platform Y1 [-50] Y2 [250] X [-50] Type [sticky]\nCreate horizontal platform X1 [-50] X2 [550] Y [250] Type [sticky]\nCreate vertical platform Y1 [-50] Y2 [250] X [550] Type [goal]\nCreate horizontal platform X1 [150] X2 [350] Y [150] Type [bad]\nCreate vertical platform Y1 [-50] Y2 [150] X [150] Type [bad]\nCreate vertical platform Y1 [-50] Y2 [150] X [350] Type [bad]\nCreate horizontal platform X1 [350] X2 [550] Y [-50] Type [sticky]\nif <(Coins Spawned?) = [0]> then\n    set [coins spawned? v] to [1]\nend\n\ndefine  Draw buttons\ngo to x: (210) y: (150)\nset pen color to (join [0x] [000000])\nset pen size to (25)\npen down\npen up\nset pen color to (join [0x] [FFFFFF])\nset pen size to (20)\npen down\npen up\ngo to x: (205) y: (150)\nset pen color to (join [0x] [000000])\nset pen size to (2)\npen down\ngo to x: (215) y: (150)\ngo to x: (212) y: (153)\ngo to x: (215) y: (150)\ngo to x: (212) y: (147)\npen up\ngo to x: (180) y: (150)\nset pen color to (join [0x] [000000])\nset pen size to (25)\npen down\npen up\nset pen color to (join [0x] [FFFFFF])\nset pen size to (20)\npen down\npen up\ngo to x: (185) y: (150)\nset pen color to (join [0x] [000000])\nset pen size to (2)\npen down\ngo to x: (175) y: (150)\ngo to x: (178) y: (153)\ngo to x: (175) y: (150)\ngo to x: (178) y: (147)\npen up\n\n@Thumbnail\n\ngo to x: (0) y: (0)\nshow\n\nwhen flag clicked\nhide\n\n