NoteBook || Platformer

Instructions: 1. Click the green flag.\n2. WAD or Cursor key to move.\n3. Avoid the spikes.\n4. In some of the levels, you can draw a line to let the stick man get past.\n5. Have fun!\n6. Love❤ or Favourite⭐ or follow❤ or I will steal your candy!\n7.check out: https://scratch.mit.edu/projects/323761892/\n

@Stage\n\n@You\n\nwhen flag clicked\ngo to x: (-210) y: (-100)\npoint in direction (90)\nset [level v] to [1]\nset [death v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    Platform [3.5] [11] [0.6] [-1]\n    if <touching color (#330000)?> then\n        change [death v] by (1)\n        go to x: (-210) y: (-100)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <<(y position) < [-178]> and <touching (_edge_ v)?>> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (-210) y: (-100)\n    end\n    if <<(x position) > [237]> and <touching (_edge_ v)?>> then\n        change [level v] by (1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (-210) y: (-100)\n        broadcast (clear last level v)\n    end\n    if <key (r v) pressed?> then\n        go to x: (-210) y: (-100)\n        erase all\n    end\n    if <touching color (#4d4d4d)?> then\n        set [yv v] to [15]\n    end\nend\n\ndefine Platform (move) (jump) (fric) (grav)\nswitch costume to (idle v)\nchange y by (Yv)\nif <touching color (#000000)?> then\n    repeat ([abs v] of (Yv) )\n        if <touching color (#000000)?> then\n            change y by ((([abs v] of (Yv) ) / (Yv)) * (-1))\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <not <(Yv) > [0]>>> then\n        set [yv v] to (jump)\n    else\n        set [yv v] to [0]\n    end\nelse\n    change [yv v] by (grav)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [xv v] by (move)\n    point in direction (90)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [xv v] by ((move) * (-1))\n    point in direction (-90)\nend\nchange x by (Xv)\nif <touching color (#000000)?> then\n    set [slope v] to (y position)\n    repeat (([abs v] of (Xv) ) + (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 (Slope)\n        repeat ([ceiling v] of ([abs v] of (Xv) ) )\n            if <touching color (#000000)?> then\n                change x by ((([abs v] of (Xv) ) / (Xv)) * (-1))\n            end\n        end\n        set [xv v] to [0]\n    end\nend\nset [xv v] to ((Xv) * (fric))\nswitch costume to (idle v)\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    switch costume to (walk)\nend\nif <(Yv) > [1]> then\n    switch costume to (jump v)\nend\nif <(Yv) < [-2]> then\n    switch costume to (fall v)\nend\n\nwhen flag clicked\nset [walk v] to [5]\nforever\n    change [walk v] by (1)\n    if <(walk) > [8]> then\n        set [walk v] to [5]\n    end\n    wait (0.03) seconds\nend\n\n@Ground\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nset [level v] to [9]\n\n@PEN\n\nwhen flag clicked\nerase all\nset pen size to (4)\nset pen color to (#000000)\nforever\n    go to (mouse-pointer v)\n    if <<<(Level) = [5]> or <(Level) = [6]>> or <(Level) = [7]>> then\n        if <mouse down?> then\n            pen down\n        else\n            pen up\n        end\n        if <key (c v) pressed?> then\n            erase all\n        end\n    end\nend\n\nstamp\n\nwhen I receive [clear last level v]\nerase all\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    show\n    set [ghost v] effect to (100)\nend\n\n@Intro\n\nwhen flag clicked\ninitialize\nshow\nrepeat (24)\n    create clone of (_myself_ v)\n    wait (0.05) seconds\n    next costume\nend\n\ndefine initialize\nset size to (65) %\nhide\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (imgres v)\ngo to [front v] layer\npoint in direction (90)\n\nwhen I start as a clone\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (3) seconds\nset [move v] to [0]\nrepeat (25)\n    change [move v] by (-1)\n    change x by ((move) * (-1))\n    change [ghost v] effect by (4)\n    turn left ((1.8) * (move)) degrees\nend\n\n