(Pseudo) Pen Platformer - Tutorial!
@Stage\n\nwhen flag clicked\nbroadcast (Flag v)\nforever\n    reset timer\nend\n\nwhen [timer v] > (0)\nbroadcast (Stop v)\n\nwhen I receive [flag v]\nplay sound [intro v] until done\nforever\n    play sound [loop v] until done\nend\n\nwhen I receive [flag v]\nset volume to (50) %\nforever\n    wait until <not <key (m v) pressed?>>\n    wait until <key (m v) pressed?>\n    repeat (10)\n        change volume by (-5)\n    end\n    wait until <not <key (m v) pressed?>>\n    wait until <key (m v) pressed?>\n    repeat (10)\n        change volume by (5)\n    end\nend\n\nwhen I receive [flag v]\nbroadcast (Unload pages v) and wait\n\n@1. Physics\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nforever\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nforever\n    change [yv v] by (-1)\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (-4)\n        change x by ((Xv) * (-1))\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [17]\n            if <(Xv) > [0]> then\n                set [xv v] to [-10]\n            else\n                set [xv v] to [10]\n            end\n        else\n            set [xv v] to [0]\n        end\n    end\n    change y by (Yv)\n    if <touching color (#000000)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n        set [yv v] to [15]\n    end\n    change y by (1)\nend\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    Do physics\nend\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\n@2. Ground\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    erase all\n    Draw ground\n    Do physics\nend\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine Draw ground\nset pen color to (#000000)\nset pen size to (32)\nDraw line from [-240] [-100] to [240] [-100]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\ngo to x: (0) y: (0)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    erase all\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Draw ground\n    go to x: (Player X) y: (Player Y)\n    Do physics\nend\n\n@3. Player\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine Draw ground\nset pen color to (#000000)\nset pen size to (32)\nDraw line from [-240] [-100] to [240] [-100]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\ngo to x: (0) y: (0)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    erase all\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Draw ground\n    go to x: (Player X) y: (Player Y)\n    Do physics\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Draw player\n    go to x: (Player X) y: (Player Y)\nend\n\ndefine Draw square at (center x) (center y) and size (side length)\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen down\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (2)))\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen up\n\ndefine Draw player\nset pen color to (#000000)\nset pen size to (8)\nDraw square at (Player X) (Player Y) and size [16]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [player x v] to [0]\nset [player y v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    erase all\n    Draw ground\n    go to x: (Player X) y: (Player Y)\n    Do physics\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Draw player\nend\n\n@4. Special Detection\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine Draw level collision\nset pen size to (32)\nset pen color to (#ff0000)\nDraw line from [0] [-100] to [0] [-25]\nset pen color to (#000000)\nDraw line from [-240] [-100] to [240] [-100]\nset pen size to (8)\nset pen color to (#ff9400)\nDraw square at [200] [-25] and size [50]\n\ndefine Draw square at (center x) (center y) and size (side length)\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen down\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (2)))\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen up\n\ndefine Draw player\nset pen color to (#000000)\nset pen size to (8)\nDraw square at (Player X) (Player Y) and size [16]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [level v] to [0]\nReset player\nforever\n    erase all\n    Draw level collision\n    go to x: (Player X) y: (Player Y)\n    Do physics\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Do special collision\n    Draw player\nend\n\nset pen color to (#ff0000)\nDraw line from [] [] to [] []\n\nset pen color to (#ff9400)\nDraw square at [] [] and size []\n\nset pen color to (#2aff00)\nset pen size to (8)\nDraw line from [] [] to [] []\n\ndefine Do special collision\nif <<touching color (#ff0000)?> or <(y position) < [-170]>> then\n    Reset player\nend\nif <touching color (#ff9400)?> then\n    change [level v] by (1)\n    Reset player\nend\n\ndefine Reset player\nset [player x v] to [0]\nset [player y v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\n\n@5. Visual Design\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine Draw level collision\nset pen size to (32)\nset pen color to (#ff0000)\nDraw line from [0] [-100] to [0] [-25]\nset pen color to (#000000)\nDraw line from [-240] [-100] to [240] [-100]\nset pen size to (8)\nset pen color to (#ff9400)\nDraw square at [200] [-25] and size [50]\n\ndefine Draw square at (center x) (center y) and size (side length)\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen down\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (2)))\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen up\n\ndefine Draw player\nset pen color to (#1fd64f)\nset pen size to (2)\nDraw square at (Player X) (Player Y) and size [16]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [level v] to [0]\nReset player\nforever\n    Collision\n    Drawing\nend\n\ndefine Do special collision\nif <<touching color (#ff0000)?> or <(y position) < [-170]>> then\n    Reset player\nend\nif <touching color (#ff9400)?> then\n    change [level v] by (1)\n    Reset player\nend\n\ndefine Reset player\nset [player x v] to [-200]\nset [player y v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\n\ndefine Collision\nerase all\nDraw level collision\ngo to x: (Player X) y: (Player Y)\nDo physics\nset [player x v] to (x position)\nset [player y v] to (y position)\nDo special collision\n\ndefine Drawing\nerase all\nDraw level visual\nDraw player\n\ndefine Draw level visual\nset pen size to (2)\nset pen color to (#ff6251)\nDraw line from [-16] [-86] to [-16] [-10]\nDraw line from [-16] [-10] to [16] [-10]\nDraw line from [16] [-10] to [16] [-86]\nset pen color to (#1b1b1b)\nDraw line from [-240] [-86] to [240] [-86]\nset pen color to (#009dff)\nDraw square at [200] [-25] and size [58]\n\n@6. Scrolling\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2) with offset (ox) (oy)\ngo to x: ((x1) + (ox)) y: ((y1) + (oy))\npen down\ngo to x: ((x2) + (ox)) y: ((y2) + (oy))\npen up\n\ndefine Draw level collision with offset (ox) (oy)\nset pen size to (32)\nset pen color to (#ff0000)\nDraw line from [0] [-100] to [0] [-25] with offset (ox) (oy)\nset pen color to (#000000)\nDraw line from [-240] [-100] to [240] [-100] with offset (ox) (oy)\nset pen size to (8)\nset pen color to (#ff9400)\nDraw square at [200] [-25] and size [50] with offset (ox) (oy)\n\ndefine Draw square at (center x) (center y) and size (side length) with offset (ox) (oy)\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (2)))\npen down\ngo to x: (((center x) + (ox)) + ((side length) / (-2))) y: (((center y) + (oy)) + ((side length) / (2)))\ngo to x: (((center x) + (ox)) + ((side length) / (-2))) y: (((center y) + (oy)) + ((side length) / (-2)))\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (-2)))\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (2)))\npen up\n\ndefine Draw player\nset pen color to (#1fd64f)\nset pen size to (2)\nDraw square at [0] [0] and size [16] with offset [0] [0]\n\nwhen I receive [broadcast / when \[green flag\] clicked v]\nset [level v] to [0]\nReset player\nforever\n    Collision\n    Drawing\nend\n\ndefine Do special collision\nif <<touching color (#ff0000)?> or <(Player Y) < [-200]>> then\n    Reset player\nend\nif <touching color (#ff9400)?> then\n    change [level v] by (1)\n    Reset player\nend\n\ndefine Reset player\nset [player x v] to [-200]\nset [player y v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\n\ndefine Collision\nerase all\nDraw level collision with offset (() - (Player X)) (() - (Player Y))\ngo to x: (0) y: (0)\nDo physics\nchange [player x v] by (x position)\nchange [player y v] by (y position)\nDo special collision\n\ndefine Drawing\nset size to (10000) %\nerase all\nDraw level visual with offset (() - (Player X)) (() - (Player Y))\nDraw player\nset size to (100) %\n\ndefine Draw level visual with offset (ox) (oy)\nset pen size to (2)\nset pen color to (#ff6251)\nDraw line from [-16] [-86] to [-16] [-10] with offset (ox) (oy)\nDraw line from [-16] [-10] to [16] [-10] with offset (ox) (oy)\nDraw line from [16] [-10] to [16] [-86] with offset (ox) (oy)\nset pen color to (#1b1b1b)\nDraw line from [-240] [-86] to [240] [-86] with offset (ox) (oy)\nset pen color to (#009dff)\nDraw square at [200] [-25] and size [58] with offset (ox) (oy)\n\n@[IGNORE] Thumbnail\n\nwhen I receive [flag v]\ngo to [front v] layer\nset [ghost v] effect to (0)\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nhide\n\nwhen I receive [stop v]\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\n@[IGNORE] Text\n\nwhen I receive [flag v]\nshow\ngo to [back v] layer\nset [\[ignore\] textx v] to [0]\nset [\[ignore\] texty v] to [-360]\nset [\[ignore\] pagenumber v] to [1]\nset [\[ignore\] maxpage v] to [60]\nset [\[ignore\] frame v] to [0]\nset [\[ignore\] changeto v] to [0]\nset [_state v] to [0]\nClones\nset [_change v] to [0]\nset [_state v] to [0]\nset [_timer v] to [0]\nset [_scrollstart v] to [0]\nforever\n    go to [front v] layer\n    change [\[ignore\] frame v] by (4)\n    change [\[ignore\] texty v] by (((([sin v] of (\[IGNORE\] frame) ) * (5)) - (\[IGNORE\] textY)) / (8))\n    Check drag or tap\n    Scroll\n    if <<<key (right arrow v) pressed?> or <<(_timer) = [tap]> and <(mouse x) > [0]>>> and <<(\[IGNORE\] pageNumber) < (\[IGNORE\] maxPage)> and <(_state) = [0]>>> then\n        set [_change v] to [-1]\n        set [_state v] to [1]\n        broadcast (join [Change page ] (\[IGNORE\] pageNumber))\n    end\n    if <<<key (left arrow v) pressed?> or <<(_timer) = [tap]> and <(mouse x) < [0]>>> and <<(\[IGNORE\] pageNumber) > [1]> and <(_state) = [0]>>> then\n        set [_change v] to [1]\n        set [_state v] to [-1]\n        broadcast (join [Change page ] (\[IGNORE\] pageNumber))\n    end\n    if <([abs v] of (_state) ) = [1]> then\n        Change page to ((\[IGNORE\] pageNumber) + (_state)) (_state)\n    end\n    if <([abs v] of (_state) ) = [2]> then\n        set [\[ignore\] changeto v] to [0]\n        change [\[ignore\] textx v] by (((0) - (\[IGNORE\] textX)) / (3))\n        if <([abs v] of (x position) ) < [1]> then\n            set [\[ignore\] textx v] to [0]\n            set [_state v] to [0]\n        end\n    end\n    if <(\[IGNORE\] changeTo) > [0]> then\n        if <([abs v] of (_state) ) = [3]> then\n            Change page to (\[IGNORE\] changeTo) ((_state) / (-3))\n        else\n            set [_change v] to (<(\[IGNORE\] changeTo) < (\[IGNORE\] pageNumber)> - <(\[IGNORE\] changeTo) > (\[IGNORE\] pageNumber)>)\n            set [_state v] to ((_change) * (-3))\n        end\n    end\n    go to x: (\[IGNORE\] textX) y: (\[IGNORE\] textY)\n    switch costume to (join [page] (\[IGNORE\] pageNumber))\nend\n\nwhen I start as a clone\nif <(_state) = [-1]> then\n    switch costume to (overlay v)\n    set size to (50) %\n    forever\n        go to [back v] layer\n        go to x: (\[IGNORE\] textX) y: ((\[IGNORE\] textY) + (\[IGNORE\] scrollY))\n        switch costume to (empty v)\n        switch costume to (join [script] (\[IGNORE\] pageNumber))\n        if <(item (\[IGNORE\] pageNumber) of [yscrolls v]) > [450]> then\n            set size to (50) %\n        else\n            set size to (75) %\n        end\n    end\nend\nif <(_state) = [-2]> then\n    go to x: (0) y: (0)\n    switch costume to (overlay v)\n    set [ghost v] effect to (100)\n    forever\n        if <(item (\[IGNORE\] pageNumber) of [yscrolls v]) > [0]> then\n            change [ghost v] effect by (-10)\n        else\n            change [ghost v] effect by (10)\n        end\n    end\nend\nif <(_state) = [-3]> then\n    hide\nend\n\ndefine Scroll\nif <(_timer) = [drag]> then\n    set [\[ignore\] scrolly v] to ((_lastScroll) + ((mouse y) - (_scrollStart)))\nend\nif <(\[IGNORE\] scrollY) < [0]> then\n    set [\[ignore\] scrolly v] to [0]\nend\nif <(\[IGNORE\] scrollY) > (item (\[IGNORE\] pageNumber) of [yscrolls v])> then\n    set [\[ignore\] scrolly v] to (item (\[IGNORE\] pageNumber) of [yscrolls v])\nend\n\ndefine Check drag or tap\nif <mouse down?> then\n    if <((_timer) * (1)) > [3]> then\n        set [_timer v] to [drag]\n        set [_scrollstart v] to (mouse y)\n        set [_lastscroll v] to (\[IGNORE\] scrollY)\n    else\n        if <not <(_timer) = [drag]>> then\n            change [_timer v] by (1)\n        end\n    end\nelse\n    if <<(_timer) = [drag]> or <<(_timer) = [tap]> or <(_timer) = [0]>>> then\n        set [_timer v] to [0]\n    else\n        set [_timer v] to [tap]\n    end\nend\nif <<key (space v) pressed?> and <(\[IGNORE\] changeTo) = [0]>> then\n    set [\[ignore\] changeto v] to [-1]\n    broadcast (Change page to number v)\nend\n\nwhen [up arrow v] key pressed\nchange [\[ignore\] scrolly v] by (-10)\n\nwhen [down arrow v] key pressed\nchange [\[ignore\] scrolly v] by (10)\n\nwhen I receive [change page scripts v]\nbroadcast (Unload pages v) and wait\nbroadcast (join [Load page ] (\[IGNORE\] pageNumber))\n\nwhen I receive [change page to number v]\nif <(_state) = [-3]> then\n    ask (join [Change to what page \(between 1 and ] (join (\[IGNORE\] maxPage) [\)])) and wait\n    if <<<((answer) * (1)) = (answer)> and <(answer) > [0]>> and <<(answer) < ((\[IGNORE\] maxPage) + (1))> and <not <(answer) = (\[IGNORE\] pageNumber)>>>> then\n        broadcast (join [Change page ] (\[IGNORE\] pageNumber))\n        set [\[ignore\] changeto v] to (answer)\n    else\n        set [\[ignore\] changeto v] to [0]\n    end\nend\n\ndefine Clones\nrepeat (3)\n    change [_state v] by (-1)\n    create clone of (_myself_ v)\nend\n\ndefine Change page to (p) (state)\nchange [_change v] by ((_change) / (2))\nchange [\[ignore\] textx v] by (_change)\nif <([abs v] of (\[IGNORE\] textX) ) > [380]> then\n    set [\[ignore\] textx v] to (() - (\[IGNORE\] textX))\n    set [\[ignore\] scrolly v] to [0]\n    set [\[ignore\] pagenumber v] to (p)\n    broadcast (Change page scripts v)\n    change [_state v] by (state)\nend\n\n@[IGNORE] Animations\n\nwhen I receive [unload pages v]\nclear graphic effects\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [load page 13 v]\nSetup [1]\n\nwhen I receive [change frame v]\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nchange [frame v] by (1)\nFrame for animation (animation)\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nset [time v] to (days since 2000)\n\ndefine Frame for animation (a)\nswitch costume to (move v)\nswitch costume to (join (join [a] (a)) (join [f] (frame)))\nif <(costume [name v]) = [move]> then\n    set [frame v] to [1]\n    switch costume to (join (join [a] (a)) [f1])\nend\n\nwhen I receive [load page 15 v]\nSetup [2]\n\ndefine Setup (animation)\nshow\nset [frame v] to [1]\nset [animation v] to (animation)\nset [time v] to (days since 2000)\nbroadcast (loop v)\n\nwhen I receive [loop v]\nforever\n    switch costume to (move v)\n    go to x: (\[IGNORE\] textX) y: (\[IGNORE\] textY)\n    Frame for animation (animation)\n    if <(((days since 2000) - (time)) * (86400)) > [4]> then\n        set [time v] to (days since 2000)\n        broadcast (Change frame v)\n    end\nend\n\nwhen I receive [load page 25 v]\nSetup [3]\n\nwhen I receive [load page 53 v]\nSetup [4]\n\n@[IGNORE] Demo\n\nwhen I receive [unload pages v]\nerase all\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [load page 9 v]\nshow\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    Go to transition position for script [1]\nend\nforever\n    Do physics\nend\n\ndefine Do physics\nchange [yv v] by (-1)\nif <key (a v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (d v) pressed?> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (1)\nend\nif <touching color (#000000)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <key (w v) pressed?> then\n        set [yv v] to [10]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (w v) pressed?> and <touching color (#000000)?>> then\n    set [yv v] to [12]\nend\nchange y by (1)\n\nwhen I receive [change page 9 v]\nstop [other scripts in sprite v]\nSet position for script [1]\nforever\n    Go to transition position for script [1]\nend\n\nwhen I receive [flag v]\ninit\n\ndefine Draw ground (x shift) (y shift)\nset pen color to (#000000)\nset pen size to (64)\nDraw line from ((-240) + (x shift)) ((-180) + (y shift)) to ((240) + (x shift)) ((-180) + (y shift))\n\ndefine Draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\nwhen I receive [load page 21 v]\nshow\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Go to transition position for script [2]\nend\nforever\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    go to x: (Player X) y: (Player Y)\n    Do physics\nend\n\nwhen I receive [change page 21 v]\nstop [other scripts in sprite v]\nSet position for script [2]\nforever\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Go to transition position for script [2]\nend\n\ndefine Go to transition position for script (n)\nswitch costume to (position v)\ngo to x: ((\[IGNORE\] textX) + (item (((n) * (2)) - (1)) of [lastpositions v])) y: ((\[IGNORE\] textY) + (item ((n) * (2)) of [lastpositions v]))\nswitch costume to (hitbox v)\n\ndefine Set position for script (n)\nreplace item (((n) * (2)) - (1)) of [lastpositions v] with (x position)\nreplace item ((n) * (2)) of [lastpositions v] with ((y position) - (\[IGNORE\] textY))\n\nwhen I receive [change page 31 v]\nstop [other scripts in sprite v]\ngo to x: (Player X) y: (Player Y)\nSet position for script [3]\nforever\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Go to transition position for script [3]\n    Draw player (x position) (y position)\nend\n\nwhen I receive [load page 31 v]\nhide\nset [player x v] to (item (5) of [lastpositions v])\nset [player y v] to (item (6) of [lastpositions v])\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Draw player ((Player X) + (\[IGNORE\] textX)) (Player Y)\nend\nforever\n    erase all\n    Draw ground (\[IGNORE\] textX) (\[IGNORE\] textY)\n    go to x: (Player X) y: (Player Y)\n    Do physics\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Draw player (Player X) (Player Y)\nend\n\ndefine Draw player (x) (y)\nset pen color to (#000000)\nset pen size to (2)\nDraw square at (x) (y) and size [16]\n\ndefine Draw square at (center x) (center y) and size (side length)\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen down\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (2)))\ngo to x: ((center x) + ((side length) / (-2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (-2)))\ngo to x: ((center x) + ((side length) / (2))) y: ((center y) + ((side length) / (2)))\npen up\n\nwhen I receive [change page 39 v]\nstop [other scripts in sprite v]\ngo to x: (Player X) y: (Player Y)\nSet position for script [4]\nforever\n    erase all\n    Draw level collision (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Go to transition position for script [4]\n    Draw player (x position) (y position)\nend\n\nwhen I receive [load page 39 v]\nhide\nset [player x v] to (item (7) of [lastpositions v])\nset [player y v] to (item (8) of [lastpositions v])\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    erase all\n    Draw level collision (\[IGNORE\] textX) (\[IGNORE\] textY)\n    Draw player ((Player X) + (\[IGNORE\] textX)) (Player Y)\nend\nforever\n    erase all\n    Draw level collision (\[IGNORE\] textX) (\[IGNORE\] textY)\n    go to x: (Player X) y: (Player Y)\n    Do physics\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    Do special collision\n    Draw player (Player X) (Player Y)\nend\n\ndefine init\nset [xv v] to [0]\nset [yv v] to [0]\ndelete all of [lastpositions v]\nrepeat (3)\n    add [0] to [lastpositions v]\n    add [-100] to [lastpositions v]\nend\nrepeat (3)\n    add [-200] to [lastpositions v]\n    add [-100] to [lastpositions v]\nend\n\ndefine Draw level collision (x shift) (y shift)\nset pen size to (32)\nset pen color to (#ff0000)\nDraw line from ((0) + (x shift)) ((-180) + (y shift)) to ((0) + (x shift)) ((-120) + (y shift))\nset pen size to (64)\nset pen color to (#000000)\nDraw line from ((-240) + (x shift)) ((-180) + (y shift)) to ((240) + (x shift)) ((-180) + (y shift))\nset pen size to (8)\nset pen color to (#ff9400)\nDraw square at ((200) + (x shift)) ((-75) + (y shift)) and size [50]\n\ndefine Reset player\nset [player x v] to [-200]\nset [player y v] to [-100]\nset [xv v] to [0]\nset [yv v] to [0]\n\ndefine Do special collision\nif <<touching color (#ff0000)?> or <(Player Y) < [-170]>> then\n    Reset player\nend\nif <touching color (#ff9400)?> then\n    change [level v] by (1)\n    Reset player\nend\n\ndefine Draw level visual (x shift) (y shift)\nset pen size to (2)\nset pen color to (#ff6251)\nDraw line from ((-16) + (x shift)) ((-148) + (y shift)) to ((-16) + (x shift)) ((-104) + (y shift))\nDraw line from ((-16) + (x shift)) ((-104) + (y shift)) to ((16) + (x shift)) ((-104) + (y shift))\nDraw line from ((16) + (x shift)) ((-104) + (y shift)) to ((16) + (x shift)) ((-148) + (y shift))\nset pen color to (#1b1b1b)\nDraw line from ((-240) + (x shift)) ((-148) + (y shift)) to ((240) + (x shift)) ((-148) + (y shift))\nset pen color to (#009dff)\nDraw square at ((200) + (x shift)) ((-75) + (y shift)) and size [58]\n\ndefine Draw player pt2 (x) (y)\nset pen color to (#1fd64f)\nset pen size to (2)\nDraw square at (x) (y) and size [12]\n\ndefine Drawing (x) (y)\nswitch costume to (position v)\nerase all\nDraw level visual (x) (y)\nDraw player pt2 ((Player X) + (x)) ((Player Y) + (y))\nswitch costume to (hitbox v)\n\ndefine Collision\nerase all\nDraw level collision [0] [0]\ngo to x: (Player X) y: (Player Y)\nDo physics\nset [player x v] to (x position)\nset [player y v] to (y position)\nDo special collision\n\nwhen I receive [change page 47 v]\nstop [other scripts in sprite v]\nSet position for script [5]\nforever\n    Drawing (\[IGNORE\] textX) (\[IGNORE\] textY)\nend\n\nwhen I receive [load page 47 v]\nhide\nset [player x v] to (item (9) of [lastpositions v])\nset [player y v] to (item (10) of [lastpositions v])\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    Drawing (\[IGNORE\] textX) (\[IGNORE\] textY)\nend\nforever\n    Collision\n    Drawing (\[IGNORE\] textX) (\[IGNORE\] textY)\nend\n\nwhen I receive [load page 57 v]\nhide\nset [player x v] to (item (11) of [lastpositions v])\nset [player y v] to (item (12) of [lastpositions v])\nrepeat until <(round (\[IGNORE\] textX)) = [0]>\n    Drawing ((\[IGNORE\] textX) - (Player X)) (((\[IGNORE\] textY) + (-40)) - (Player Y))\nend\nforever\n    Scrolling collision\n    Drawing ((\[IGNORE\] textX) - (Player X)) (((\[IGNORE\] textY) + (-40)) - (Player Y))\nend\n\ndefine Scrolling collision\nerase all\nDraw level collision (() - (Player X)) (() - (Player Y))\ngo to x: (0) y: (0)\nDo physics\nchange [player x v] by (x position)\nchange [player y v] by (y position)\nDo special collision\n\nwhen I receive [change page 57 v]\nstop [other scripts in sprite v]\nreplace item (11) of [lastpositions v] with (Player X)\nreplace item (12) of [lastpositions v] with (Player Y)\nforever\n    Drawing ((\[IGNORE\] textX) - (Player X)) (((\[IGNORE\] textY) + (-40)) - (Player Y))\nend\n\n
Please watch in fullscreen!\n\nSpace to select a page\nM to mute the music