a platformer


@Stage\n\nwhen flag clicked\nforever\n    if <(username) = [Eliza_From_KK]> then\n        if <key (space v) pressed?> then\n            broadcast (Thumbnail Mode v)\n            switch backdrop to (backdrop4 v)\n            hide variable [level v]\n        end\n    end\nend\n\nwhen flag clicked\nbroadcast (Setup v)\nforever\n    play sound [Alan Walker - Lily Piano Cover  v] until done\nend\n\n@Player\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (y vel)\nif <touching color (#000000)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching color (#000000)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<key (up arrow v) pressed?> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <key (right arrow v) pressed?> then\n    change [x vel v] by (movement speed)\nend\nif <key (left arrow v) pressed?> then\n    change [x vel v] by ((-1) * (movement speed))\nend\nchange x by (x vel)\nif <touching color (#000000)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching color (#000000)?> then\n            change y by (1)\n        end\n    end\n    if <touching color (#000000)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching color (#000000)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        if <key (up arrow v) pressed?> then\n            if <(x vel) < [0]> then\n                set [x vel v] to [0]\n                if <key (left arrow v) pressed?> then\n                    set [x vel v] to (wall jump hm)\n                    set [y vel v] to (wall jump vm)\n                end\n            else\n                set [x vel v] to [0]\n                if <key (right arrow v) pressed?> then\n                    set [x vel v] to ((-1) * (wall jump hm))\n                    set [y vel v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\nwhen I receive [level 2 v]\ngo to x: (-184) y: (-139)\n\nwhen I receive [level 3 v]\ngo to x: (-184) y: (-139)\n\nwhen I receive [level 4 v]\ngo to x: (-184) y: (-139)\n\nwhen flag clicked\nset rotation style [left-right v]\ngo to x: (-184) y: (-139)\nshow\nforever\n    if <touching (danger v)?> then\n        start sound [Oops v]\n        go to x: (-185) y: (-141)\n    end\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        switch costume to (player 1 v)\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to (player 2 v)\n    end\nend\n\nwhen I receive [level 4 v]\ngo to x: (-157) y: (-127)\n\nwhen I receive [level 5 v]\ngo to x: (-184) y: (-139)\n\nwhen I receive [end v]\ngo to x: (0) y: (-139)\n\nwhen flag clicked\nforever\n    platform physics (12) (-1) (0.75) (1) (10) (8)\nend\n\nwhen I receive [setup v]\nswitch backdrop to (main v)\nshow variable [level v]\nset [level v] to [1]\nset [y vel v] to [0]\nset [x vel v] to [0]\n\nwhen I receive [end v]\nswitch backdrop to (end v)\nhide variable [level v]\n\nwhen I receive [thumbnail mode v]\nhide\n\n@Levels\n\nwhen flag clicked\ngo to x: (75) y: (-90)\nshow\nforever\n    if <(Level) = [1]> then\n        switch costume to (platforms 1 v)\n    end\n    if <(Level) = [2]> then\n        switch costume to (platforms 2 v)\n    end\n    if <(Level) = [3]> then\n        switch costume to (platforms 3 v)\n    end\n    if <(Level) = [4]> then\n        switch costume to (platform 4 v)\n    end\n    if <(Level) = [5]> then\n        switch costume to (platform 5 v)\n    end\n    if <(Level) = [End]> then\n        switch costume to (wall  v)\n    end\nend\n\nwhen I receive [thumbnail mode v]\nhide\n\n@Star\n\nwhen I receive [level 2 v]\nset [level v] to [2]\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\nforever\n    if <(Level) = [1]> then\n        go to x: (182) y: (-16)\n        if <touching (player v)?> then\n            broadcast (Level 2 v)\n        end\n    end\n    if <(Level) = [2]> then\n        go to x: (154) y: (155)\n        if <touching (player v)?> then\n            broadcast (Level 3 v)\n        end\n    end\n    if <(Level) = [3]> then\n        go to x: (132) y: (151)\n        if <touching (player v)?> then\n            broadcast (Level 4 v)\n        end\n    end\n    if <(Level) = [4]> then\n        go to x: (208) y: (-36)\n        if <touching (player v)?> then\n            broadcast (Level 5 v)\n        end\n    end\n    if <(Level) = [5]> then\n        go to x: (-182) y: (27)\n        if <touching (player v)?> then\n            broadcast (End v)\n            set [ghost v] effect to (100)\n            hide\n        end\n    end\nend\n\nwhen I receive [level 3 v]\nset [level v] to [3]\n\nwhen I receive [level 4 v]\nset [level v] to [4]\n\nwhen I receive [level 1 v]\nset [level v] to [1]\n\nwhen I receive [end v]\nset [level v] to [End]\n\nwhen I receive [level 4 v]\nset [level v] to [5]\n\nwhen I receive [thumbnail mode v]\nhide\n\n@Danger\n\nwhen flag clicked\nset [ghost v] effect to (0)\nset size to (80) %\nshow\nforever\n    if <(Level) = [1]> then\n        switch costume to (costume1 v)\n        go to x: (40) y: (-151)\n    end\n    if <(Level) = [2]> then\n        switch costume to (costume2 v)\n        go to x: (18) y: (42)\n    end\n    if <(Level) = [3]> then\n        switch costume to (costume3 v)\n        go to x: (72) y: (-121)\n    end\n    if <(Level) = [4]> then\n        switch costume to (costume4 v)\n        go to x: (-2) y: (-175)\n    end\n    if <(Level) = [5]> then\n        switch costume to (costume5 v)\n        go to x: (-2) y: (-175)\n    end\n    if <(Level) = [End]> then\n        set [ghost v] effect to (100)\n        hide\n    end\nend\n\nwhen I receive [thumbnail mode v]\nhide\n\n