Scratch || A Platformer (WIP)
@Stage\n\nwhen flag clicked\nswitch backdrop to (xy-grid-30px v)\nbroadcast (Start Menu v)\n\n@Empty\n\n@Main Menu\n\nwhen I receive [back v]\nshow\n\nwhen this sprite clicked\nbroadcast (Start Game v)\nstart sound [Meow v]\nhide\n\nwhen I receive [start menu v]\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (130) %\n        set [brightness v] effect to (20)\n    else\n        set size to (100) %\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [intructions v]\nhide\n\nwhen flag clicked\nif <not <(username) = [Thomas282]>> then\n    set [☁ who visited my project v] to [1]\nend\ngo to x: (0) y: (0)\n\nwhen I receive [play game v]\nhide\n\n@Ground\n\nwhen I receive [start menu v]\nhide\n\nwhen I receive [start game v]\nshow\n\nwhen I receive [next lvl v]\nnext costume\n\nwhen flag clicked\nswitch costume to (level 1 1 v)\nhide\n\n@Scratch cat\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nGet Touching <not <up?>>\nif <<(speed y) = [0]> and <(touch) = [1]>> then\n    set [in platforrm v] to [2]\nelse\n    if <(touch) = [0]> then\n        set [in platforrm v] to [1]\n    end\nend\nrepeat until <(touch) < (in platforrm)>\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]\n    Get Touching <not <up?>>\nend\n\ndefine Get Touching <check platform?>\nif <<touching (ground v)?> or <touching (moving platform v)?>> then\n    set [touch v] to [9]\nelse\n    if <<check platform?> and <<touching (ground v)?> or <touching (moving platform v)?>>> then\n        set [touch v] to [1]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nGet Touching <>\nrepeat until <<(slope) = [8]> or <(touch) = [0]>>\n    change y by (1)\n    change [slope v] by (1)\n    Get Touching <>\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> 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 [frame2 v] by ((speed) / (-8))\nelse\n    change [frame2 v] by ((speed) / (8))\nend\n\nwhen flag clicked\ngo to [front v] layer\n\ndefine Reset Level\nset rotation style [left-right v]\ngo to x: (-200) y: (71)\nreset timer\nshow\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling? v] to [10]\nset [in platforrm v] to [1]\nset [frame2 v] to [0]\nset [wall jump v] to [0]\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame2) = [0]> then\n        switch costume to (stand_1 v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame2) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump_1 v)\n    else\n        switch costume to (fall_1 v)\n    end\nend\n\nwhen I receive [start game v]\nshow\nset size to (25) %\nReset Level\nforever\n    if <<(speed y) < [4]> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> 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    switch costume to (hitbox v)\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 (a v) pressed?> or <key (left arrow v) pressed?>> then\n            change [speed x v] by (-1.5)\n        end\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            change [speed x v] by (1.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 [frame2 v] to [0]\n        end\n    end\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> 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 <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n        set [in platforrm v] to [2]\n    end\n    if <(x position) > [235]> then\n        broadcast (next lvl v)\n    end\n    if <(y position) < [-189]> then\n        go to x: (-199) y: (71)\n    end\n    if <key (r v) pressed?> then\n        go to x: (-199) y: (71)\n    end\n    if <touching (lava v)?> then\n        go to x: (-199) y: (71)\n        start sound [Meow2 v]\n    end\n    Set Costume\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [next lvl v]\ngo to x: (-208) y: (71)\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (1-1 v)\ngo to x: (0) y: (0)\nhide\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nswitch costume to (level 1 1 v)\nhide\nforever\n    switch costume to ([costume # v] of [ground v])\nend\n\nwhen I receive [start game v]\nshow\nforever\n    repeat (30)\n        change y by (1)\n    end\n    wait (0.1) seconds\n    repeat (30)\n        change y by (-1)\n    end\nend\n\nwhen I receive [start menu v]\nhide\n\n
READ HERE BEFORE PLAYING ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓\nThis is a test project, so the levels repeat each other,I will add new levels when I draw new blocks\n↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑\n\n-------------------------------------\nControls:\nWAD and Arrows to move\nPress 'R' to restart level\n-------------------------------------