WORLD A Platformer

Instructions: Arrows keys or touch to move; avoid spikes.\nPress R to reposition

@Stage\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nwait (1) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nbroadcast (Start Game v)\nhide\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0.2) seconds\nset rotation style [don't rotate v]\npoint in direction (90)\nif <([costume name v] of [platform v]) = [3]> then\n    go to x: (0) y: (0)\n    switch costume to (3 v)\n    show\nelse\n    if <([costume name v] of [platform v]) = [4]> then\n        go to x: (0) y: (0)\n        switch costume to (4 v)\n        show\n    else\n        if <([costume name v] of [platform v]) = [5]> then\n            go to x: (0) y: (0)\n            switch costume to (5 v)\n            show\n            broadcast (Power v)\n        else\n            if <([costume name v] of [platform v]) = [6]> then\n                switch costume to (6 v)\n                go to x: (0) y: (0)\n                show\n            else\n                if <([costume name v] of [platform v]) = [2]> then\n                    switch costume to (2 v)\n                    go to x: (0) y: (0)\n                    show\n                else\n                    if <([costume name v] of [platform v]) = [7]> then\n                        switch costume to (8 v)\n                        go to x: (0) y: (0)\n                        show\n                    else\n                        if <([costume name v] of [platform v]) = [8]> then\n                            switch costume to (7 v)\n                            go to x: (0) y: (0)\n                            show\n                        else\n                            if <([costume name v] of [platform v]) = [9]> then\n                                switch costume to (9 v)\n                                go to x: (0) y: (0)\n                                show\n                            else\n                                hide\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nshow\n\n@Player\n\nwhen I receive [start game v]\ngo to [front v] layer\nset [color v] effect to (0)\nforever\n    switch costume to (1 v)\n    wait (3) seconds\n    repeat (3)\n        next costume\n    end\n    wait (0.3) seconds\nend\n\nwhen I receive [start game v]\nset size to (25) %\nset rotation style [left-right v]\ngo to x: (-187) y: (-58)\nshow\nset [speed y v] to [0]\nset [falling? v] to [10]\nforever\n    if <<(speed y) < [4]> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>>> then\n        change [speed y v] by (-1)\n    else\n        change [speed y v] by (-2)\n    end\n    change y by (speed y)\n    Touch Ground <(speed y) > [0]>\n    if <(wall jump) > [0]> then\n        change [wall jump v] by (-1)\n    else\n        set [speed x v] to ((speed x) * (0.7))\n        if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>> then\n            change [speed x v] by (-2.5)\n        end\n        if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>> then\n            change [speed x v] by (2.5)\n        end\n    end\n    if <(speed x) < [-0.5]> then\n        Walk (-90) (speed x)\n    else\n        if <(speed x) > [0.5]> then\n            Walk (90) (speed x)\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>> then\n        if <<(jump key) = [0]> and <(falling?) < [3]>> then\n            set [speed y v] to [14]\n            set [falling? v] to [6]\n            set [jump key v] to [1]\n        end\n    else\n        set [jump key v] to [0]\n    end\n    if <(y position) < [-180]> then\n        go to x: (0) y: (100)\n        set [speed y v] to [0]\n    end\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (platform v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (platform v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>> and <([abs v] of (speed) ) > [3]>> then\n        if <(wall jump) = [0]> then\n            set [speed x v] to ((-1.2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\nif <(speed) < [0]> then\n    change [frame v] by ((speed) / (-8))\nelse\n    change [frame v] by ((speed) / (8))\nend\n\nwhen I receive [start game v]\nset [level v] to [1]\ngo [backward v] (1) layers\nforever\n    if <not <([costume name v] of [platform v]) = [10]>> then\n        if <<touching (_edge_ v)?> and <(x position) > [180]>> then\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            change [level v] by (1)\n            broadcast (Reposition v)\n            broadcast (Next Level v)\n            repeat (10)\n                change [ghost v] effect by (-10)\n            end\n        end\n    end\n    if <<touching (spikes v)?> or <touching (bolder v)?>> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        broadcast (Reposition v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\n    if <touching (abominable v)?> then\n        broadcast (Clear All Effects v)\n        go to x: (0) y: (-69)\n    end\n    if <touching (spike v)?> then\n        go to x: (-187) y: (-64)\n    end\nend\n\nwhen I receive [reposition v]\ngo to x: (-187) y: (-64)\n\nwhen [r v] key pressed\nbroadcast (Reposition v)\n\nwhen flag clicked\nhide variable [level v]\ngo to [front v] layer\nhide\n\nwhen I start as a clone\nset size to (100) %\nshow\ngo to [back v] layer\nswitch costume to (light v)\nforever\n    go to [back v] layer\n    go to (player v)\nend\n\nwhen I receive [start game v]\ncreate clone of (_myself_ v)\n\n@Skip\n\nwhen flag clicked\ngo to x: (207) y: (-144)\nhide\n\nwhen I receive [start game v]\nshow\nforever\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <not <<([costume name v] of [platform v]) = [10]> or <([costume name v] of [platform v]) = [End]>>> then\n            wait (0.3) seconds\n            broadcast (Reposition v)\n            broadcast (Next Level v)\n            change [level v] by (1)\n        end\n    end\nend\n\n@Sprite1\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nshow\n\n@Platform\n\nwhen flag clicked\nswitch costume to (1 v)\ngo to x: (0) y: (0)\nhide\nset volume to (50) %\n\nwhen I receive [start game v]\nshow\ngo to [front v] layer\nforever\n    play sound [Vicetone - United We Dance v] until done\nend\n\nwhen I receive [next level v]\nnext costume\n\n@Cloud\n\nwhen flag clicked\nset [ghost v] effect to (50)\nhide\n\nwhen I receive [start game v]\nforever\n    if <<([costume # v] of [platform v]) < [7]> or <([costume # v] of [platform v]) > [10]>> then\n        wait (2) seconds\n        create clone of (_myself_ v)\n    else\n        hide\n        delete this clone\n    end\nend\n\nwhen I start as a clone\ngo to [back v] layer\ngo to x: (200) y: (pick random (0) to (180))\nshow\nrepeat until <(x position) < [-200]>\n    change x by (-3)\n    if <<([costume name v] of [platform v]) > [6]> and <([costume name v] of [platform v]) < [11]>> then\n        hide\n        delete this clone\n    end\nend\nrepeat (10)\n    hide\n    delete this clone\nend\n\n