3D Platformer

Instructions: Welcome to the 3D Platformer Tutorial. This is the first tutorial for my 3D engine: ChromeEngine! Visit one of the links below, to start the tutorial:\n- Video Tutorial: https://youtu.be/eWkdsiIOoUw\n- Website Tutorial:  https://joeclinton1.github.io/ChromeEngine-Docs/\n------------------------Controls------------------------------------\n- WASD, Arrow keys and Space if on PC\n- Joystick and jump button if on mobile. \n- r to reset\nUse Turbowarp if your fps is <20:\nhttps://turbowarp.org/926935828?hqpen\nAlso try disabling shadows in Settings (press v)\n----------------------------Credits---------------------------------\n- Music: Kevin MacLeod (incompetech.com)\n- SFX: soundsnap.com & @Chooper100\n- Tri fill: @KryptoScratcher (Azex2)\n- Cloud leaderboard: @Griffpatch\n- 3D line fill: @Chooper100\n- Icons: flaticon.com\n- Mobile controls: Roblox inspired\n-------------------------Version History -------------------------\nV1.0 - 25/11 - Initial release\n----------------------------Bugs---------------------------------\n- Physics engine has a bug with how the edges of the platform are handled.\n\nThank you to @Amongus387 and others for answering the survey about project discovery location.

@Stage\n\nwhen flag clicked\nclear graphic effects\nswitch backdrop to (backdrop1 v)\nforever\n    play sound [Chris v] until done\nend\n\nwhen I receive [cave biome v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [back to normal v]\nswitch backdrop to (backdrop1 v)\n\nwhen [m v] key pressed\nrepeat until <key (n v) pressed?>\n    stop all sounds\nend\n\n@Sprite2\n\n@character\n\nwhen flag clicked\nswitch costume to (3a v)\nshow\nswitch backdrop to (backdrop1 v)\ngo to x: (-190) y: (50)\nset [level v] to [1]\nset [xv v] to [0]\nset [falling? v] to [0]\nset [yv v] to [0]\nset size to (70) %\nset rotation style [left-right v]\nforever\n    Physics\nend\n\ndefine Touch Ground <up?>\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        set [falling? v] to [0]\n        change y by (1)\n    end\n    set [yv v] to [0]\nend\n\ndefine Physics\nchange [yv v] by (-1)\nchange y by (Yv)\nchange [falling? v] by (1)\nTouch Ground <(Yv) > [0]>\nif <<<key (up arrow v) pressed?> and <(falling?) < [3]>> and <not <touching (obstacles v)?>>> then\n    set [yv v] to [13]\nend\nif <<key (left arrow v) pressed?> and <not <touching (obstacles v)?>>> then\n    switch costume to (costume4 v)\n    change [xv v] by (-1.7)\nend\nif <<key (right arrow v) pressed?> and <not <touching (obstacles v)?>>> then\n    switch costume to (3a v)\n    change [xv v] by (1.7)\nend\nset [xv v] to ((Xv) * (0.85))\nchange x by (Xv)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    I hate lag\nend\nif <touching (trampoline v)?> then\n    start sound [Boing v]\n    set [yv v] to [20]\nend\nif <touching (obstacles v)?> then\n    switch costume to (costume5 v)\n    broadcast (death v)\n    play sound [Death sound in Minecraft v] until done\n    switch costume to (3a v)\n    go to x: (-190) y: (50)\n    set [yv v] to [0]\n    set [xv v] to [0]\nend\nif <(x position) > [242]> then\n    broadcast (next level v)\nend\nset size to (75) %\n\ndefine I hate lag\nchange x by ((Xv) * (-1))\nchange y by ((slope) * (-1))\n\nwhen flag clicked\nshow\nhide variable [level v]\nforever\n    if <touching (water v)?> then\n        change [yv v] by (0.6)\n        if <<key (down arrow v) pressed?> and <not <touching (obstacles v)?>>> then\n            change [yv v] by (-0.5)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (water v)?> then\n        change [yv v] by (0.5)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [237]> then\n        broadcast (next level v)\n        change [level v] by (1)\n        go to x: (-190) y: (50)\n    end\nend\n\nwhen flag clicked\nshow\nforever\n    set [direction v] to (direction)\nend\n\nwhen [r v] key pressed\ngo to x: (-190) y: (60)\n\nwhen flag clicked\nforever\n    if <<<key (up arrow v) pressed?> and <key (right arrow v) pressed?>> and <not <touching (obstacles v)?>>> then\n        repeat until <<not <<key (up arrow v) pressed?> and <key (right arrow v) pressed?>>> or <touching (obstacles v)?>>\n            switch costume to (costume2 v)\n        end\n        switch costume to (3a v)\n    end\nend\n\nwhen flag clicked\n\nwhen flag clicked\nforever\n    if <<<key (up arrow v) pressed?> and <key (left arrow v) pressed?>> and <not <touching (obstacles v)?>>> then\n        repeat until <<not <<key (up arrow v) pressed?> and <key (left arrow v) pressed?>>> or <touching (obstacles v)?>>\n            switch costume to (costume3 v)\n        end\n        switch costume to (costume4 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (down arrow v) pressed?> then\n        repeat until <not <key (down arrow v) pressed?>>\n            switch costume to (costume1 v)\n        end\n        switch costume to (costume6 v)\n    end\nend\n\nwhen [k v] key pressed\nif <(username) = [-OchiCat-]> then\n    show variable [level v]\n    wait until <key (l v) pressed?>\n    hide variable [level v]\nend\n\nwhen flag clicked\nforever\n    if <<key (s v) pressed?> and <not <(level) = [14]>>> then\n        broadcast (next level v)\n        change [level v] by (1)\n        go to x: (-190) y: (50)\n        wait (3) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (obstacles v)?> then\n        repeat until <not <touching (obstacles v)?>>\n            switch costume to (costume5 v)\n        end\n    end\nend\n\n@ground\n\nwhen flag clicked\ngo to x: (36) y: (28)\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [next level v]\nnext costume\nif <(costume [number v]) = [8]> then\n    broadcast (cave biome v)\nend\nif <(costume [number v]) = [11]> then\n    broadcast (back to normal v)\nend\n\n@obstacles\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\ngo to [back v] layer\n\nwhen I receive [next level v]\nif <(level) = [1]> then\n    switch costume to (costume1 v)\nend\nif <(level) = [2]> then\n    switch costume to (costume2 v)\nend\nif <(level) = [3]> then\n    switch costume to (costume3 v)\nend\nif <(level) = [4]> then\n    go to [front v] layer\n    switch costume to (costume4 v)\n    show\nend\nif <(level) = [5]> then\n    go to [back v] layer\n    switch costume to (costume12 v)\nend\nif <(level) = [6]> then\n    go to [back v] layer\n    show\n    switch costume to (costume5 v)\nend\nif <(level) = [7]> then\n    go to [front v] layer\n    switch costume to (costume6 v)\nend\nif <(level) = [8]> then\n    go to [back v] layer\n    switch costume to (costume7 v)\n    show\nend\nif <(level) = [9]> then\n    go to [back v] layer\n    switch costume to (costume8 v)\n    show\nend\nif <(level) = [10]> then\n    go to [back v] layer\n    switch costume to (costume9 v)\nend\nif <(level) = [11]> then\n    go to [back v] layer\n    switch costume to (costume10 v)\nend\nif <(level) = [12]> then\n    switch costume to (costume11 v)\nend\nif <(level) = [13]> then\n    go to [front v] layer\n    switch costume to (costume13 v)\nend\nif <(level) = [14]> then\n    hide\nend\n\nbroadcast (next level v)\n\nbroadcast (next level v)\nchange [level v] by (1)\n\n@Water\n\nwhen flag clicked\nswitch costume to (w1 v)\nshow\ngo to [front v] layer\ngo to x: (-326) y: (-140)\nforever\n    repeat until <(costume [number v]) = [4]>\n        next costume\n        wait (0.1) seconds\n    end\n    repeat until <(costume [number v]) = [1]>\n        switch costume to ((costume [number v]) - (1))\n        wait (0.1) seconds\n    end\nend\n\nwhen I receive [next level v]\nif <(level) = [1]> then\n    go to x: (-326) y: (-140)\n    go to [front v] layer\n    show\nend\nif <(level) = [2]> then\n    hide\nend\nif <(level) = [3]> then\n    show\n    go to x: (-169) y: (-130)\nend\nif <(level) = [4]> then\n    hide\nend\nif <(level) = [5]> then\n    hide\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo to [front v] layer\ngo to [front v] layer\n\nwhen I receive [death v]\nset [ghost v] effect to (100)\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nclear graphic effects\nrepeat (4)\n    change [ghost v] effect by (25)\nend\n\n@Trampoline\n\nwhen flag clicked\ngo to x: (-30) y: (-86)\ngo to [front v] layer\nswitch costume to (costume1 v)\nshow\nforever\n    if <touching (character v)?> then\n        repeat until <not <touching (character v)?>>\n            switch costume to (costume2 v)\n        end\n        wait (0.08) seconds\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [next level v]\nif <(level) = [2]> then\n    switch costume to (costume1 v)\n    go to x: (-161) y: (-84)\nend\nif <(level) = [3]> then\n    hide\nend\nif <(level) = [5]> then\n    show\n    switch costume to (costume1 v)\n    go to x: (-146) y: (-89)\nend\nif <(level) = [6]> then\n    show\n    switch costume to (costume1 v)\n    go to x: (-110) y: (-87)\nend\nif <(level) = [7]> then\n    hide\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\npoint in direction (90)\nset size to (100) %\nshow\nforever\n    go to [front v] layer\nend\n\n