Platformer Tutorial ✦ #tutorials #all
@Stage\n\n@Tutorial\n\nwhen I receive [setup project v]\ngo to x: (0) y: (0)\nswitch costume to (slide-1 v)\nshow\nforever\n    if <<<<key (space v) pressed?> or <key (right arrow v) pressed?>> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > [0]>>>> and <(costume [number v]) < [14]>> then\n        change x by (-1)\n        repeat (22)\n            change x by ((x position) * (0.333333333333))\n        end\n        set x to (561)\n        next costume\n        repeat (22)\n            change x by ((x position) * (-0.333333333333))\n        end\n        set x to (0)\n    end\n    if <<<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < [0]>>>> and <(costume [number v]) > [1]>> then\n        change x by (1)\n        repeat (22)\n            change x by ((x position) * (0.333333333333))\n        end\n        set x to (-561)\n        switch costume to ((costume [number v]) - (1))\n        repeat (22)\n            change x by ((x position) * (-0.333333333333))\n        end\n        set x to (0)\n    end\nend\n\ngo to x: (561) y: (0)\n\nwhen flag clicked\nhide\n\n@Music\n\nwhen I receive [end intro v]\nforever\n    play sound [fall-with-me-ncs-release v] until done\nend\n\n@Intro\n\ndefine Clone (#) (costume)\nswitch costume to (costume)\nrepeat (#)\n    change [clone # v] by (1)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\nclear graphic effects\ngo to x: (0) y: (0)\nif <<(Clone #) > [1]> and <(Clone #) < [8]>> then\n    go to x: (0) y: (0)\n    set size to (Clone #) %\n    show\n    In [100] [1.25]\n    wait (0.4) seconds\n    Out\nelse\n    if <(Clone #) = [1]> then\n        go to x: (0) y: (0)\n        set size to (100) %\n        go to [back v] layer\n        show\n        if <(costume [number v]) = [1]> then\n            wait until <(Scene) = [4]>\n        else\n            wait until <(Scene) = (Next Scene)>\n        end\n    else\n        if <(Clone #) = [8]> then\n            set size to (100) %\n            go to x: (0) y: (90)\n            show\n            change [scene v] by (1)\n            wait (3.3) seconds\n            repeat until <(y position) > [280]>\n                set y to ((y position) * (1.078))\n            end\n            change [scene v] by (1)\n        else\n            if <(Clone #) = [9]> then\n                set size to (100) %\n                go to x: (0) y: (-90)\n                show\n                wait (3.3) seconds\n                repeat until <(y position) < [-280]>\n                    set y to ((y position) * (1.078))\n                end\n            else\n                if <(Clone #) = [10]> then\n                    set size to (4) %\n                    show\n                    In [100] [1.25]\n                    change [scene v] by (1)\n                    reset timer\n                    repeat until <(Scene) = [7]>\n                        point in direction (((6) * ([sin v] of ((timer) * (120)) )) + (90))\n                    end\n                    set [time v] to [0]\n                    repeat (6)\n                        change [time v] by (0.1)\n                        point in direction (((5) * ([tan v] of ((Time) * (120)) )) + (90))\n                    end\n                    repeat (6)\n                        change [time v] by (0.05)\n                        point in direction (((5) * ([tan v] of ((Time) * (120)) )) + (90))\n                        change [pixelate v] effect by (14)\n                        switch costume to (size hack v)\n                        change size by (20)\n                        switch costume to (name v)\n                    end\n                    change [scene v] by (1)\n                    repeat (12)\n                        change [time v] by (0.05)\n                        point in direction (((5) * ([tan v] of ((Time) * (120)) )) + (90))\n                        change [pixelate v] effect by (14)\n                        switch costume to (size hack v)\n                        change size by (20)\n                        switch costume to (name v)\n                    end\n                    wait until <(Scene) = [9]>\n                else\n                    if <(Clone #) = [11]> then\n                        go to [back v] layer\n                        go [forward v] (1) layers\n                        set size to (10) %\n                        show\n                        repeat until <((size) * (1.1)) > [746]>\n                            Hexagon Grow\n                        end\n                        set size to (746) %\n                    else\n                        if <(Clone #) = [12]> then\n                            go to [back v] layer\n                            go [forward v] (1) layers\n                            set size to (10) %\n                            show\n                            repeat until <((size) * (1.1)) > [746]>\n                                Hexagon Grow\n                            end\n                            set size to (746) %\n                            change [scene v] by (1)\n                        else\n                            if <(Clone #) = [13]> then\n                                go to x: (10) y: (0)\n                                set size to (100) %\n                                show\n                                repeat until <((x position) * (1.3432)) > [550]>\n                                    set x to ((x position) * (1.3432))\n                                end\n                                set x to (550)\n                                change [scene v] by (1)\n                                broadcast (Setup Project v)\n                                wait (0.2231) seconds\n                                repeat (10)\n                                    change [ghost v] effect by (10)\n                                end\n                                change [scene v] by (1)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\ndelete this clone\n\nwhen I receive [call intro v]\nstart sound [Feel So Good - 3rd Prototype v]\nset [clone # v] to [7]\nset [scene v] to [1]\nset [next scene v] to [2]\nClone [2] [14]\nwait until <(Scene) = (Next Scene)>\nset [clone # v] to [0]\nset [scene v] to [2]\nset [next scene v] to [3]\nClone [1] [1]\nwait until <(Scene) = (Next Scene)>\nset [clone # v] to [1]\nset [scene v] to [3]\nset [next scene v] to [4]\nClone [6] [2]\nwait until <(Scene) = (Next Scene)>\nset [scene v] to [4]\nset [next scene v] to [5]\nset [clone # v] to [0]\nClone [6] [8]\nwait until <(Scene) = (Next Scene)>\nset [scene v] to [5]\nset [next scene v] to [6]\nset [clone # v] to [9]\nClone [1] [16]\nset [clone # v] to [0]\nClone [1] [8]\nwait until <(Scene) = (Next Scene)>\nset [scene v] to [6]\nset [next scene v] to [7]\nset [clone # v] to [10]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [10]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [10]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [10]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [11]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [10]\nClone [1] [17]\nwait (0.3) seconds\nset [clone # v] to [10]\nClone [1] [17]\nwait until <(Scene) = (Next Scene)>\nset [clone # v] to [0]\nset [next scene v] to [8]\nset [scene v] to [7]\nClone [1] [8]\nwait until <(Scene) = (Next Scene)>\nset [clone # v] to [0]\nset [next scene v] to [9]\nset [scene v] to [8]\nClone [1] [8]\nset [clone # v] to [12]\nstart sound [Slice SFX v]\nClone [1] [19]\nwait until <(Scene) = [10]>\nbroadcast (Delete Clones v) and wait\nbroadcast (End Intro v) and wait\n\nwhen flag clicked\nhide\nbroadcast (Delete Clones v) and wait\nbroadcast (Call Intro v) and wait\n\nwhen I receive [delete clones v]\ndelete this clone\n\ndefine In (max) (rate)\nrepeat until <((size) * (rate)) > (max)>\n    set size to ((size) * (rate)) %\nend\nset size to (max) %\nstop [this script v]\n\ndefine Out\nchange size by ((Clone #) * (-1))\nrepeat until <<(size) < (Clone #)> or <(size) = (Clone #)>>\n    set size to ((size) * (0.75)) %\nend\nif <(Clone #) = [2]> then\n    change [scene v] by (1)\nend\n\ndefine Hexagon Grow\nswitch costume to (size hack v)\nset size to ((size) * (1.1)) %\nswitch costume to (hexagon v)\n\n@Thumbnail\n\nwhen [timer v] > (t)\nset [brightness v] effect to (-100)\nswitch costume to (background2 v)\nshow\nwait (0.64) seconds\nswitch costume to (size hack v)\nset size to (130) %\nswitch costume to (background2 v)\nclear graphic effects\nrepeat (10)\n    switch costume to (size hack v)\n    change size by (((100) - (size)) * (0.4))\n    switch costume to (background2 v)\nend\n\nwhen flag clicked\nhide\nforever\n    set [t v] to (timer)\nend\n\n
✦ Instructions ✦\n    ➥ Well... They're inside I guess.\n    ➥ You have to credit.\n    ➥ Tap, Space, A, D, or Arrows, to change slide.\n    ➥ To see this code in action, go here: \n        https://scratch.mit.edu/projects/623652652