Adventure  ||  A platformer
@Stage\n\n@Player\n\ndefine Position\ngo to x: (round (((x_cos) - (Scroll X)) - (80))) y: (round ((y_cos) - (Scroll Y)))\n\ndefine X_move (xv)\nchange [x_cos v] by (xv)\nPosition\nif <touching (platforms v)?> then\n    repeat (6)\n        change [y_cos v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y_cos v] by (-6)\n    repeat until <not <touching (platforms v)?>>\n        if <(xv) > [0]> then\n            change [x_cos v] by (-1)\n        else\n            change [x_cos v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Y_move (yv)\nchange [y_cos v] by (yv)\nchange [time_jump v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(yv) > [0]> then\n        change [y_cos v] by (-2)\n    else\n        change [y_cos v] by (1)\n        set [time_jump v] to [0]\n    end\n    Position\n    set [yv v] to [0]\nend\n\ndefine Tick\nbroadcast (tick v)\ngo to [front v] layer\ngo [backward v] (1) layers\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    if <not <(x position) > [210]>> then\n        point in direction (90)\n        change [xv v] by (0.7)\n    end\nend\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    if <not <(x position) < [-210]>> then\n        point in direction (-90)\n        change [xv v] by (-0.7)\n    end\nend\nset [xv v] to ((Xv) * (0.9))\nif <([abs v] of (Xv) ) > [0.9]> then\n    X_move ((Boost) * (Xv))\nend\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <(time_jump) = [0]> then\n        set [yv v] to ((Boost) * (16))\n    end\nend\nchange [yv v] by (-2)\nY_move (Yv)\nPosition\nchange [scroll x v] by (round (((x_cos) - (Scroll X)) / (4)))\nchange [scroll y v] by (round (((y_cos) - (Scroll Y)) / (2)))\nif <(Scroll X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(Scroll X) > [2400]> then\n    set [scroll x v] to [2400]\nend\nPosition\n\nwhen flag clicked\nset size to (15) %\nReset Player\nbroadcast (Setup Game v)\nbroadcast (tick v)\nwait (0) seconds\nforever\n    set [coustom v] to (costume [number v])\n    switch costume to (t9 v)\n    if <<(Scroll Y) < [-400]> or <touching color (#d21827)?>> then\n        Reset Player\n    end\n    Tick\n    if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<key (a v) pressed?> or <key (left arrow v) pressed?>>> then\n        Coustom ((coustom) + (1))\n    else\n        switch costume to (t10 v)\n    end\nend\n\ndefine Reset Player\nset rotation style [left-right v]\npoint in direction (90)\nset [x_cos v] to [-100]\nset [y_cos v] to [40]\nset [scroll x v] to (x_cos)\nset [scroll y v] to (y_cos)\nset [boost v] to [1.4]\nset [time_jump v] to [10]\nset [yv v] to [0]\nset [xv v] to [0]\n\ndefine Coustom ()\nswitch costume to (t v)\nrepeat (() - (1))\n    next costume\nend\n\n@Platforms\n\nwhen I receive [setup game v]\nhide\nswitch costume to (costume3 v)\nset [x v] to [0]\nset [y v] to [0]\nrepeat (1)\n    delete this clone\nend\nMake clones | </clones> [6] </stage> [1] </alignment> [L] </costume> [6]\nMake clones | </clones> [4] </stage> [2] </alignment> [R] </costume> [12]\n\nwhen I start as a clone\nMove ((X) - (Scroll X)) ((Y) - (Scroll Y))\nif <(X) > [2400]> then\n    delete this clone\nend\n\nwhen I receive [tick v]\nMove ((X) - (Scroll X)) ((Y) - (Scroll Y))\nif <(X) > [2400]> then\n    hide\nend\n\ndefine Move (x) (y)\ngo to x: (x) y: (y)\nset [ghost v] effect to (0)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\n\ndefine Make clones | </clones> (number of clones) </stage> (number of the stage) </alignment> (left/right) </costume> (costume)\nswitch costume to ((costume) - (1))\nset [y v] to (((number of the stage) - (1)) * (360))\nif <(left/right) = [L]> then\n    set [x v] to [0]\n    repeat (number of clones)\n        next costume\n        create clone of (_myself_ v)\n        change [x v] by (480)\n    end\nelse\n    if <(left/right) = [R]> then\n        set [x v] to ((2880) - ((number of clones) * (480)))\n        repeat (number of clones)\n            next costume\n            create clone of (_myself_ v)\n            change [x v] by (480)\n        end\n    end\nend\n\n@Sprajt1\n\nwhen flag clicked\ngo to [front v] layer\nclear graphic effects\ngo to x: (0) y: (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n
Demo instructions   \nRotate / Move camera - Arrows keys [← → ↑ ↓]\nW - go Forward   S - go Backward\nA - go Left           D - go Right\n[Space] Jump (hold for larger jump)\nEmpty engine - https://scratch.mit.edu/projects/437548352/