Tutorial: 100% Pen Scrolling Platformer
@Stage\n\n@Slides\n\nwhen flag clicked\nerase all\nSlides Detector\nset [slides cam x v] to [0]\nset [slide v] to [1]\nset [vel v] to [4]\nset [change slide? v] to [0]\nClone Slides\nforever\n    Change Slides\n    Controls\n    broadcast (Position Slides v)\nend\n\ndefine Clone Slides\nshow\nset [x v] to [0]\nrepeat (clones)\n    create clone of (_myself_ v)\n    change [x v] by (480)\nend\nhide\n\nwhen I receive [position slides v]\nswitch costume to (big v)\ngo to x: ((x) - (SLIDES CAM X)) y: (0)\nswitch costume to (((x) / (480)) + (2))\n\ndefine Controls\nif <(change slide?) = [0]> then\n    set [change slide? v] to (<<key (right arrow v) pressed?> or <<key (space v) pressed?> or <mouse down?>>> - <key (left arrow v) pressed?>)\nend\nif <(SLIDES CAM X) < [0]> then\n    set [slides cam x v] to [0]\n    if <(change slide?) = [-1]> then\n        set [change slide? v] to [0]\n    end\nend\nset [max x v] to (((clones) - (1)) * (480))\nif <(SLIDES CAM X) > (max x)> then\n    set [slides cam x v] to (max x)\n    if <(change slide?) = [1]> then\n        set [change slide? v] to [0]\n    end\nend\n\ndefine Change Slides\nif <([abs v] of (change slide?) ) > [0]> then\n    set [max x v] to (((SLIDE) + ((change slide?) - (1))) * (480))\n    change [slides cam x v] by (((max x) - (SLIDES CAM X)) / (VEL))\n    if <(round (SLIDES CAM X)) = (max x)> then\n        change [slide v] by (change slide?)\n        set [change slide? v] to [0]\n    end\nend\n\ndefine Slides Detector\nswitch costume to (join [1] [])\nset [slide v] to (costume [name v])\nnext costume\nset [clones v] to [0]\nrepeat until <(SLIDE) = (costume [name v])>\n    next costume\n    change [clones v] by (1)\nend\n\nwhen flag clicked\nforever\n    set [i v] to [1]\n    repeat (length of [parts v])\n        if <key ((i) v) pressed?> then\n            set [change slide? v] to ((item (i) of [parts v]) - (SLIDE))\n        end\n        change [i v] by (1)\n    end\nend\n\n@TN\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n