How to make a platformer (TUTORIAL)
@Stage\n\n@Sprite1\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nhide\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen [timer v] > (0.03)\nshow\n\n@Me \n\ndefine Talk (delay frames) (input) (wait)\nset [\(talk\) number v] to [1]\nset [\(talk\) say v] to []\nrepeat (length of (input))\n    set [\(talk\) say v] to (join (\(Talk\) Say) (letter (\(Talk\) Number) of (input)))\n    say (\(Talk\) Say)\n    wait ((delay frames) * (0.03)) seconds\n    if <[\(talk\) punctuation v] contains (letter (\(Talk\) Number) of (input))?> then\n        wait (0.3) seconds\n    end\n    change [\(talk\) number v] by (1)\nend\nsay (input) for (wait) seconds\n\nwhen I receive [script1 done! v]\nwait (.1) seconds\nTalk [.1] [Now, make another following script. Press space when you're done!] [1.5]\nbroadcast (Script2 v)\n\nwhen I receive [script2 done! v]\nwait (.1) seconds\nTalk [.1] [Now, make another following script. Press space when you're done!] [1.5]\nbroadcast (Script3 v)\n\nwhen I receive [script3 done! v]\nwait (.1) seconds\nTalk [.1] [Now, make another following script. Press space when you're done!] [1.5]\nbroadcast (Script4 v)\n\nwhen I receive [script4 done! v]\nTalk [0.1] [You done? Now put that script here: ] [1]\nbroadcast (Script5 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script5 done! v]\nTalk [0.1] [Good job, now let's make the gravity.] [1.5]\nbroadcast (Script6 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script6 done! v]\nTalk [0.1] [Now, make the following script. Press space when you're done!] [1.5]\nbroadcast (Script7 v)\n\nwhen I receive [script7 done! v]\nTalk [0.1] [Done? Good job! Now, put that script here:] [1.5]\nbroadcast (Script8 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script8 done! v]\nTalk [0.1] [Now, put that whole script here:] [1.5]\nbroadcast (Script9 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script9 done! v]\nTalk [0.1] [Now, put that whole script here:] [1.5]\nbroadcast (Script10 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script10 done! v]\nTalk [0.1] [You done? Good job! Now, connect the forever loop with the \[go to x: \(-214\) y: \(-90\). Press space when you're done!] [2]\nwait until <key (space v) pressed?>\nTalk [0.1] [You finished the player's script. Now, for the level's script, create a variable called "Level" \(for all sprites\) and put the following script] [1]\nbroadcast (Script11 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\n\nwhen I receive [script11 done! v]\nTalk [0.1] [You done? Good job! Now make this script for going to the next level: ] [2]\nbroadcast (Script12 v)\nwait (1.5) seconds\nTalk [.1] [Press space when you're done!] [1]\nwait until <key (space v) pressed?>\n\nwhen I receive [script12 done! v]\nTalk [0.1] [Now, put that script in the bottom of the player's code and you're done! The art you can make it by your own! Thanks for watching!] [3]\nwait (1) seconds\nTalk [.1] [\(By the way, leave a love, favourite and a follow to motivate me to make more games! See you soon!\)] [2]\nwait (5) seconds\nTalk [.1] [Uh, that was the end...] [1]\nstop [all v]\n\nwhen I receive [start project v]\nshow\nwait (2) seconds\nTalk [1] [. . .] [.5]\nwait (1) seconds\nTalk [.1] [Umm....] [.5]\nswitch costume to (costume1 v)\nwait (.3) seconds\nTalk [.1] [Oh, hi there] [.5]\nswitch costume to (costume2 v)\nwait (.1) seconds\nTalk [,1] [You come here to make a platformer I guess....] [2]\nwait (.1) seconds\nTalk [,1] [Press space key to start!] [1.5]\nwait until <key (space v) pressed?>\nTalk [.1] [First thing to do is to create 2 sprites, one called "Player" and the other one, "Level". Press space when you're done!] [.1]\nsay [First thing to do is to create 2 sprites, one called "Player" and the other one, "Level". Press space when you're done!]\nwait until <key (space v) pressed?>\nsay [First thing to do is to create 2 sprites, one called "Player" and the other one, "Level". Press space when you're done!] for (.001) seconds\nTalk [,1] [Now, go to the Player's sprite. Then, create 2 variables, one called "Xv" and the other one, "Yv". REMEMBER: Make sure to tick the "For this sprite only" button before creating them. Press space when you're done!] [.1]\nsay [First thing to do is to create 2 variables, one called "x velocity" and the other one, "y velocity". REMEMBER: Make sure to tick the "For this sprite only" button before creating them. Press space when you're done!]\nwait until <key (space v) pressed?>\nsay [First thing to do is to create 2 variables, one called "x velocity" and the other one, "y velocity". REMEMBER: Make sure to tick the "For this sprite only" button before creating them. Press space when you're done!] for (.001) seconds\nwait (.1) seconds\nTalk [.1] [Now, make this script. Press space when you're done!] [1.5]\nbroadcast (Script1 v)\n\nwhen I receive [start project v]\nforever\n    play sound [Alex Skrindo - Jumbo \[NCS Release\] \(1\) v] until done\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start project v]\nshow\n\n@Intro\n\nwhen flag clicked\nset [intro? v] to [1]\nset [mode 2 v] to [closed]\npoint in direction (90)\nswitch costume to (background v)\ncreate clone of (_myself_ v)\nset [clone v] to [0]\nset size to (100) %\nstart sound [sOuNd v]\nhide\nswitch costume to (logo v)\ngo to x: (0) y: (-345)\nshow\nset [rand1 v] to [0]\nrepeat (90)\n    change [rand1 v] by (((y position) / (20)) * (-1))\n    change y by (((y position) / (7)) * (-1))\n    change y by ((rand1) / (2))\nend\nhide\nbroadcast (pop v)\n\nwhen I start as a clone\nshow\nset [clone v] to [1]\nif <(costume [name v]) = [Background]> then\n    go to x: (0) y: (0)\n    set [brightness v] effect to (100)\n    go to [back v] layer\nelse\n    if <(costume [name v]) = [Popper]> then\n        go to x: (0) y: (0)\n        set [rand2 v] to (pick random (0) to (20))\n        set [rand1 v] to (pick random (-20) to (20))\n        set size to (100) %\n        repeat (25)\n            change [ghost v] effect by (4)\n            set [rand1 v] to ((rand1) * (0.95))\n            change [rand2 v] by (-1)\n            go to ((x position) + (rand1)) ((y position) + (rand2))\n            if <<(y position) < [-180]> or <<(x position) > [240]> or <<(x position) < [-240]> or <(y position) > [180]>>>> then\n                delete this clone\n            end\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [pop v]\nif <(clone) = [0]> then\n    go to x: (0) y: (0)\n    set [rand1 v] to [10]\n    switch costume to (dot v)\n    set size to (500) %\n    switch costume to (accountliker v)\n    show\n    repeat (30)\n        change [rand1 v] by (-1)\n        change y by (rand1)\n        change size by (((size) / (30)) * (-1))\n    end\n    set [rand2 v] to [0]\n    set size to (100) %\n    switch costume to (logo v)\n    go to x: (0) y: (0)\n    show\n    repeat (1)\n        set [rand1 v] to [0]\n        set [rand2 v] to [-10]\n        repeat until <(rand1) > [50]>\n            change size by ((rand2) * (-1))\n            change [rand2 v] by (((100) - (size)) * (-0.1))\n            set [rand2 v] to ((rand2) * (0.9))\n            change [rand1 v] by (1)\n        end\n    end\n    set size to (100) %\n    switch costume to (popper v)\n    create [100] clones\n    switch costume to (logo v)\n    broadcast (pop2 v)\n    set [rand1 v] to [-20]\n    repeat (25)\n        set [rand1 v] to ((rand1) * (0.7))\n        change size by (rand1)\n    end\n    repeat (1)\n        set [rand1 v] to [0]\n        set [rand2 v] to [-10]\n        repeat until <(rand1) > [50]>\n            change size by ((rand2) * (-1))\n            change [rand2 v] by (((100) - (size)) * (-0.1))\n            set [rand2 v] to ((rand2) * (0.9))\n            change [rand1 v] by (1)\n        end\n    end\n    set [rand1 v] to [0]\n    repeat (70)\n        change [rand1 v] by (1)\n        set [rand1 v] to ((rand1) * (0.9))\n        point in direction ((((rand1) * (2)) + ([sin v] of (((timer) * (200)) * (8)) )) + (90))\n    end\n    wait (0) seconds\n    repeat (70)\n        change [rand1 v] by (-1)\n        set [rand1 v] to ((rand1) * (0.9))\n        point in direction ((((rand1) * (2)) + ([sin v] of (((timer) * (200)) * (8)) )) + (90))\n    end\n    wait (0) seconds\n    repeat (20)\n        set [rand1 v] to ((rand1) * (0.9))\n        point in direction ((rand1) + (90))\n    end\n    switch costume to (background4 v)\n    create clone of (_myself_ v)\n    switch costume to (logo v)\nelse\n    go to [back v] layer\n    set [brightness v] effect to (100)\n    set [ghost v] effect to (0)\n    wait (0.05) seconds\n    repeat (10)\n        change [brightness v] effect by (-10)\n        change [ghost v] effect by (-10)\n    end\n    go to [back v] layer\nend\n\ndefine create (num) clones\nrepeat (num)\n    create clone of (_myself_ v)\nend\n\ndefine go to (x) (y)\nset [costume v] to (costume [number v])\nswitch costume to (dot v)\nchange size by (400)\ngo to x: (x) y: (y)\nswitch costume to (costume)\nchange size by (-400)\n\nwhen I receive [pop2 v]\nif <(costume [name v]) = [Background]> then\n    show\n    set [brightness v] effect to (100)\nelse\n    wait (2.5) seconds\n    if <(clone) = [0]> then\n        repeat (15)\n            switch costume to (background2 v)\n            create clone of (_myself_ v)\n            switch costume to (logo v)\n            wait (0.05) seconds\n        end\n        wait (1) seconds\n        repeat (15)\n            switch costume to (background3 v)\n            create clone of (_myself_ v)\n            switch costume to (logo v)\n            wait (0.05) seconds\n        end\n    end\nend\n\nwhen I start as a clone\npoint in direction (90)\nset size to (100) %\nif <(costume [name v]) = [Background2]> then\n    go to x: (500) y: (0)\n    clear graphic effects\n    set [ghost v] effect to (50)\n    show\n    repeat until <(x position) < [10]>\n        change x by (((x position) / (8)) * (-1))\n        change [ghost v] effect by (1)\n    end\n    repeat (10)\n        change x by (((x position) / (8)) * (-1))\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nif <(costume [name v]) = [Background3]> then\n    go to x: (-500) y: (0)\n    clear graphic effects\n    set [ghost v] effect to (50)\n    show\n    repeat until <(x position) > [-10]>\n        change x by (((x position) / (8)) * (-1))\n        change [ghost v] effect by (1)\n    end\n    repeat (10)\n        change x by (((x position) / (8)) * (-1))\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nif <(costume [name v]) = [Background4]> then\n    go to [front v] layer\n    go to x: (0) y: (-300)\n    clear graphic effects\n    set [ghost v] effect to (0)\n    show\n    set [rand1 v] to [0]\n    repeat until <(round (y position)) = [0]>\n        change y by ((((y position) / (5)) + (0)) * (-1))\n        point in direction (((([sin v] of (((timer) * (500)) * (1)) ) / (rand1)) + (90)) * (5))\n        change [rand1 v] by (0.5)\n    end\n    broadcast (Start Project v)\n    go to x: (0) y: (-0.01)\n    go to [front v] layer\n    repeat until <(y position) < [-290]>\n        go to [front v] layer\n        change y by (((y position) * (1.005)) / (5))\n        point in direction (((([sin v] of (((timer) * (500)) * (1)) ) / (rand1)) + (90)) * (5))\n        change [rand1 v] by (-1)\n    end\n    delete this clone\nend\n\nwhen I receive [start project v]\nif <(clone) = [0]> then\n    hide\n    set [intro? v] to [0]\nend\nif <(clone) = [1]> then\n    if <(costume [name v]) = [Background]> then\n        delete this clone\n    end\nend\n\nwhen flag clicked\nset [timer v] to [0.00]\nforever\n    if <not <(MODE 3) = [1]>> then\n        change [timer v] by (0.03)\n    end\nend\n\nwhen I receive [layers v]\nif <(costume [name v]) = [Background4]> then\n    go to [front v] layer\nend\n\n@script\n\nwhen flag clicked\nwait (0.001) seconds\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(2\) v)\ngo to x: (0) y: (0)\nhide\n\nif <touching (level v)?> then\n    change y by (1)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change x by ((x velocity) * (-1))\n                        change y by (-5)\n                        if <key (up arrow v) pressed?> then\n                            if <(x velocity) > [0]> then\n                                set [x velocity v] to [-5]\n                            else\n                                set [x velocity v] to [5]\n                            end\n                            set [y velocity v] to [10]\n                        else\n                            set [x velocity v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nforever\n    if <key (right arrow v) pressed?> then\n        change [x velocity v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        change [x velocity v] by (-1)\n    end\n    set [x velocity v] to ((x velocity) * (.9))\n    change x by (x velocity)\nend\n\nwhen I receive [script1 v]\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script1 done! v)\n\nwhen I receive [script2 v]\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(4\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script2 done! v)\n\nchange [y velocity v] by (-1)\nchange y by (y velocity)\nif <touching (level v)?> then\n    change y by ((y velocity) * (-1))\n    set [y velocity v] to [0]\nend\nchange y by (-1)\n\nwhen I receive [script3 v]\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(5\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script3 done! v)\n\nwhen I receive [script4 v]\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(6\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script4 done! v)\n\nwhen I receive [script5 v]\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(5\)2 v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script5 done! v)\n\nif <touching (level v)?> then\n    if <key (up arrow v) pressed?> then\n        change [y velocity v] by (15)\n    end\nend\nchange y by (1)\n\nwhen I receive [script6 v]\nswitch costume to (screenshot_2020-02-25 scratch - how to make a platformer  v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script6 done! v)\n\nwhen I receive [script7 v]\nswitch costume to (screenshot_2020-02-25 scratch - how to make a platformer \(1\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script7 done! v)\n\nwhen I receive [script8 v]\nswitch costume to (screenshot_2020-02-25 scratch - how to make a platformer 2 v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script8 done! v)\n\nwhen I receive [script9 v]\nswitch costume to (screenshot_2020-02-25 scratch - how to make a platformer \(2\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script9 done! v)\n\nwhen I receive [script10 v]\nswitch costume to (screenshot_2020-02-24 scratch - how to make a platformer \(4\)2 v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script10 done! v)\n\nwhen I receive [script11 v]\nswitch costume to (screenshot_2020-02-25 scratch - how to make a platformer \(4\) v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script11 done! v)\n\nif <(x position) > [230]> then\n    change [level v] by (1)\n    set [y velocity v] to [0]\n    set [x velocity v] to [0]\n    go to x: (-214) y: (-90)\nend\n\nwhen I receive [script12 v]\nswitch costume to (screenshot_2020-02-26 scratch - how to make a platformer  v)\nshow\nwait until <key (space v) pressed?>\nhide\nbroadcast (Script12 done! v)\n\n
NO ADVERTISING UNLESS ITS A PLATFORMER\n---------------------------------------------------------------------------\nHello and welcome back to another project of mine but this time a tutorial.\n---------------------------------------------------------------------------\nMade the intro with help by @Yellow_Brain\n---------------------------------------------------------------------------