Simple Platformer Game
@Stage\n\n@Player\n\nwhen flag clicked\nset [gravity v] to [-1.5]\nset [acceleration v] to [1.5]\nset [resistence v] to [0.9]\nset [jump force v] to [14]\nset [speed y v] to [0]\ngo to x: (-200) y: (80)\nset size to (50) %\nforever\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(falling) < [3]> then\n            if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n                switch costume to (7 v)\n            else\n                switch costume to (4 v)\n            end\n            set [speed y v] to (jump force)\n        end\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            switch costume to (5 v)\n        else\n            switch costume to (2 v)\n        end\n        change [speed x v] by (acceleration)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            switch costume to (6 v)\n        else\n            switch costume to (3 v)\n        end\n        change [speed x v] by ((0) - (acceleration))\n    end\n    set [speed x v] to ((speed x) * (resistence))\n    change [speed y v] by (gravity)\n    Move-in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\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 ((speed x) / (steps))\n    if <touching (level v)?> then\n        set x to (last value)\n        set [speed x v] to [0]\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    if <touching (level v)?> then\n        set y to (last value)\n        if <(speed y) < [0]> then\n            set [falling v] to [0]\n        end\n        set [speed y v] to [0]\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    create clone of (_myself_ v)\n    if <[240] < (x position)> then\n        broadcast (next level v)\n        set [speed y v] to [0]\n        set [speed x v] to [0]\n        go to x: (-200) y: (80)\n    end\n    if <touching (lava v)?> then\n        set [speed y v] to [0]\n        set [speed x v] to [0]\n        repeat (10)\n            change size by (-5)\n        end\n        go to x: (-200) y: (80)\n        set size to (50) %\n    end\n    if <touching (trampoline v)?> then\n        repeat (10)\n            set [jump force v] to [25]\n        end\n    else\n        set [jump force v] to [14]\n    end\nend\n\nwhen I start as a clone\nrepeat (12)\n    change size by (-4)\n    change [ghost v] effect by (8)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        if <not <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>>>>>> then\n            switch costume to (8 v)\n        end\n    else\n        if <not <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<key (down arrow v) pressed?> or <key (s v) pressed?>>>>>>>>> then\n            switch costume to (1 v)\n        end\n    end\nend\n\nwhen flag clicked\nset [music v] to (pick random (1) to (5))\nforever\n    if <key (p v) pressed?> then\n        broadcast (next level v)\n        wait (0.5) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (lava v)?> then\n        play sound [Crunch v] until done\n    end\nend\n\nwhen flag clicked\nplay sound [Connect v] until done\nforever\n    if <(music) = [1]> then\n        play sound [1 v] until done\n    else\n        if <(music) = [2]> then\n            play sound [2 v] until done\n        else\n            if <(music) = [3]> then\n                play sound [3 v] until done\n            else\n                if <(music) = [4]> then\n                    play sound [4 v] until done\n                else\n                    if <(music) = [5]> then\n                        play sound [5 v] until done\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Lava\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@level\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@trampoline\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@intro\n\nwhen flag clicked\nclear graphic effects\nshow\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\n@fake level (for cave)\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nswitch costume to (1 v)\n\n