Green Fields || Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (2 v)\n\n@Blank\n\nwhen I receive [start game v]\nforever\n    play sound [2 minutes of relaxing music,2 minute meditation music,2 minutes meditation,music 2 minute v] until done\nend\n\n@Player\n\nwhen I receive [start game v]\nset [colour v] to [0]\nswitch costume to (player v)\npoint in direction (90)\nSetup Player\nforever\n    Special Collisions\n    Main Game\nend\n\ndefine Setup Player\nclear graphic effects\nset [player x v] to [0]\nset [player y v] to [0]\ngo to x: (-200) y: (-20)\nshow\n\ndefine Main Game\nPlatformer Physics\nbroadcast (Loop v)\n\ndefine Platformer Physics\nchange y by (-2)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    point in direction (90)\n    change [player x v] by (1)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    point in direction (-90)\n    change [player x v] by (-1)\nend\nchange y by (2)\nchange x by (Player x)\nif <touching (level v)?> then\n    change x by ((Player x) * (-1))\n    if <(Player x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(Player x) > [0]> then\n            set [player x v] to [-10]\n        else\n            set [player x v] to [10]\n        end\n        set [player y v] to [10]\n    else\n        switch costume to (player v)\n        set [player x v] to [0]\n    end\nelse\n    set [player x v] to ((Player x) * (0.85))\nend\nchange y by (Player Y)\nif <touching (level v)?> then\n    change y by ((Player Y) * (-1))\n    set [player y v] to [0]\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(Jumping?) = [Yes]>> then\n        set [player y v] to [10]\n        set [jumping? v] to [No]\n    end\n    change y by (1)\nelse\n    change [player y v] by (-1)\n    set [jumping? v] to [Yes]\nend\n\ndefine Special Collisions\nif <touching (ice v)?> then\n    if <key (right arrow v) pressed?> then\n        set [player x v] to [10]\n    end\n    if <key (left arrow v) pressed?> then\n        set [player x v] to [-10]\n    end\nend\nif <touching (yellow v)?> then\n    set [player y v] to [20]\nend\nif <touching (red v)?> then\n    change [score v] by (-1)\n    broadcast (-1 point v)\n    Setup Player\nend\nif <(x position) > [235]> then\n    change [_level v] by (1)\n    change [score v] by (5)\n    broadcast (+5 points v)\n    Setup Player\nend\n\nwhen I receive [start game v]\nforever\n    if <(_Level) = [1]> then\n        show variable [colour v]\n    else\n        hide variable [colour v]\n    end\n    set [color v] effect to (Colour)\n    if <(_Level) < [12]> then\n        if <key (e v) pressed?> then\n            wait until <not <key (e v) pressed?>>\n            Setup Player\n            change [_level v] by (1)\n            change [score v] by (-5)\n            broadcast (-5 points v)\n        end\n        if <key (r v) pressed?> then\n            Setup Player\n        end\n        if <(_Level) > [1]> then\n            if <key (q v) pressed?> then\n                wait until <not <key (q v) pressed?>>\n                Setup Player\n                change [_level v] by (-1)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\nhide variable [colour v]\nset [colour v] to [0]\nset [score v] to [0]\nshow variable [score v]\nset [_level v] to [1]\nbroadcast (Start Game v)\n\n@Level\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nSetup Level\n\ndefine Setup Level\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nclear graphic effects\nshow\ngo to [back v] layer\n\nwhen I receive [loop v]\nforever\n    switch costume to (_Level)\nend\n\n@Red\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start game v]\nswitch costume to (1 v)\nshow\nforever\n    switch costume to (_Level)\nend\n\n@Ice\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start game v]\nswitch costume to (costume1 v)\nshow\nforever\n    switch costume to (_Level)\nend\n\n@Yellow\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [start game v]\nswitch costume to (1 v)\nshow\nforever\n    switch costume to (_Level)\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    set [thumbnail timer v] to (timer)\nend\n\nwhen [timer v] > (Thumbnail Timer)\ngo to [front v] layer\nshow\n\n@Intro\n\nwhen I start as a clone\nswitch costume to (6 line explosion 1 v)\nset [color v] effect to (0)\nset size to (0) %\nrepeat (7)\n    next costume\n    change size by (((200) - (size)) / (4))\nend\nrepeat (5)\n    change [ghost v] effect by (10)\n    next costume\n    change size by (((200) - (size)) / (4))\n    wait (.05) seconds\nend\nswitch backdrop to (backdrop1 v)\ndelete this clone\n\nwhen I start as a clone\nshow\n\nwhen I receive [delete v]\ndelete this clone\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\npoint in direction (90)\nset size to (100) %\nclear graphic effects\nhide\ncreate clone of (_myself_ v)\n\n@ScoreText\n\nwhen flag clicked\ngo to x: (146) y: (-162)\ngo to [front v] layer\nshow\n\n@ScoreValue\n\nwhen flag clicked\ngo to x: (213) y: (-161)\ngo to [front v] layer\nhide\nclear graphic effects\n\nwhen I receive [-1 point v]\ngo to x: (213) y: (-161)\nclear graphic effects\nswitch costume to (-1 v)\nshow\nset [speed v] to [5]\nrepeat (9)\n    change y by (Speed)\n    change [speed v] by (-0.1)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [-5 points v]\ngo to x: (213) y: (-161)\nclear graphic effects\nswitch costume to (-5 v)\nshow\nset [speed v] to [5]\nrepeat (9)\n    change y by (Speed)\n    change [speed v] by (-0.1)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [+5 points v]\ngo to x: (213) y: (-161)\nclear graphic effects\nswitch costume to (+5 v)\nshow\nset [speed v] to [5]\nrepeat (9)\n    change y by (Speed)\n    change [speed v] by (-0.1)\n    change [ghost v] effect by (10)\nend\nhide\n\n@Sprite1\n\n
Check this out:\nhttps://scratch.mit.edu/projects/467573795/\n\nGo follow @AvengersNerd3000 !\n-------------------------------------------------------------------------\nArrow keys or WASD to move\nT to chat\nN to show name or hide name\nE to skip level (adds 5 deaths per skipped level)\nR to restart level\nQ to go back a level\n-------------------------------------------------------------------------Please love and fav!