Appel Platformer v5.7

Instructions:              *DOUBLE CLICK THE GREEN FLAG*\nArrow keys, Your head sticks to most things, if you hold up you can stick to the top. Not very many levels because of bugs. *NEW INCLUDED WALL JUMPING*\n

@Stage\n\nwhen flag clicked\nshow variable [collect v]\nhide variable [mouse v]\n\nwhen [m v] key pressed\nshow variable [mouse v]\nset [mouse v] to (join ((mouse x) + (Scroll X)) (join [,] ((mouse y) + (Scroll Y))))\n\nwhen flag clicked\nif <(Level) = [4]> then\n    hide variable [collect v]\nend\n\nwhen flag clicked\nreset timer\nset [previous timer v] to [0]\nforever\n    set [fps v] to ((1) / ((timer) - (Previous Timer)))\n    set [previous timer v] to (timer)\nend\n\n@Blank/ Not Balnk\n\n@Appel\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\nswitch costume to (appel v)\n\nwhen I receive [play game v]\nset [ghost v] effect to (0)\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(Exit) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(Exit) = [win]> then\n        Game - Win\n    else\n        Game - Die\n        broadcast (33 v)\n    end\nend\n\ndefine Game On\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [appel: sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [wall jump v] to [0]\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <(wall jump) > [0]> then\n    change [wall jump v] by (-1)\nelse\n    if <key (left arrow v) pressed?> then\n        change [appel: sx v] by (-2)\n        switch costume to (appel 2 v)\n        if <[3] < (distance to [platforms v])> then\n            if <key (down arrow v) pressed?> then\n                switch costume to (appel 4 v)\n            end\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        change [appel: sx v] by (2)\n        switch costume to (appel v)\n        if <[3] < (distance to [platforms v])> then\n            if <key (down arrow v) pressed?> then\n                switch costume to (appel 3 v)\n                point in direction (-90)\n            end\n        end\n    end\nend\nset [appel: sx v] to ((Appel: sx) * (0.8))\nif <([abs v] of (Appel: sx) ) > [0.9]> then\n    Change Player x by (round (Appel: sx))\nend\nif <key (up arrow v) pressed?> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <<touching (edges v)?> and <<key (up arrow v) pressed?> and <([abs v] of (Appel: sx) ) > [5]>>> then\n    if <(wall jump) = [0]> then\n        set [appel: sx v] to ((-3.2) * (Appel: sx))\n        set [sy v] to [20]\n        set [in air v] to [6]\n        set [wall jump v] to [10]\n    end\nelse\n    set [sx v] to [0]\nend\nchange [sy v] by (-2)\nChange Player y by (sy)\nTest - Die\nchange [scroll x v] by (round (((x) - (Scroll X)) / (14)))\nif <(Scroll X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (Scroll Y)) / (8)))\nif <(Scroll Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\npoint in direction (90)\nif <touching (edges v)?> then\n    if <(costume [number v]) = [1]> then\n        point in direction (180)\n    end\n    if <(costume [number v]) = [2]> then\n        point in direction (0)\n    end\nend\n\ndefine Position\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nTest - Die\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-8)\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n    end\n    Position\n    set [sy v] to [0]\n    set [in air v] to [0]\nend\n\ndefine Game - Die\nswitch costume to (appel death v)\nchange [ghost v] effect by (2)\nwait (.04) seconds\nswitch costume to (appel death 1 v)\nchange [ghost v] effect by (2)\nwait (.04) seconds\nchange [ghost v] effect by (2)\nswitch costume to (appel death 2 v)\nwait (.04) seconds\nchange [ghost v] effect by (2)\nswitch costume to (appel death 3 v)\nwait (.04) seconds\nchange [ghost v] effect by (2)\nswitch costume to (appel death 4 v)\nwait (.04) seconds\nchange [ghost v] effect by (4)\nswitch costume to (appel death 5 v)\nwait (.04) seconds\nchange [ghost v] effect by (14)\nswitch costume to (appel death 6 v)\nchange [ghost v] effect by (7)\nwait (.04) seconds\nchange [ghost v] effect by (2)\nswitch costume to (appel death 7 v)\nwait (.04) seconds\nchange [ghost v] effect by (7)\nchange [ghost v] effect by (7)\nswitch costume to (appel death 8 v)\nchange [ghost v] effect by (7)\nwait (.04) seconds\nchange [ghost v] effect by (7)\nchange [ghost v] effect by (7)\nswitch costume to (appel death 9 v)\nwait (.04) seconds\nchange [ghost v] effect by (7)\nswitch costume to (appel death 10 v)\nchange [ghost v] effect by (7)\nwait (.2) seconds\nchange [ghost v] effect by (7)\nchange [ghost v] effect by (7)\nswitch costume to (appel v)\nset [exit v] to []\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (2) seconds\n\nwhen flag clicked\nforever\n    set [collect v] to (join (Corn Dogs) (join [ out of ] (Corn Dog Max)))\nend\n\nwhen I receive [die appel v]\nset [exit v] to [die]\n\nwhen flag clicked\nforever\n    set [player xx v] to (Appel: x2)\nend\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Danger: x) - (Scroll X)) ((Danger: y) - (Scroll Y))\n\nwhen I receive [setup v]\nhide\nset [danger: x v] to [0]\nset [danger: y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1.1 v)\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2.1 v)\n        Clone at x: [0] y: [400]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3.1 v)\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4.1 v)\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger: x v] by (x)\nchange [danger: y v] by (y)\nnext costume\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Platforms: x) - (Scroll X)) ((Platforms: y) - (Scroll Y))\n\nwhen I receive [setup v]\nhide\nset [platforms: x v] to [0]\nset [platforms: y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1.1 v)\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2.1 v)\n        Clone at x: [325] y: [300]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3.1 v)\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4.1 v)\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [platforms: x v] by (x)\nchange [platforms: y v] by (y)\nnext costume\n\n@Edges\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Edges: x) - (Scroll X)) ((Edges: y) - (Scroll Y))\n\nwhen I receive [setup v]\nhide\nset [edges: x v] to [0]\nset [edges: y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1.1 v)\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\n    Clone at x: [325] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2.1 v)\n        Clone at x: [325] y: [330]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3.1 v)\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4.1 v)\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [edges: x v] by (x)\nchange [edges: y v] by (y)\nnext costume\n\nif <(Level) = [3]> then\n\nClone at x: [450] y: [0]\n\n@Corn dogs\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Corn dogs: x) - (Scroll X)) ((Corn dogs: y) - (Scroll Y))\nif <touching (appel v)?> then\n    change [corn dogs v] by (1)\n    delete this clone\nend\nif <(Corn Dogs) = (Corn Dog Max)> then\n    broadcast (Open Portal v) and wait\nend\n\nwhen I receive [setup v]\nhide\nset [corn dog max v] to [0]\nset [corn dogs v] to [0]\nset [corn dogs: x v] to [0]\nset [corn dogs: y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (corn dog v)\n    Clone at x: [50] y: []\n    Clone at x: [100] y: [50]\n    Clone at x: [360] y: [87]\n    Clone at x: [720] y: [40]\n    Clone at x: [720] y: [100]\nelse\n    if <(Level) = [2]> then\n        switch costume to (corn dog v)\n        Clone at x: [219] y: [-9]\n        Clone at x: [46] y: [1]\n        Clone at x: [187] y: [221]\n        Clone at x: [371] y: [282]\n    else\n        if <(Level) = [3]> then\n            switch costume to (corn dog v)\n            set [corn dog max v] to [1]\n        else\n            if <(Level) = [4]> then\n                switch costume to (corn dog v)\n            end\n        end\n    end\nend\nset [corn dogs: x v] to [-99999]\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [corn dogs: x v] to (x)\nset [corn dogs: y v] to (y)\nchange [corn dog max v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [54321 v]\nchange [corn dogs v] by (1)\n\nwhen I receive [54321 v]\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Exit: x) - (Scroll X)) ((Exit: y) - (Scroll Y))\nif <<(costume [name v]) = [Open]> and <touching (appel v)?>> then\n    set [exit v] to [win]\nend\nswitch costume to (closed v)\n\nwhen I receive [setup v]\nhide\nset [exit: x v] to [0]\nset [exit: y v] to [0]\nif <(Level) = [1]> then\n    Clone at x: [1147] y: [28]\nelse\n    if <(Level) = [2]> then\n        Clone at x: [510] y: [199]\n    else\n        if <(Level) = [3]> then\n            Clone at x: [335] y: [247]\n        else\n            if <(Level) = [4]> then\n                Clone at x: [9999] y: [247]\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [exit: x v] to (x)\nset [exit: y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\n@Enemy\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Corn dogs: x) - (Scroll X)) ((Corn dogs: y) - (Scroll Y))\nif <not <touching (platforms v)?>> then\n    change [corn dogs: y v] by (-4)\n    if <touching (platforms v)?> then\n        set rotation style [left-right v]\n    end\nend\n\nwhen I receive [setup v]\nhide\nset [corn dogs: x v] to [0]\nset [corn dogs: y v] to [0]\nif <(Level) = [1]> then\n    Clone at x: [100] y: []\n    Clone at x: [50] y: []\n    Clone at x: [996] y: [-29]\nelse\n    if <(Level) = [2]> then\n        Clone at x: [101] y: [152]\n    else\n        if <(Level) = [3]> then\n            Clone at x: [44] y: [-55]\n        else\n            if <(Level) = [4]> then\n        end\n    end\nend\nset [corn dogs: x v] to [-99999]\n\ndefine Position (x) (y)\nswitch costume to (hitbox 1 v)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\nif <<(costume [name v]) = [hitbox 1]> and <touching (appel v)?>> then\n    delete this clone\nend\nswitch costume to (costume1 v)\nif <<(costume [name v]) = [costume1]> and <touching (appel v)?>> then\n    broadcast (Die appel v)\nend\n\ndefine Clone at x: (x) y: (y)\nset [corn dogs: x v] to (x)\nset [corn dogs: y v] to (y)\ncreate clone of (_myself_ v)\n\nif <touching (platforms v)?> then\n    stop [this script v]\nend\n\n\n\nwhen I receive [tick v]\npoint towards (appel v)\nif <touching (platforms v)?> then\n    if <(direction) < [50]> then\n        change [corn dogs: x v] by (-3)\n    end\n    if <[-50] < (direction)> then\n        change [corn dogs: x v] by (3)\n    end\nend\n\nwhen I receive [new villian v]\nClone at x: (Scroll X) y: ((50) + (Scroll Y))\n\n@Boss\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((Corn dogs: x) - (Scroll X)) ((Corn dogs: y) - (Scroll Y))\n\nwhen I receive [setup v]\nset [corn dogs: x v] to [0]\nset [corn dogs: y v] to [0]\nset [22 v] to [0]\n\nif <(Level) = [3]> then\nset [corn dogs: x v] to [-99999]\n\ndefine Position (x) (y)\nswitch costume to (boss v)\ngo to x: (x) y: (y)\n\nif <<(x) = (x position)> and <(y) = (y position)>> then\n\nif <touching (platforms v)?> then\n    stop [this script v]\nend\n\nwhen I receive [tick v]\nset rotation style [left-right v]\npoint towards (appel v)\n\n\n\nwhen flag clicked\nforever\n    if <(Level) = [3]> then\n        wait (2) seconds\n        show\n        say [Ha Ha, Appel!] for (1) seconds\n        say [I am apple, I can spawn enemies to kill you!] for (2) seconds\n        repeat (5)\n            broadcast (new villian v)\n            wait (4) seconds\n        end\n        broadcast (54321 v)\n        hide\n        stop [this script v]\n    else\n        hide\n    end\nend\n\n@Back\n\nwhen I receive [green flag v]\nhide\ngo to [back v] layer\n\nwhen I receive [tick v]\nPosition ((Platforms: x) - (Scroll X)) ((Platforms: y) - (Scroll Y))\n\nwhen I receive [setup v]\nhide\nset [platforms: x v] to [0]\nset [platforms: y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (grid v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [240]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [240]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    switch costume to (grid v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [240]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [0]\n    Clone at x: [-480] y: [240]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [platforms: x v] by (x)\nchange [platforms: y v] by (y)\nnext costume\n\n