Save - A Platformer 1

Instructions: Follow, love and fav\n18 Levels\nFight the boss and save your parents!\nHope you enjoy!\nWorld record and time playing\nArrow keys, WASD or mobile controls to move\nTo defeat the boss, touch the orange thing

@Stage\n\nwhen flag clicked\nset [volume v] to [100]\nforever\n    set volume to (VOLUME) %\nend\n\nwhen flag clicked\nforever\n    if <<(LEVEL) < [12]> or <(LEVEL) > [18]>> then\n        switch backdrop to (blue sky 2  v)\n    else\n        switch backdrop to (costume2 v)\n    end\nend\n\n@Blank\n\n@Player\n\nwhen flag clicked\nset variables and position\nforever\n    change level and player position\n    death and win\n    jumping controls\n    walking controls\n    resistance\n    move in steps (([abs v] of (sx) ) + ([abs v] of (sy) ))\nend\n\ndefine move in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((sx) / (steps))\n    check solid\n    if <(touching) = [1]> then\n        collide x - slope or wall\n    end\n    set [last value v] to (y position)\n    change y by ((sy) / (steps))\n    check solid\n    if <(touching) = [1]> then\n        collide y - ceiling or floor\n    end\nend\n\ndefine jumping controls\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <(wall slide) > [0]> then\n        set [sy v] to (JUMP FORCE)\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [sx v] to (((direction) / (90)) * (15))\n    end\n    if <(falling) < [3]> then\n        set [sy v] to (JUMP FORCE)\n    end\nend\nif <(wall slide) > [0]> then\n    check wall slide\n    if <(sy) < [0]> then\n        set [sy v] to ((sy) * (0.8))\n    end\nend\n\ndefine walking controls\nset [key x v] to (<<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> - <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>)\nif <(KEY X) = [0]> then\n    switch costume to (player v)\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [sx v] to ((sx) * (0.98))\n    end\n    if <([abs v] of (sx) ) < [1]> then\n        set [sx v] to [0]\n    end\nelse\n    change [sx v] by ((KEY X) * (ACCELERATION))\n    if <(sy) > [0]> then\n        switch costume to (playerup v)\n    else\n        switch costume to (playerright \(or left\) v)\n    end\n    point in direction ((KEY X) * (90))\nend\n\ndefine resistance\nset [sx v] to ((sx) * (RESISTANCE))\nchange [sy v] by (GRAVITY)\n\ndefine set variables and position\nset [level v] to [1]\nset [gravity v] to [-1]\nset [jump force v] to [12]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.85]\nset [sy v] to [0]\nset [wall slide v] to [0]\ngo to x: (-200) y: (55)\n\ndefine check solid\nif <touching (level v)?> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\ndefine collide x - slope or wall\ncheck wall slide\nchange y by (1)\ncheck solid\nif <(touching) > [0]> then\n    change y by (1)\n    check solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [sx v] to [0]\n        stop [this script v]\n    end\n    set [sx v] to ((sx) * (0.85))\nend\nset [sx v] to ((sx) * (0.95))\nslip\n\ndefine collide y - ceiling or floor\nset y to (last value)\nif <(sy) > [0]> then\n    set [sy v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    slip\nend\nset [sy v] to ((sy) * (0.85))\n\ndefine slip\nchange y by (-2)\nchange x by (1)\ncheck solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [sx v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\ncheck solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [sx v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine check wall slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nset rotation style [left-right v]\ncheck solid\nset [wall slide v] to (touching)\n\ndefine change level and player position\nif <(x position) > [235]> then\n    if <not <(LEVEL) = [19]>> then\n        change [level v] by (1)\n        go to x: (-200) y: (55)\n    end\nend\n\ndefine death and win\nif <touching (trampoline v)?> then\n    set [sy v] to [17.5]\nend\nif <(y position) < [-179]> then\n    go to x: (-200) y: (55)\nelse\n    if <touching (spikes - lava v)?> then\n        go to x: (-200) y: (55)\n    else\n        if <touching (saws v)?> then\n            go to x: (-200) y: (55)\n        else\n            if <touching (boss v)?> then\n                go to x: (-200) y: (55)\n            else\n                if <<(LEVEL) = [18]> and <<([ceiling v] of (y position) ) < [-40]> and <([floor v] of (x position) ) > [200]>>> then\n                    set [win v] to [1]\n                else\n                    set [win v] to [0]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nswitch costume to (playertrail v)\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\nwhen flag clicked\nforever\n    if <([x position v] of [player v]) > [235]> then\n        set [ghost v] effect to (100)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen flag clicked\nreset timer\nforever\n    if <(LEVEL) < [19]> then\n        set [gametime v] to (timer)\n    else\n        if <(GAMETIME) < (☁ WR)> then\n            set [☁ wr v] to (GAMETIME)\n        end\n    end\nend\n\nwhen flag clicked\nset [costume v] to [0]\nforever\n    set [time v] to (timer)\nend\n\nwhen [timer v] > (TIME)\n\n@Clouds\n\nwhen flag clicked\nhide\nset [ghost v] effect to (25)\nforever\n    wait (3) seconds\n    go to x: (0) y: (0)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(LEVEL) > [11]> then\n    hide\nend\ngo to x: (240) y: (pick random (80) to (130))\nshow\nrepeat (192)\n    change x by (-2.5)\n    if <(LEVEL) > [11]> then\n        hide\n    end\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    turn right (15) degrees\nend\n\n@Trampoline\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\nwhen flag clicked\nforever\n    if <([x position v] of [player v]) > [235]> then\n        set [ghost v] effect to (100)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\n@Sprite1\n\n@Boss\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [18]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    repeat (50)\n        change y by (1.5)\n    end\n    repeat (50)\n        change y by (-1.5)\n    end\nend\n\n@White Effect\n\nwhen flag clicked\nshow variable [☁ wr v]\nshow variable [gametime v]\nswitch costume to (costume1 v)\nforever\n    if <(WIN) = [1]> then\n        set [x v] to [-200]\n        set [y v] to [55]\n        set [ghost v] effect to (100)\n        repeat (25)\n            change [ghost v] effect by (-4)\n        end\n        set [win v] to [0]\n        wait (2) seconds\n        set [level v] to [19]\n        repeat (25)\n            change [ghost v] effect by (4)\n        end\n    else\n        set [ghost v] effect to (100)\n        set [x v] to []\n        set [y v] to []\n    end\nend\n\nwhen [timer v] > (TIME)\nswitch costume to (costume2 v)\nshow\nhide variable [☁ wr v]\nhide variable [gametime v]\n\n@love\n\nwhen flag clicked\nforever\n    set volume to (volume) %\nend\n\nwhen flag clicked\nset [costume v] to [0]\nhide\nforever\n    if <not <(title) = [1]>> then\n        if <not <<(LOVED__) = [1]> and <(FAVED___) = [1]>>> then\n            wait (pick random (3) to (3)) seconds\n            switch costume to (download \(68\) v)\n            go to x: (110) y: (-155)\n            show\n            go to [front v] layer\n            start sound [Pop v]\n            wait (1) seconds\n            hide\n        end\n        if <(Costume) > [0]> then\n            hide\n            stop [this script v]\n        end\n    end\nend\n\n@Star\n\nwhen flag clicked\nforever\n    turn right (15) degrees\nend\n\n@Heart\n\nwhen flag clicked\nforever\n    change [color v] effect by (25)\nend\n\n