Sky Islands Platformer Final

Instructions: Have Fun :D\nWASD or Arrows to move \nWorks on Mobile\nYOU HAVE TO HIT THE BOSS 3 TIMES OR MORE\n

@Stage\n\n@player\n\ndefine Check Player Touching\nif <touching (next v)?> then\n    broadcast (Complete level v)\n    Reset Player Position\nend\nif <<<touching (no v)?> or <touching (lava/spikes v)?>> or <touching (enemies v)?>> then\n    set [player speed y v] to [10]\nend\nif <<<touching (no v)?> or <touching (lava/spikes v)?>> or <touching (enemies v)?>> then\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    Reset Player Position\nend\n\ndefine Reset Player Position\nclear graphic effects\ngo to x: (-123) y: (-10)\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nReset Player Position\nset [force walk v] to [3]\nset [force gravity v] to [-1.5]\nset [force jump v] to [17]\nset [player speed x v] to [0]\nforever\n    Check Player Gravity\n    Check Player Walk\n    Check Player Touching\nend\n\ndefine Check Player Walk\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    set rotation style [left-right v]\n    point in direction (-90)\n    change [player speed x v] by ((-1) * (FORCE WALK))\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    set rotation style [left-right v]\n    point in direction (90)\n    change [player speed x v] by ((1) * (FORCE WALK))\nend\nif <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>> then\n    switch costume to (costume2 v)\nelse\n    switch costume to (costume3 v)\nend\nset [player speed x v] to ((Player Speed X) * (0.7))\nchange x by (Player Speed X)\nif <(Player Speed X) > [0]> then\n    move out [-1] [0]\nelse\n    move out [1] [0]\nend\n\ndefine Check Player Gravity\nchange [player speed y v] by (FORCE GRAVITY)\nchange y by (Player Speed Y)\nif <touching (levels v)?> then\n    if <(Player Speed Y) > [0]> then\n        move out [0] [-1]\n        set [player speed y v] to [0]\n    else\n        move out [0] [1]\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [player speed y v] to (FORCE JUMP)\n        else\n            set [player speed y v] to [0]\n        end\n    end\nend\n\ndefine move out (dx) (dy)\nrepeat until <not <touching (levels v)?>>\n    change x by (dx)\n    change y by (dy)\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\n\nwhen I start as a clone\nset [ghost v] effect to (70)\nrepeat (4)\n    change [ghost v] effect by (5)\n    wait (0.001) seconds\nend\ndelete this clone\n\nwhen [n v] key pressed\nbroadcast (Complete level v)\n\nwhen flag clicked\nswitch costume to (costume3 v)\n\n@Levels\n\nwhen I receive [complete level v]\nnext costume\nchange [level v] by (1)\n\nwhen flag clicked\nswitch costume to (level1 v)\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    if <(Level) = [17]> then\n        broadcast (FIN v)\n    end\nend\n\n@Lava/Spikes\n\nwhen I receive [complete level v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\n@Next\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [complete level v]\nnext costume\n\n@Text\n\nwhen I receive [complete level v]\nnext costume\n\nwhen flag clicked\nswitch costume to (level1 v)\n\n@Skip\n\nwhen flag clicked\ngo to x: (-185) y: (-136)\n\nwhen this sprite clicked\nbroadcast (Complete level v)\n\n@NO\n\n@enemies\n\ndefine Gravity (gravity) Jump Height (jump height) Speed (speed) Friction (friction) Slope (slope)\nchange [yv v] by (gravity)\nchange y by (yv)\nif <touching (levels v)?> then\n    repeat until <not <touching (levels v)?>>\n        change y by ((([abs v] of (yv) ) / (yv)) * (-1))\n    end\n    set [yv v] to (<<(y position) < (([x position v] of [player v]) - (25))> and <(([abs v] of (YV) ) / (YV)) = [-1]>> * (jump height))\nend\nset [xv v] to (((xv) + ((<(x position) > ([x position v] of [player v])> * ((speed) * (-1))) + (<(x position) < ([x position v] of [link v])> * (speed)))) * (friction))\nchange x by (xv)\nset [enemy - slope v] to [0]\nrepeat until <<(Enemy - Slope) = ((slope) * (-1))> or <not <touching (levels v)?>>>\n    change y by (1)\n    change [enemy - slope v] by (-1)\nend\nif <touching (levels v)?> then\n    change y by (Enemy - Slope)\n    repeat until <not <touching (levels v)?>>\n        change x by ((([abs v] of (xv) ) / (xv)) * (-1))\n    end\nend\npoint towards (player v)\nif <(y position) < [-180]> then\n    delete this clone\nend\n\nwhen I receive [complete level v]\nrepeat (1)\n    delete this clone\nend\nrepeat (13)\n    move (0) steps\nend\nif <(Level) = [5]> then\n    Clone at [120] [-80]\nelse\n    if <(Level) = [8]> then\n        Clone at [90] [-80]\n        Clone at [140] [-80]\n        Clone at [200] [-80]\n    else\n        if <(Level) = [11]> then\n            Clone at [150] [-80]\n            Clone at [-127] [86]\n            Clone at [-50] [86]\n            Clone at [50] [86]\n            Clone at [120] [86]\n        else\n            if <(Level) = [12]> then\n                Clone at [-20] [98]\n                Clone at [220] [-85]\n                Clone at [150] [-85]\n                Clone at [50] [-85]\n            else\n                if <(Level) = [9]> then\n                    Clone at [215] [-80]\n                end\n            end\n        end\n    end\nend\n\ndefine Clone at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nforever\n    if <not <(Switch In Progress) = [yes]>> then\n        Gravity [-1] Jump Height [10] Speed [0.5] Friction [.75] Slope [2]\n    end\nend\n\nwhen I receive [death v]\nrepeat (1)\n    delete this clone\nend\nif <(Level) = [5]> then\n    Clone at [150] [-80]\nelse\n    if <(Level) = [8]> then\n        Clone at [90] [-80]\n        Clone at [140] [-80]\n        Clone at [200] [-80]\n    else\n        if <(Level) = [11]> then\n            Clone at [150] [-80]\n            Clone at [-127] [86]\n            Clone at [-50] [86]\n            Clone at [50] [86]\n            Clone at [120] [86]\n        else\n            if <(Level) = [12]> then\n                Clone at [-20] [98]\n                Clone at [220] [-85]\n                Clone at [150] [-85]\n                Clone at [50] [-85]\n            else\n                if <(Level) = [14]> then\n                    Clone at [215] [-80]\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<not <([costume # v] of [sword v]) = [1]>> and <touching (sword v)?>> then\n        start sound [Hit v]\n        set [slime x v] to (x position)\n        set [slime y v] to (y position)\n        broadcast (Slime Death v)\n        delete this clone\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\n@Sword\n\nwhen flag clicked\nswitch costume to (lightsaber1 v)\nforever\n    go to (player v)\n    if <touching (player v)?> then\n        go [backward v] (1) layers\n    else\n        go to [front v] layer\n    end\nend\n\nwhen flag clicked\nforever\n    if <([direction v] of [player v]) = [90]> then\n        change x by (34)\n        change y by (-17)\n        set rotation style [left-right v]\n        point in direction (90)\n    end\n    if <([direction v] of [player v]) = [-90]> then\n        change x by (-34)\n        change y by (-17)\n        set rotation style [left-right v]\n        point in direction (-90)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<key (space v) pressed?> or <mouse down?>> then\n        repeat (21)\n            next costume\n        end\n        switch costume to (lightsaber1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (king of the sky boss v)?> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\n@boss \n\ndefine Gravity (gravity) Jump Height (jump height) Speed (speed) Friction (friction) Slope (slope)\nchange [yv v] by (gravity)\nchange y by (yv)\nif <touching (levels v)?> then\n    repeat until <not <touching (levels v)?>>\n        change y by ((([abs v] of (yv) ) / (yv)) * (-1))\n    end\n    set [yv v] to (<<(y position) < (([x position v] of [player v]) - (25))> and <(([abs v] of (YV) ) / (YV)) = [-1]>> * (jump height))\nend\nset [xv v] to (((xv) + ((<(x position) > ([x position v] of [player v])> * ((speed) * (-1))) + (<(x position) < ([x position v] of [link v])> * (speed)))) * (friction))\nchange x by (xv)\nset [enemy - slope v] to [0]\nrepeat until <<(Enemy - Slope) = ((slope) * (-1))> or <not <touching (levels v)?>>>\n    change y by (1)\n    change [enemy - slope v] by (-1)\nend\nif <touching (levels v)?> then\n    change y by (Enemy - Slope)\n    repeat until <not <touching (levels v)?>>\n        change x by ((([abs v] of (xv) ) / (xv)) * (-1))\n    end\nend\npoint towards (player v)\nif <(y position) < [-180]> then\n    delete this clone\nend\n\nwhen I receive [complete level v]\nrepeat (1)\n    delete this clone\nend\nrepeat (13)\n    move (0) steps\nend\nif <(Level) = [16]> then\n    Clone at [142] [30]\nelse\nend\n\ndefine Clone at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nforever\n    if <not <(Switch In Progress) = [yes]>> then\n        Gravity [-1] Jump Height [10] Speed [0.5] Friction [.75] Slope [2]\n    end\nend\n\nwhen I receive [death v]\nrepeat (1)\n    delete this clone\nend\nif <(Level) = [5]> then\n    Clone at [150] [-80]\nelse\n    if <(Level) = [8]> then\n        Clone at [90] [-80]\n        Clone at [140] [-80]\n        Clone at [200] [-80]\n    else\n        if <(Level) = [11]> then\n            Clone at [150] [-80]\n            Clone at [-127] [86]\n            Clone at [-50] [86]\n            Clone at [50] [86]\n            Clone at [120] [86]\n        else\n            if <(Level) = [12]> then\n                Clone at [-20] [98]\n                Clone at [220] [-85]\n                Clone at [150] [-85]\n                Clone at [50] [-85]\n            else\n                if <(Level) = [14]> then\n                    Clone at [215] [-80]\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<not <([costume # v] of [sword v]) = [1]>> and <touching (sword v)?>> then\n        wait (1) seconds\n        wait until <<not <([costume # v] of [sword v]) = [1]>> and <touching (sword v)?>>\n        wait (1) seconds\n        wait until <<not <([costume # v] of [sword v]) = [1]>> and <touching (sword v)?>>\n        start sound [Hit v]\n        set [slime x v] to (x position)\n        set [slime y v] to (y position)\n        broadcast (Slime Death v)\n        delete this clone\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\n@END\n\nwhen flag clicked\nhide\n\nwhen I receive [fin v]\nshow\nstop [all v]\n\n@TN\n\nwhen flag clicked\nhide\n\n