Among Dream Platformer Tutorial #All #Games #Tutorials 
@Stage\n\nwhen flag clicked\n\nwhen flag clicked\nforever\n    set [☁ fastest time v] to (☁ Fastest Time)\nend\n\n@Player\n\ndefine Move - in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide X - Slope or Wall?\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide Y - Celling or Floor\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (plaform v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nMoved - by Moving Platform\nswitch backdrop to <touching (level v)?>\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(speed y) > [0]> then\n        set [speed y v] to ((speed y) * (0.9))\n    end\nend\n\ndefine Controls - Left and Right\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (d v) pressed?> or <key (right arrow v) pressed?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>)\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [wall slide v] to [0]\nset [jumping v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nBegin Scene # [1] go to x, y: [-150] [55]\n\nwhen I receive [game loop v]\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Platforms v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\n    set [ghost v] effect to (0)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x, y: [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((SCENE #) + (100)) go to x, y: [ ] [-160]\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((SCENE #) + (-100)) go to x, y: [ ] [180]\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > [ ]> then\n    set x to (x)\nend\nif <(y) > [ ]> then\n    set y to (y)\nend\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > [ ]> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to [ ]\nset [platform dy v] to [ ]\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check Touching Solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck Touching Solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check Touching Solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((speed x) * (0.8))\nend\nset [speed x v] to ((speed x) * (0.95))\nSlip\n\ndefine Collide Y - Celling or Floor\nset y to (last value)\nif <(speed y) > [0]> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((speed y) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck Touching Solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\ndefine Moved - by Moving Platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck Touching Solid\nif <(touching) > [0]> then\n    Find Closest Space to (x position) (y position) max [16]\n    if <(touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find Closest Space to (x) (y) max (max)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (distance) steps\n        Check Touching Solid\n        if <(touching) < [1]> then\n            point in direction (temp)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (temp)\n\nwhen I receive [lose life v]\nbroadcast (song  v)\nswitch costume to (maroon dead 1 v)\nstop [other scripts in sprite v]\nstart sound [Kill v]\nrepeat (9)\n    set size to (40) %\n    wait (0.1) seconds\n    next costume\nend\nset size to (70) %\nbroadcast (RESET v)\nReset and Begin Level\n\nwhen flag clicked\nset [time v] to [0]\nset [gravity v] to [-0.5]\nset [jump force v] to [16]\nset [jump duration v] to [5]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nReset and Begin Level\n\n@Plaform\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [1]> then\n    show\n    Animate Platform\nend\n\ndefine Animate Platform\ngo to x: (9) y: (-52)\npoint in direction (90)\nforever\n    glide (1) secs to x: (173) y: (93)\n    wait (1) seconds\n    glide (1) secs to x: (105) y: (-50)\n    wait (1) seconds\nend\n\nwhen I receive [tick - platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(new y) > (last y)> then\n    change y by (1)\nelse\n    set y to ((last y) + (1))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((new x) - (last x))\n    set [platform dy v] to ((new y) - (last y))\nend\ngo to x: (new x) y: (new y)\n\nsay ((new x) - (last x))\n\nset [☁ fastest time v] to [0]\n\n@Sprite2\n\nwhen flag clicked\nset [time v] to [0]\nset [ghost v] effect to (50)\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (-10)\ngo to [front v] layer\n\nwhen I receive [change scene v]\nshow\ngo to [front v] layer\nswitch costume to (blank v)\nswitch costume to (join [L] (SCENE #))\n\n@Sprite1\n\nwhen I receive [end v]\nset size to (100) %\nswitch costume to (costume2 v)\nshow\nrepeat (14)\n    wait (0.1) seconds\n    go to [front v] layer\n    next costume\nend\nset [level # v] to [1]\nbroadcast (check v)\nwait (5) seconds\nstop [all v]\n\nwhen flag clicked\nhide\n\nwhen I receive [check v]\nforever\n    if <(time) < (☁ Fastest Time)> then\n        set [☁ fastest time v] to (time)\n    end\nend\n\nwait (1) seconds\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [L] (SCENE #))\n\nwhen flag clicked\nforever\n    change [time v] by (1)\n    wait (1) seconds\n    if <(SCENE #) = [8]> then\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(SCENE #) = [11]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nset [☁ fastest time v] to [0]\n\n@music\n\ndefine Pause\nset volume to (0) %\nset [pitch v] effect to ((0) - ([e ^ v] of (10000) ))\n\nwhen I receive [reset v]\nPlay\n\ndefine Play\nset volume to (100) %\nset [pitch v] effect to (0)\n\nwhen flag clicked\nforever\n    play sound [Cave Background v] until done\nend\n\nwhen I receive [song  v]\nPause\n\n@level bg\n\nwhen flag clicked\nswitch costume to (l1 v)\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\ngo to [back v] layer\nswitch costume to (join [L] (SCENE #))\nset [gravity v] to [-1.1]\n\nforever\n\n@touch the inposters\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n@sound effects\n\nwhen I receive [tick - level v]\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\nwhen I receive [tick - level v]\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\nset [player x v] to (x)\nset [player y v] to (y)\n\ndefine Player Movement\nif <(Spawning) = [0]> then\n    switch costume to (() + (193))\n    if <(MOBILE MODE) = [0]> then\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            Try Move [0] [5]\n        end\n        if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n            Try Move [0] [-5]\n        end\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            Try Move [-5] [0]\n            point in direction (-90)\n        end\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            Try Move [5] [0]\n            point in direction (90)\n        end\n        if <(JY) > [0]> then\n            Try Move [0] ((JY) / (4))\n        end\n        if <(JY) < [0]> then\n            Try Move [0] ((JY) / (4))\n        end\n        if <(JX) < [0]> then\n            Try Move ((JX) / (4)) [0]\n            point in direction (-90)\n        end\n        if <(JX) > [0]> then\n            Try Move ((JX) / (4)) [0]\n            point in direction (90)\n        end\n    end\nend\n\ndefine Try Move (dx) (dy)\nset [ghost v] effect to (100)\nswitch costume to (blank v)\ngo to x: (((x) + (dx)) - (SCROLL X)) y: (((y) + (dy)) - (SCROLL Y))\nif <((x) + (dx)) > (x)> then\n    set [direction v] to [Left]\nelse\n    if <((x) + (dx)) < (x)> then\n        set [direction v] to [Right]\n    else\n        if <((y) + (dy)) < (y)> then\n            set [direction v] to [Down]\n        else\n            if <((y) + (dy)) > (y)> then\n                set [direction v] to [Up]\n            end\n        end\n    end\nend\nif <(Move?) = [1]> then\n    if <(Task Open) = [0]> then\n        if <<not <touching (blocks v)?>> and <not <touching (walls v)?>>> then\n            change [x v] by (dx)\n            change [y v] by (dy)\n            set [player x v] to (x)\n            set [player y v] to (y)\n        end\n    end\nend\nset [ghost v] effect to (0)\nswitch costume to (round (Player Costume))\n\nwhen I receive [tick - player v]\nif <(MOBILE MODE) = [0]> then\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        Try Move [0] [5]\n    end\n    if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n        Try Move [0] [-5]\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        Try Move [-5] [0]\n        point in direction (-90)\n    end\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        Try Move [5] [0]\n        point in direction (90)\n    end\nelse\n    if <(JY) > [0]> then\n        Try Move [0] ((JY) / (4))\n    end\n    if <(JY) < [0]> then\n        Try Move [0] ((JY) / (4))\n    end\n    if <(JX) < [0]> then\n        Try Move ((JX) / (4)) [0]\n        point in direction (-90)\n    end\n    if <(JX) > [0]> then\n        Try Move ((JX) / (4)) [0]\n        point in direction (90)\n    end\nend\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (16)))\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (16)))\nif <(Hide) = [0]> then\n    if <<<not <(JX) = [0]>> or <not <(JY) = [0]>>> or <<<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<key (s v) pressed?> or <key (down arrow v) pressed?>>> or <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<key (d v) pressed?> or <key (right arrow v) pressed?>>>>> then\n        change [player costume v] by (0.6)\n        if <(Player Costume) > [13]> then\n            set [player costume v] to [2]\n        end\n    else\n        set [player costume v] to [14]\n        switch costume to (round (Player Costume))\n    end\nend\nif <not <(Hide) = [0]>> then\n    set [ghost v] effect to (0)\n    switch costume to (lime idle v)\nelse\n    set [ghost v] effect to (0)\n    switch costume to (round (Player Costume))\nend\nif <<(costume [number v]) = [2]> or <(costume [number v]) = [8]>> then\n    if <(Task Open) = [0]> then\n        if < (Location) contains [MINECRAFT]?> then\n            start sound (pick random (1) to (4))\n        else\n            start sound (pick random (5) to (8))\n        end\n    end\nend\n\nwhen flag clicked\nset [spawning v] to [0]\nset [inmenu? v] to [1]\nset [mobile mode v] to [0]\nhide variable [mobile mode v]\nset [player costume v] to [1]\nset [move? v] to [0]\nset [ingame? v] to [0]\nset [ghost v] effect to (100)\n\nwhen I receive [leave game v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [start match v]\nset [x v] to [-23]\nset [y v] to [-68]\nset [scroll x v] to [-23]\nset [scroll y v] to [-68]\nset [player x v] to [-23]\nset [player y v] to [-68]\n\nwhen I receive [tick - level v]\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\nwhen I receive [begin game v]\nset volume to (40) %\nset [tasks completed v] to [0]\nshow\nset [hide cooldown v] to [0]\nset [location v] to [MINECRAFT 2]\npoint in direction (90)\nset [hide v] to [0]\nset [hearts v] to [3]\nset [x v] to [-1693]\nset [y v] to [-838]\nset [scroll x v] to [-1693]\nset [scroll y v] to [-838]\nset [end? v] to [0]\nset rotation style [left-right v]\ngo to [front v] layer\nset [ghost v] effect to (0)\nset size to ((7.14285714) * (SCALE:)) %\ngo to x: (0) y: (0)\nset [move? v] to [1]\nrepeat until <(END?) = [1]>\n    broadcast (tick - hide block v)\n    broadcast (tick - hunters v)\n    show\n    broadcast (tick - player v)\n    broadcast (Move Map v)\n    broadcast (tick - level v)\n    broadcast (tick - show block v)\n    broadcast (tick - task objects v)\n    broadcast (tick - front buttons v)\n    broadcast (tick - tasks v)\n    broadcast (tick - inventory numbers v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [hide v]\nbroadcast (Hide Stand v)\nset [hide v] to [10]\nrepeat until <(Hide) = [0]>\n    wait (1) seconds\n    change [hide v] by (-1)\nend\nset [hide cooldown v] to [25]\nrepeat until <(Hide Cooldown) = [0]>\n    wait (1) seconds\n    change [hide cooldown v] by (-1)\nend\n\nwhen I receive [hide v]\nset [hide v] to [10]\nrepeat until <(Hide) = [0]>\n    set [player costume v] to [15]\nend\n\nwhen I receive [tick - front buttons v]\nif <not <(Hide) = [0]>> then\n    switch costume to (invisible v)\nend\n\nwhen I receive [main menu v]\nrepeat (10)\n    hide\nend\n\nwhen I receive [begin game v]\nset [end? v] to [0]\nset [time - hours v] to [00]\nset [time - minutes v] to [00]\nset [time - seconds v] to [00]\nrepeat until <(END?) = [1]>\n    wait (1) seconds\n    change [time - seconds v] by (1)\n    if <(TIME - Seconds) = [60]> then\n        set [time - seconds v] to [0]\n        change [time - minutes v] by (1)\n        if <(TIME - Minutes) = [60]> then\n            set [time - minutes v] to [0]\n            change [time - hours v] by (1)\n            if <(TIME - Hours) > [98]> then\n                stop [all v]\n            end\n        end\n    end\n    if <(length of (TIME - Seconds)) = [1]> then\n        set [time - seconds v] to (join [0] (TIME - Seconds))\n    end\n    if <(length of (TIME - Minutes)) = [1]> then\n        set [time - minutes v] to (join [0] (TIME - Minutes))\n    end\n    if <(length of (TIME - Hours)) = [1]> then\n        set [time - hours v] to (join [0] (TIME - Hours))\n    end\nend\n\n@Mouse\n\nwhen flag clicked\nforever\n    set size to (60) %\n    go to [front v] layer\n    go to x: ((mouse x) - (-6)) y: ((mouse y) - (16))\nend\n\nwhen I receive [tick - inventory numbers v]\ngo to [front v] layer\n\n
arrow keys or wads\ndon't touch the imposters\n\n     ★★★★ Griffpatch Fan Art ★★★★ \nhttps://scratch.mit.edu/projects/571943269/\n\n\nEdit: #4 tutorials ?! #28 on games?!