Scrolling Platformer Engine
@Stage\n\n@Sprite3\n\n@Sprite1\n\nwhen flag clicked\nset [size of level v] to [200]\nset [xv v] to [0]\nset [yv v] to [0]\nshow\ngo to x: (336) y: (195)\nswitch costume to (this should be last costume v)\nset size to (Size of Level) %\nswitch costume to (costume3 v)\nforever\n    if <(y position) > [800]> then\n        broadcast (oof v)\n        wait (1) seconds\n    else\n        if <<<mouse down?> and <(mouse x) > [0]>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n            set [xv v] to [8]\n        end\n        if <<<mouse down?> and <(mouse x) < [0]>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n            set [xv v] to [-8]\n        end\n        set [xv v] to ((XV) * (0.75))\n        change x by ((-1) * (XV))\n    end\n    if <touching (player v)?> then\n        change y by (-1)\n        if <touching (player v)?> then\n            change y by (-1)\n            if <touching (player v)?> then\n                change y by (-1)\n                if <touching (player v)?> then\n                    change y by (-1)\n                    if <touching (player v)?> then\n                        change y by (-1)\n                        if <touching (player v)?> then\n                            change x by (XV)\n                            set [xv v] to [0]\n                            change y by (5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (1)\n    change y by (YV)\n    if <touching (player v)?> then\n        change y by ((YV) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (1)\n    if <<touching (player v)?> and <<key (up arrow v) pressed?> or <<<mouse down?> and <((mouse y) - (28)) > [50]>> or <key (w v) pressed?>>>> then\n        set [yv v] to ((0) - ((Size of Level) / (14)))\n    end\n    change y by (-1)\n    broadcast (Move Spike v)\nend\n\nwhen I receive [oof v]\nset [xv v] to [0]\ngo to x: (336) y: (185)\nset [yv v] to [0]\nswitch costume to (this should be last costume v)\nset size to (200) %\nswitch costume to (costume3 v)\n\ngo to x: (200) y: (156)\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [1]> then\n        if <(x position) = []> then\n            next costume\n            set [xv v] to [0]\n            go to x: (336) y: (185)\n            set [yv v] to [0]\n            switch costume to (this should be last costume v)\n            set size to (200) %\n            switch costume to (costume3 v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (this should be last costume v)\n    set size to (Size of Level) %\n    switch costume to (costume3 v)\nend\n\nwhen flag clicked\nforever\n    hide variable [size of level v]\nend\n\n@Player\n\nwhen flag clicked\nshow\ngo to x: (-50) y: (21)\nset rotation style [left-right v]\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (costume1 v)\n    set size to ((Size of Level) / (2)) %\n    switch costume to ( v)\nend\n\nwhen flag clicked\nforever\n    play sound [hyaena v] until done\nend\n\nwhen flag clicked\nforever\n    set [pitch v] effect to ((YV) * (-1))\nend\n\nwhen I receive [oof v]\nchange [pan left/right v] effect by (-10)\n\n@Sprite2\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo [backward v] (2) layers\nforever\n    switch costume to (set this to last costume v)\n    set size to (Size of Level) %\n    switch costume to (costume1 v)\nend\n\ndefine FAST\ngo to (sprite1 v)\ngo to (sprite1 v)\ngo to (sprite1 v)\ngo to (sprite1 v)\ngo to (sprite1 v)\ngo to (sprite1 v)\n\nwhen I receive [move spike v]\nforever\n    FAST\n    if <touching (player v)?> then\n        broadcast (oof v)\n    end\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (2) layers\nhide\nforever\n    create clone of (_myself_ v)\n    wait (4) seconds\nend\n\nwhen I start as a clone\nshow\ngo to x: (300) y: (126)\nglide (7) secs to x: (-300) y: (126)\ndelete this clone\n\n@KEEP THIS\n\nwhen flag clicked\ngo to [front v] layer\nshow\n\n@Sprite5\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Sprite6\n\nwhen flag clicked\nset [ghost v] effect to (0)\nwait (1.4) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n
All info on how the code works is inside, you can move with the arrow keys (left arrow move left, right arrow move right, up arrow jump), and the player just stays in place while the ground moves, giving the illusion most scrolling platformers like Mario have. actually most professional platformers are scrolling ones, and many of these have complex code, so I attempted to make a simpler one. \nUSE WITH CREDIT\nReshared on main after deleting everything for April fools\nDOUBLE CLICK THE FLAG