Braid - A Time Platformer
@Stage\n\nwhen I receive [next level v]\n\nnext backdrop\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\n\n@Background\n\nwhen I receive [start v]\nset size to (100) %\nswitch costume to (time v)\nclear graphic effects\nset [ghost v] effect to (100)\nshow\nforever\n    go to [front v] layer\n    if <key (x v) pressed?> then\n        repeat (3)\n            change [ghost v] effect by (-10)\n        end\n        wait until <not <key (x v) pressed?>>\n        repeat (3)\n            change [ghost v] effect by (10)\n        end\n    end\nend\n\nwhen flag clicked\nset size to (100) %\nswitch costume to (costume1 v)\ngo to [front v] layer\ngo [backward v] (1) layers\nclear graphic effects\nset size to (100) %\n\nwhen I receive [start v]\nforever\n    go to [front v] layer\nend\n\nwhen I receive [boom v]\nset size to (100) %\nrepeat (5)\n    change [brightness v] effect by (-1)\n    change size by (10)\nend\nrepeat (5)\n    change [brightness v] effect by (1)\n    change size by (-9)\nend\n\nwhen I receive [killtheintro v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@guy\n\nwhen flag clicked\nhide\n\ndefine touch ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speedy v] to [0]\nend\n\ndefine walk (direction) (speed)\nchange [frame v] by ((1) / (change costume every))\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <([abs v] of (speed) ) > [3]>> then\n        if <[10] = [0]> then\n            set [speedx v] to ((-1.2) * (speed))\n            set [speedy v] to [5]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        end\n    else\n        set [speedx v] to [0]\n    end\nend\n\ndefine swim\nif <<(speedY) < [4]> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    if <(backdrop [number v]) > [16]> then\n        change [speedy v] by (-0.25)\n    else\n        change [speedy v] by (-1)\n    end\nelse\n    if <(backdrop [number v]) > [16]> then\n        change [speedy v] by (-0.25)\n    else\n        change [speedy v] by (-2)\n    end\nend\n\nwhen I receive [hit v]\nnext costume\nstart sound [Crunch v]\n\ndefine animate\nif <(falling?) < [3]> then\n    if <(frame) = [0]> then\n        change [frame2 v] by ((0.2) / (change costume every))\n        switch costume to ([floor v] of ((9) + ((frame2) mod (21))) )\n    else\n        switch costume to ([floor v] of ((31) + ((frame) mod (26))) )\n    end\nelse\n    if <touching (fence v)?> then\n        if <<<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> or <<key (a v) pressed?> or <key (d v) pressed?>>> then\n            switch costume to (tim12 v)\n        else\n            switch costume to (tim11 v)\n            if <<<key (up arrow v) pressed?> or <key (down arrow v) pressed?>> or <<key (s v) pressed?> or <key (w v) pressed?>>> then\n                if <(climb) = [0]> then\n                    point in direction (90)\n                else\n                    point in direction (-90)\n                end\n            end\n        end\n    else\n        if <(speedY) > [3]> then\n            switch costume to (jump2 v)\n        else\n            if <(speedY) > [0]> then\n                switch costume to (jump1 v)\n            else\n                switch costume to (fall1 v)\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\nrepeat (10)\n    if <(level) = [4]> then\n        go to x: (-180) y: (-130)\n    else\n        go to x: (-200) y: (-130)\n    end\nend\n\nwhen I receive [next level v]\ndelete all of [past costume v]\ndelete all of [past dir v]\ndelete all of [past x v]\ndelete all of [past xv v]\ndelete all of [past y v]\ndelete all of [past yv v]\nset [player hp v] to [20]\nset [change costume every v] to [0.7]\nset [falling? v] to [0]\nset rotation style [left-right v]\nset [speedy v] to [0]\n\nwhen I receive [die key1 v]\nset [holding key? v] to [0]\n\nwhen I receive [die key 2 v]\nset [holding key? v] to [0]\n\nwhen I receive [jump v]\nif <(speedY) > [-10]> then\n    set [speedy v] to [13]\nelse\n    set [speedy v] to ((speedY) * (-1))\nend\n\nwhen I receive [guy level switch v]\nglide (1) secs to (portal v)\n\nwhen flag clicked\ndelete all of [past costume v]\ndelete all of [past dir v]\ndelete all of [past x v]\ndelete all of [past xv v]\ndelete all of [past y v]\ndelete all of [past yv v]\nset [player hp v] to [20]\nset [change costume every v] to [2]\nset [falling? v] to [0]\nset rotation style [left-right v]\nset [speedy v] to [0]\n\nwhen I receive [start v]\nset [climb speed v] to [3]\nset [x pressed v] to [nope]\ndelete all of [past costume v]\ndelete all of [past dir v]\ndelete all of [past x v]\ndelete all of [past xv v]\ndelete all of [past y v]\ndelete all of [past yv v]\nset [change costume every v] to [0.7]\nset [guy dead v] to [false]\nset [player hp v] to [20]\nset [falling? v] to [0]\nset rotation style [left-right v]\nset [speedy v] to [0]\nforever\n    if <key (x v) pressed?> then\n        switch costume to (tim-fidget-w v)\n    else\n        switch costume to (hitbox v)\n    end\n    if <(x pressed) = [wait]> then\n        wait until <key (x v) pressed?>\n    end\n    if <not <key (x v) pressed?>> then\n        if <(guy dead) = [false]> then\n            set [time speed v] to [1]\n            change y by (speedY)\n            touch ground <(speedY) > [0]>\n            swim\n            if <not <touching (fence v)?>> then\n                if <(speedX) < [-0.5]> then\n                    walk (-90) (speedX)\n                else\n                    if <(speedX) > [0.5]> then\n                        walk (90) (speedX)\n                    end\n                end\n                if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                    if <(backdrop [number v]) > [16]> then\n                        set [speedy v] to [3]\n                    else\n                        if <<(jump key) = [0]> and <(falling?) < [3]>> then\n                            start sound [step v]\n                            set [speedy v] to [7]\n                            set [falling? v] to [6]\n                            set [jump key v] to [1]\n                        end\n                    end\n                else\n                    set [jump key v] to [0]\n                end\n                if <(wall jump) > [0]> then\n                    change [wall jump v] by (-1)\n                else\n                    set [speedx v] to ((speedX) * (0.75))\n                end\n                if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n                    change [speedx v] by (-1.5)\n                    change [player energy v] by (-0.15)\n                else\n                    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                        change [speedx v] by (1.5)\n                        change [player energy v] by (-0.15)\n                    else\n                        set [frame v] to [0]\n                    end\n                end\n            else\n                set [speedy v] to [0]\n                set [speedx v] to [0]\n                if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                    change y by (climb speed)\n                    if <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>> then\n                        change y by ((0) - (climb speed))\n                    end\n                end\n                if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n                    change y by ((0) - (climb speed))\n                    if <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>> then\n                        change y by (climb speed)\n                    end\n                end\n                if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n                    walk (-90) (0)\n                    change x by ((0) - (climb speed))\n                    if <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>> then\n                        change x by (climb speed)\n                    end\n                end\n                if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                    walk (90) (0)\n                    change x by (climb speed)\n                    if <<touching (ground v)?> or <<touching (cloud v)?> or <<touching (cloud2 v)?> or <<touching (wall v)?> or <touching (platform v)?>>>>> then\n                        change x by ((0) - (climb speed))\n                    end\n                end\n            end\n            animate\n        else\n            if <(do once) = [true]> then\n                set [speedx v] to [0]\n                set [do once v] to [false]\n                set [speedy v] to [0]\n            end\n            change [speedy v] by (-1)\n            switch costume to (timfall v)\n            change y by (speedY)\n            change x by (speedX)\n            go to [front v] layer\n            go [backward v] (1) layers\n            if <<touching (_edge_ v)?> and <(y position) < [-150]>> then\n                set [x pressed v] to [wait]\n            end\n        end\n        add (x position) to [past x v]\n        add (y position) to [past y v]\n        add ((speedX) / (2)) to [past xv v]\n        add ((speedY) / (2)) to [past yv v]\n        add (direction) to [past dir v]\n        add (costume [name v]) to [past costume v]\n        add (guy dead) to [guy dead v]\n    else\n        set [do once v] to [true]\n        if <not <(length of [past x v]) < [3]>> then\n            go to x: (item (length of [past x v]) of [past x v]) y: (item (length of [past y v]) of [past y v])\n            set [speedx v] to (item (length of [past xv v]) of [past xv v])\n            set [guy dead v] to (item (length of [guy dead v]) of [guy dead v])\n            set [speedy v] to (item (length of [past yv v]) of [past yv v])\n            switch costume to (item (length of [past costume v]) of [past costume v])\n            point in direction (item (length of [past dir v]) of [past dir v])\n            delete (length of [past xv v]) of [past xv v]\n            delete (length of [past yv v]) of [past yv v]\n            delete (length of [past x v]) of [past x v]\n            delete (length of [past y v]) of [past y v]\n            delete (length of [past costume v]) of [past costume v]\n            delete (length of [past dir v]) of [past dir v]\n            delete (length of [guy dead v]) of [guy dead v]\n            if <key (left arrow v) pressed?> then\n                go to x: (item (length of [past x v]) of [past x v]) y: (item (length of [past y v]) of [past y v])\n                set [speedx v] to (item (length of [past xv v]) of [past xv v])\n                set [speedy v] to (item (length of [past yv v]) of [past yv v])\n                set [guy dead v] to (item (length of [guy dead v]) of [guy dead v])\n                switch costume to (item (length of [past costume v]) of [past costume v])\n                point in direction (item (length of [past dir v]) of [past dir v])\n                delete (length of [past xv v]) of [past xv v]\n                delete (length of [past yv v]) of [past yv v]\n                delete (length of [past x v]) of [past x v]\n                delete (length of [past y v]) of [past y v]\n                delete (length of [past costume v]) of [past costume v]\n                delete (length of [guy dead v]) of [guy dead v]\n                delete (length of [past dir v]) of [past dir v]\n            end\n        end\n    end\n    if <touching (bad v)?> then\n        set [guy dead v] to [true]\n        broadcast (Death sound v)\n    end\n    if <(x pressed) = [wait]> then\n        wait until <key (x v) pressed?>\n        set [x pressed v] to [nope]\n    end\nend\n\nwhen I receive [start v]\nset size to (25) %\nset [holding key? v] to [false]\nhide\ngo to x: (-188) y: (59)\nswitch costume to (hitbox2 v)\nshow\n\nwhen flag clicked\nforever\n    set [climb v] to [0]\n    wait (0.3) seconds\n    set [climb v] to [1]\n    wait (0.2) seconds\nend\n\nwhen I receive [you win! v]\ngo to [front v] layer\n\nwhen I receive [death sound v]\nplay sound [recording1 v] until done\n\n@bad\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\n@Text\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\nforever\n    if <(x pressed) = [wait]> then\n        show\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        wait until <key (x v) pressed?>\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        hide\n    end\nend\n\n@key1\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nshow\nforever\n    if <touching (guy v)?> then\n        set [holding key? v] to [1]\n        start sound [keyding v]\n    end\n    if <(Holding key?) = [1]> then\n        forever\n            go to [front v] layer\n            go [backward v] (1) layers\n            set [holding key? v] to [1]\n            go to (guy v)\n            change y by (-5)\n            point in direction ([direction v] of [guy v])\n            if <(show clone) = [1]> then\n                repeat until <touching (ground v)?>\n                    change y by (-2)\n                end\n                switch costume to (key2 v)\n                stop [this script v]\n            end\n        end\n    end\n    if <(Holding key?) = [2]> then\n        go to x: (clone x) y: (clone y)\n        if <(clone dir) = [-90]> then\n            change x by (-20)\n        else\n            change x by (20)\n        end\n        point in direction (clone dir)\n        change y by (-4)\n    end\nend\n\nwhen I receive [die key1 v]\nset [holding key? v] to [0]\n\nwhen I receive [start v]\nhide\nswitch costume to (key1 v)\nset rotation style [left-right v]\nset size to (20) %\ngo to x: (-25) y: (-140)\ncreate clone of (_myself_ v)\nwait until <(level) = [2]>\nwait (0.2) seconds\ngo to x: (-187) y: (119)\npoint in direction (90)\ncreate clone of (_myself_ v)\nwait until <(level) = [4]>\nwait (0.2) seconds\ngo to x: (-230) y: (-153)\npoint in direction (90)\ncreate clone of (_myself_ v)\n\n@wall\n\n\n\nwhen I receive [next level v]\nhide\nrepeat (10)\n    delete this clone\nend\n\nwhen I receive [start v]\nset size to (26) %\nset [show clone v] to [0]\nhide\nswitch costume to (gate v)\ngo to x: (137) y: (70)\nswitch costume to (gate v)\ncreate clone of (_myself_ v)\nwait until <(level) = [2]>\ngo to x: (148) y: (-35)\nswitch costume to (gate v)\ncreate clone of (_myself_ v)\nwait until <(level) = [4]>\ngo to x: (100) y: (30)\nswitch costume to (gate v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    delete all of [door open1? v]\nend\nforever\n    if <(show clone) = [1]> then\n        start sound [DoorOpen v]\n        wait (0.4) seconds\n        broadcast (die key1 v) and wait\n        set [show clone v] to [0]\n        delete this clone\n    end\nend\n\nif <key (x v) pressed?> then\n    switch costume to (item (length of [door open1? v]) of [door open1? v])\n    delete (length of [door open1? v]) of [door open1? v]\nelse\n    add (costume [name v]) to [door open1? v]\nend\n\nrepeat until <(costume [number v]) = [15]>\n    next costume\n    add (costume [name v]) to [door open1? v]\nend\n\nwhen I receive [start v]\n\n@wall_detector1\n\nwhen I start as a clone\nshow\nforever\n    if <<touching (guy v)?> and <(Holding key?) = [1]>> then\n        set [show clone v] to [1]\n        repeat (14)\n            change [ghost v] effect by (7.1)\n        end\n    end\nend\n\nif <key (x v) pressed?> then\n    switch costume to (item (length of [door open2? v]) of [door open2? v])\n    delete (length of [door open2? v]) of [door open2? v]\nelse\n    add (costume [name v]) to [door open2? v]\nend\n\nwhen I receive [next level v]\nhide\ndelete this clone\n\nwhen I receive [start v]\nclear graphic effects\nset size to (27) %\ndelete all of [door open2? v]\nset [show clone v] to [0]\nhide\nswitch costume to (gate v)\ngo to x: (137) y: (70)\ncreate clone of (_myself_ v)\nwait until <(level) = [2]>\ngo to x: (148) y: (-35)\nswitch costume to (gate v)\ncreate clone of (_myself_ v)\nwait until <(level) = [4]>\ngo to x: (100) y: (30)\nswitch costume to (gate v)\ncreate clone of (_myself_ v)\n\n@Portal\n\nwhen I receive [start v]\nset size to (70) %\nset [level v] to [1]\nshow\ngo to x: (195) y: (80)\nforever\n    if <key (x v) pressed?> then\n        if <key (left arrow v) pressed?> then\n            turn right (-2) degrees\n            turn right (-2) degrees\n        else\n            turn right (-2) degrees\n        end\n    else\n        turn right (2) degrees\n    end\n    if <touching (guy v)?> then\n        if <not <(level) = [4]>> then\n            broadcast (guy level switch v)\n            wait (1) seconds\n            broadcast (level show back v)\n            wait (0.4) seconds\n            broadcast (next level v)\n            hide\n            change [level v] by (1)\n        else\n            broadcast (guy level switch v)\n            wait (1) seconds\n            broadcast (level show back v)\n            wait (0.4) seconds\n            broadcast (next level v)\n            hide\n            change [level v] by (1)\n            wait (3) seconds\n            broadcast (You Win! v)\n        end\n    end\n    if <(level) = [2]> then\n        show\n        go to x: (208) y: (60)\n    end\n    if <(level) = [3]> then\n        show\n        go to x: (208) y: (40)\n    end\n    if <(level) = [4]> then\n        show\n        go to x: (208) y: (40)\n    end\nend\n\n@key2\n\nwhen I receive [die key 2 v]\nstop [other scripts in sprite v]\nstop [other scripts in sprite v]\nswitch costume to (key2 v)\nrepeat until <touching (ground v)?>\n    change y by (-2)\nend\n\nwhen I receive [start v]\nswitch costume to (key v)\nshow\nhide\nset rotation style [left-right v]\nset size to (30) %\ngo to x: (-25) y: (-140)\nforever\n    set x to ((500) - (scrollX))\n    if <touching (guy v)?> then\n        set [holding key? v] to [1]\n    end\n    if <(Holding key?) = [1]> then\n        go to (guy v)\n        change y by (-5)\n        point in direction ([direction v] of [guy v])\n    end\n    if <(Holding key?) = [2]> then\n        go to x: (clone x) y: (clone y)\n        if <(clone dir) = [-90]> then\n            change x by (20)\n        else\n            change x by (-20)\n        end\n        point in direction (() - (clone dir))\n        change y by (-4)\n    end\nend\n\n@enemy\n\nwhen I start as a clone\nturn right (180) degrees\nif <(level) = [2]> then\n    go to x: (-131) y: (148)\n    set [yv v] to [2]\nend\ndelete all of [yv v]\ndelete all of [dead? v]\ndelete all of [sounds v]\ndelete all of [dir? v]\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [costume? v]\nif <(level) = [4]> then\nset [dead? v] to [false]\nset rotation style [left-right v]\nshow\nforever\n    wait until <(x pressed) = [nope]>\n    if <not <key (x v) pressed?>> then\n        if <not <(dead?) = [true]>> then\n            switch costume to (enemy_3 v)\n            change [yv v] by (-1)\n            change [enemy frame v] by (0.6)\n            check for ground\n            if <(direction) = [-90]> then\n                move [90] [-1.5]\n            else\n                move [90] [1.5]\n            end\n            change y by (YV)\n            switch costume to ([floor v] of ((1) + ((enemy frame) mod (12))) )\n            if <<touching (key1 v)?> and <not <(Holding key?) = [1]>>> then\n                set [holding key? v] to [2]\n            end\n            if <touching (guy v)?> then\n                if <([y position v] of [guy v]) > ((y position) + (20))> then\n                    if <not <(guy dead) = [true]>> then\n                        broadcast (jump v)\n                        start sound [weasleDie v]\n                        add [weasleDie] to [sounds v]\n                        point in direction (90)\n                        set rotation style [all around v]\n                        go to [back v] layer\n                        set [yv v] to [5]\n                        set [xv v] to [1]\n                        set [holding key? v] to [0]\n                        set [dead? v] to [true]\n                        add [pop] to [sounds v]\n                        switch costume to (monster2 v)\n                    end\n                else\n                    set [guy dead v] to [true]\n                    broadcast (Death sound v) and wait\n                end\n            else\n            end\n            if <touching (bad v)?> then\n                start sound [weasleDie v]\n                point in direction (90)\n                set rotation style [all around v]\n                go to [back v] layer\n                set [yv v] to [5]\n                set [xv v] to [1]\n                set [holding key? v] to [0]\n                set [dead? v] to [true]\n                add [pop] to [sounds v]\n            end\n            set rotation style [left-right v]\n        else\n            set rotation style [all around v]\n            turn right (2) degrees\n            change [yv v] by (-1)\n            change y by (YV)\n            change x by (XV)\n        end\n        add (YV) to [yv v]\n        add (dead?) to [dead? v]\n        add (x position) to [x v]\n        add (y position) to [y v]\n        add (costume [name v]) to [costume? v]\n        add (direction) to [dir? v]\n        add [pop] to [sounds v]\n        set [clone y v] to (y position)\n        set [clone x v] to (x position)\n        set [clone dir v] to (direction)\n    else\n        if <<(level) = [2]> and <(length of [x v]) < [2]>> then\n            start sound [Pop v]\n            delete this clone\n        end\n        if <not <(length of [x v]) < [2]>> then\n            start sound (item (length of [sounds v]) of [sounds v])\n            switch costume to (item (length of [costume? v]) of [costume? v])\n            point in direction (item (length of [dir? v]) of [dir? v])\n            go to x: (item (length of [x v]) of [x v]) y: (item (length of [y v]) of [y v])\n            set [dead? v] to (item (length of [dead? v]) of [dead? v])\n            set [yv v] to (item (length of [yv v]) of [yv v])\n            delete (length of [yv v]) of [yv v]\n            delete (length of [costume? v]) of [costume? v]\n            delete (length of [x v]) of [x v]\n            delete (length of [y v]) of [y v]\n            delete (length of [dead? v]) of [dead? v]\n            delete (length of [dir? v]) of [dir? v]\n            delete (length of [sounds v]) of [sounds v]\n            if <key (left arrow v) pressed?> then\n                switch costume to (item (length of [costume? v]) of [costume? v])\n                point in direction (item (length of [dir? v]) of [dir? v])\n                go to x: (item (length of [x v]) of [x v]) y: (item (length of [y v]) of [y v])\n                set [dead? v] to (item (length of [dead? v]) of [dead? v])\n                set [yv v] to (item (length of [yv v]) of [yv v])\n                delete (length of [yv v]) of [yv v]\n                delete (length of [costume? v]) of [costume? v]\n                delete (length of [x v]) of [x v]\n                delete (length of [y v]) of [y v]\n                delete (length of [dead? v]) of [dead? v]\n                delete (length of [dir? v]) of [dir? v]\n                delete (length of [sounds v]) of [sounds v]\n            end\n        end\n    end\nend\n\nadd (dead?) to [dead? v]\nadd (x position) to [x v]\nadd (y position) to [y v]\nadd (costume [name v]) to [costume? v]\nadd (direction) to [dir? v]\n\ndefine move (dir) (speed)\nset [enemy slope v] to [0]\nchange x by (speed)\nrepeat until <<(enemy slope) = [2]> or <not <<touching (ground v)?> or <<touching (platform v)?> or <touching (wall v)?>>>>>\n    change y by (1)\n    set [yv v] to [-1]\n    change [enemy slope v] by (1)\nend\nif <(enemy slope) = [2]> then\n    change x by ((speed) * (-4))\n    turn right (180) degrees\nend\n\ndefine check for ground\nrepeat until <not <<touching (ground v)?> or <touching (wall v)?>>>\n    change y by (0.1)\n    set [yv v] to [-2]\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I receive [start v]\npoint in direction (-90)\nhide\ngo to x: (-22) y: (-140)\nset size to (25) %\ncreate clone of (_myself_ v)\nwait until <(level) = [4]>\nwait (2) seconds\ngo to x: (30) y: (-150)\npoint in direction (90)\ncreate clone of (_myself_ v)\n\nset rotation style [all around v]\nturn right (2) degrees\nchange [yv v] by (-1)\nchange y by (YV)\nchange x by (XV)\n\nset rotation style [left-right v]\n\nwait (1) seconds\nrepeat (2)\n    add (dead?) to [dead? v]\n    add (x position) to [x v]\n    add (y position) to [y v]\n    add (costume [name v]) to [costume? v]\n    add (direction) to [dir? v]\n    add [pop] to [sounds v]\n    set [clone y v] to (y position)\n    set [clone x v] to (x position)\n    set [clone dir v] to (direction)\nend\n\n@sound_clips\n\nwhen I receive [repeat forever v]\nif <(Intro) = [false]> then\n    if <not <(x pressed) = [wait]>> then\n        change [part v] by (1)\n        start sound (part)\n        wait (0.9) seconds\n        if <(part) > [397]> then\n            set [part v] to [0]\n        end\n        broadcast (repeat forever v) and wait\n    end\nend\n\nwhen [x v] key pressed\nstop [other scripts in sprite v]\nrepeat until <not <key (x v) pressed?>>\n    change [part v] by (-1)\n    start sound (part)\n    wait (0.8) seconds\n    if <key (left arrow v) pressed?> then\n        change [part v] by (-1)\n    end\n    if <(part) < [1]> then\n        set [part v] to [0]\n    end\nend\nbroadcast (repeat forever v)\n\nwhen I receive [start v]\nset [part v] to [0]\nbroadcast (repeat forever v)\n\nwhen flag clicked\nset [intro v] to [false]\n\n@shooter\n\nwhen flag clicked\nset size to (20) %\npoint in direction (90)\nturn right (15) degrees\nhide\nwait until <(level) = [2]>\ngo to x: (-161) y: (168)\nshow\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nset [shoot time v] to [0]\ndelete all of [shoot time v]\nforever\n    wait until <(x pressed) = [nope]>\n    if <not <key (x v) pressed?>> then\n        change [shoot time v] by (1)\n        if <(shoot time) > [150]> then\n            start sound [pop v]\n            create clone of (enemy v)\n            set [shoot time v] to [0]\n        end\n    else\n        change [shoot time v] by (-1)\n        if <key (left arrow v) pressed?> then\n            change [shoot time v] by (-1)\n        end\n        if <(shoot time) < [1]> then\n            set [shoot time v] to [151]\n        end\n    end\n    if <(level) = [3]> then\n        delete this clone\n    end\nend\n\nadd (shoot time) to [shoot time v]\n\nset [shoot time v] to (item (length of [shoot time v]) of [shoot time v])\ndelete (item (length of [shoot time v]) of [shoot time v]) of [shoot time v]\n\nset [shoot time v] to (item (length of [shoot time v]) of [shoot time v])\ndelete (item (length of [shoot time v]) of [shoot time v]) of [shoot time v]\n\nwhen I receive [next level v]\ndelete this clone\n\n@fence\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nswitch costume to (costume1 v)\ngo to [back v] layer\n\nwhen I receive [next level v]\nnext costume\n\n@logo\n\nwhen flag clicked\nset [die clones v] to [a]\nset size to (200) %\ngo to [front v] layer\npoint in direction (90)\nclear graphic effects\ngo to x: (-163) y: (-187)\nswitch costume to (kaylorb1 v)\nglide (0.7) secs to x: (0) y: (0)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (200)\nswitch costume to (kaylorb2 v)\nglide (0.7) secs to x: (0) y: (-2)\ncreate clone of (_myself_ v)\ngo to x: (163) y: (-100)\nswitch costume to (kaylorb3 v)\nglide (0.7) secs to x: (0) y: (-1)\ncreate clone of (_myself_ v)\nswitch costume to (kaylorb v)\nwait (0.35) seconds\nstart sound [Spiral v]\nwait (0.35) seconds\nset [yv v] to [0]\nset [die clones v] to [die]\nrepeat (5)\n    change [yv v] by (2)\n    change y by (yv)\nend\nrepeat (20)\n    change [yv v] by (-2)\n    change y by (yv)\n    change [ghost v] effect by (5)\nend\nbroadcast (start v)\n\nwhen I start as a clone\nbroadcast (Boom v)\nstart sound [Crunch v]\nwait until <(die clones) = [die]>\ndelete this clone\n\nwhen I receive [outro v]\nwait (3) seconds\ngo to x: (0) y: (20)\nshow\nclear graphic effects\ngo to [front v] layer\nset size to (100) %\nswitch costume to (kaylorb v)\nwait (1) seconds\nforever\n    wait (0.39) seconds\n    change size by (5)\n    wait (0) seconds\n    change size by (5)\n    wait (0) seconds\n    change size by (-5)\n    wait (0) seconds\n    change size by (-5)\nend\n\nbroadcast (Outro v)\n\n@level show\n\nwhen flag clicked\nswitch costume to (the pit v)\nhide\n\nwhen I receive [level show pit v]\nset size to (110) %\nswitch costume to (the pit v)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nbroadcast (start v)\nrepeat (4)\n    change [ghost v] effect by (25)\nend\n\nwhen I receive [level show back v]\nnext costume\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (4)\n    change [ghost v] effect by (25)\nend\n\n@cloud shooter\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\nwait until <(level) = [3]>\nwait (2) seconds\npoint in direction (-90)\ngo to x: (196) y: (-34)\nshow\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\ndelete all of [shoot v]\nset [shoot time v] to [0]\nforever\n    go to [front v] layer\n    wait until <(x pressed) = [nope]>\n    if <not <key (x v) pressed?>> then\n        change [shoot time v] by (1)\n        if <(shoot time) > [300]> then\n            start sound [pop v]\n            create clone of (cloud v)\n            set [shoot time v] to [0]\n        end\n        add (shoot time) to [shoot v]\n    else\n        if <not <(length of [shoot v]) < [2]>> then\n            delete (length of [shoot v]) of [shoot v]\n            set [shoot time v] to (item (length of [shoot v]) of [shoot v])\n            if <key (left arrow v) pressed?> then\n                delete (length of [shoot v]) of [shoot v]\n                set [shoot time v] to (item (length of [shoot v]) of [shoot v])\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwait (1) seconds\n\nset rotation style [left-right v]\n\n@cloud\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ndelete all of [cloud x v]\nshow\ngo to (cloud shooter v)\nchange y by (-2)\nset [x v] to (x position)\nforever\n    if <not <key (x v) pressed?>> then\n        add (x position) to [cloud x v]\n        change x by (-1)\n    else\n        set x to (item (length of [cloud x v]) of [cloud x v])\n        delete (length of [cloud x v]) of [cloud x v]\n        if <(x position) = (x)> then\n            delete this clone\n        end\n        if <key (left arrow v) pressed?> then\n            set x to (item (length of [cloud x v]) of [cloud x v])\n            delete (length of [cloud x v]) of [cloud x v]\n        end\n        if <(x position) = (x)> then\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [next level v]\ndelete this clone\n\n@cloud shooter2\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\nwait until <(level) = [3]>\nwait (2) seconds\npoint in direction (-90)\ngo to x: (200) y: (-54)\nshow\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nset [shoot time v] to [50]\ndelete all of [shoot time v]\nforever\n    go to [front v] layer\n    wait until <(x pressed) = [nope]>\n    if <not <key (x v) pressed?>> then\n        change [shoot time v] by (1)\n        if <(shoot time) > [300]> then\n            start sound [pop v]\n            create clone of (cloud2 v)\n            set [shoot time v] to [0]\n        end\n    end\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwait (1) seconds\n\nchange [shoot time v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [shoot time v] by (-1)\nend\nif <(shoot time) < [1]> then\n    set [shoot time v] to [201]\nend\n\n@cloud2\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ndelete all of [cloud x v]\nshow\ngo to (cloud shooter2 v)\nchange y by (-2)\nset [x v] to (x position)\nforever\n    add (x position) to [cloud x v]\n    change x by (-1)\n    if <(x position) = [-252]> then\n        delete this clone\n    end\nend\n\nif <not <key (x v) pressed?>> then\nset x to (item (length of [cloud x v]) of [cloud x v])\ndelete (length of [cloud x v]) of [cloud x v]\nif <(x position) = (x)> then\n    delete this clone\nend\nif <key (left arrow v) pressed?> then\n    set x to (item (length of [cloud x v]) of [cloud x v])\n    delete (length of [cloud x v]) of [cloud x v]\nend\n\nwhen I receive [next level v]\ndelete this clone\n\n@Platform\n\nwhen flag clicked\nhide\n\nwhen I receive [lever pulled v]\ngo to [front v] layer\nif <(lever) = [right]> then\n    start sound [pop v]\n    glide (2) secs to x: (-145) y: (1)\n    set [lever v] to [left]\nelse\n    start sound [pop v]\n    glide (2) secs to x: (25) y: (0)\n    set [lever v] to [right]\nend\n\nwhen flag clicked\nset [lever v] to [right]\ngo to x: (25) y: (0)\nhide\nwait until <(level) = [4]>\nshow\nwait until <(level) = [5]>\nhide\n\n@Sprite4\n\nwhen flag clicked\nhide\nwait until <(level) = [4]>\nshow\nforever\n    if <<touching (guy v)?> and <key (z v) pressed?>> then\n        broadcast (lever pulled v)\n        next costume\n        wait (2) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (guy v)?> then\n        set [touching v] to [true]\n    else\n        set [touching v] to [false]\n    end\nend\n\n@Z\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nforever\n    if <(touching) = [true]> then\n        repeat (20)\n            change [ghost v] effect by (-5)\n        end\n        wait until <(touching) = [false]>\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\nend\n\n@Plants\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\n\nswitch costume to (flower v)\ngo to x: (0) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-23) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-43) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-50) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flora1 v)\ngo to x: (-84) y: (-136)\ncreate clone of (_myself_ v)\nswitch costume to (killsign v)\ngo to x: (-190) y: (0)\ncreate clone of (_myself_ v)\nswitch costume to (flora2 v)\ngo to x: (20) y: (-136)\ncreate clone of (_myself_ v)\nwait until <(level) = [2]>\nswitch costume to (flora3 v)\ngo to x: (170) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-160) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-140) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-130) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (-122) y: (-143)\ncreate clone of (_myself_ v)\nwait until <(level) = [3]>\nswitch costume to (flora3 v)\ngo to x: (100) y: (-140)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (pick random (-200) to (200)) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (pick random (-200) to (200)) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (pick random (-200) to (200)) y: (-143)\ncreate clone of (_myself_ v)\nswitch costume to (flower v)\ngo to x: (pick random (-200) to (200)) y: (-143)\ncreate clone of (_myself_ v)\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nif <(costume [name v]) = [killsign]> then\n    go to [front v] layer\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\nshow\n\n@AI\n\nwhen flag clicked\nhide\n\nwhen I receive [you win! v]\nset size to (35) %\ngo to x: (300) y: (-90)\nswitch costume to (greeter-walk-b v)\nshow\ngo to [front v] layer\nrepeat (3)\n    switch costume to (greeter-walk-b v)\n    repeat (11)\n        wait (0) seconds\n        change x by (-4)\n        next costume\n    end\nend\nbroadcast (Talk v)\nSpeak [Thank you for coming.]\nwait (1) seconds\nbroadcast (Talk v)\nSpeak [Lord Carmouth has taken our land and captured many.]\nwait (1) seconds\nbroadcast (Talk v)\nSpeak [Please help us!]\nwait (1) seconds\nsay []\nset [intro v] to [True]\nbroadcast (End v)\n\ndefine Speak (text)\ndelete all of [words v]\nset [i v] to [0]\nrepeat ((length of (text)) + (1))\n    say (join (item (i) of [words v]) (letter (i) of (text)))\n    add (join (item (i) of [words v]) (letter (i) of (text))) to [words v]\n    change [i v] by (1)\n    wait (0.02) seconds\nend\n\nwhen I receive [talk v]\nrepeat (5)\n    wait (0.1) seconds\n    switch costume to (greeter2 v)\n    wait (0.1) seconds\n    next costume\nend\n\n@Cloud\n\nwhen flag clicked\nhide\n\n@Outro\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [end v]\nbroadcast (Outro v)\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    switch costume to (costume1 v)\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    show\n    repeat (50)\n        change [ghost v] effect by (-2)\n        wait (0) seconds\n    end\n    wait (3) seconds\nelse\n    if <(costume [number v]) = [2]> then\n        switch costume to (costume2 v)\n        go to [front v] layer\n        set [ghost v] effect to (100)\n        show\n        repeat (50)\n            change [ghost v] effect by (-2)\n            wait (0) seconds\n        end\n    else\n        if <(costume [number v]) = [3]> then\n            go to [front v] layer\n            switch costume to (costume3 v)\n            hide\n            clear graphic effects\n            wait (0.2) seconds\n            go to x: (-50) y: (-200)\n            show\n            glide (0.3) secs to x: (-50) y: (-100)\n            glide (0.3) secs to x: (-50) y: (-80)\n            glide (0.4) secs to x: (-50) y: (-50)\n            forever\n                repeat (5)\n                    turn right (1) degrees\n                    change size by (1)\n                end\n                repeat (5)\n                    turn left (1) degrees\n                end\n                repeat (5)\n                    change size by (-1)\n                    turn left (1) degrees\n                end\n                repeat (5)\n                    turn right (1) degrees\n                end\n            end\n        else\n            if <(costume [number v]) = [4]> then\n                go to [front v] layer\n                switch costume to (costume4 v)\n                hide\n                clear graphic effects\n                wait (0.2) seconds\n                go to x: (100) y: (200)\n                show\n                glide (0.3) secs to x: (50) y: (100)\n                glide (0.3) secs to x: (40) y: (80)\n                glide (0.4) secs to x: (30) y: (50)\n                forever\n                    repeat (5)\n                        change size by (1)\n                        wait (0) seconds\n                    end\n                    repeat (5)\n                        change size by (-1)\n                        wait (0) seconds\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [outro v]\nstart sound [OMFG - Ice Cream.mp3 v]\nset size to (100) %\npoint in direction (90)\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nwait (2) seconds\nrepeat (4)\n    create clone of (_myself_ v)\n    next costume\nend\n\n@ground\n\nwhen I receive [next level v]\nnext costume\ndelete this clone\n\nwhen I start as a clone\nif <(level) = [3]> then\n    go to x: (163) y: (-34)\n    switch costume to (costume2 v)\n    forever\n        change x by (-2)\n    end\nend\nset [wall change v] to [0]\nforever\n    wait until <(x pressed) = [nope]>\n    if <not <<([y position v] of [guy v]) < (y position)> and <([x position v] of [guy v]) > ((x position) - (20))>>> then\n        if <key (x v) pressed?> then\n            if <(wall change) < [0.1]> then\n                if <(y position) < [40]> then\n                    change y by (0.15)\n                    if <key (left arrow v) pressed?> then\n                        change y by (0.15)\n                    end\n                end\n            else\n                if <key (left arrow v) pressed?> then\n                    change [wall change v] by (-1)\n                end\n                change [wall change v] by (-1)\n            end\n        else\n            if <not <(y position) < [-24]>> then\n                change y by (-0.15)\n            else\n                change [wall change v] by (1)\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nset size to (10) %\ngo to [front v] layer\nswitch costume to (dot v)\nset size to (100) %\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nwait until <(level) = [2]>\ngo to x: (180) y: (50)\nswitch costume to (wall v)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (0)\nrepeat (3)\n    switch costume to (costume3 v)\nend\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\n\nwhen flag clicked\nset [level v] to [1]\ngo to [back v] layer\n\nwait until <(costume [name v]) = [happy]>\nswitch costume to (dot v)\nset size to (200) %\nswitch costume to (happy v)\n\nforever\n    if <(level) = [3]> then\n        set x to ((812) - (scrollX))\n    end\nend\n\nwhen I start as a clone\nforever\n    play sound [Grind v] until done\nend\n\n
Click the flag wait until the game starts and press the flag again if the level is small. Yeah its annoying.\n                   check out my new game! \n        https://scratch.mit.edu/projects/350529894/\nDon't look at the comments unless you are prepared for spoilers. Don't worry all levels are possible! I check daily and every level is possible. If you can't figure out a level, check the comments.\n\nPlease don't advertise. It will be deleted. If you want your projects to be viewed go to https://scratch.mit.edu/discuss/8/ \n\nAn original time traveling game! Press X to rewind. While rewinding press the left arrow key to rewind faster. use W,A,D or arrow keys to move.\n\nALL levels are possible. If you cant figure one out remember this game is ALL about time travel so press X.                      \n\nThere are currently 4 levels. Try to beat them without death... wait... you can't really die. you just press x to come back!\n\nIf something is wrong please comment and tell me.\n\n\n\n\n\n\n\n\n\n\n\n\n\n#braid #timetravel #time #timemanipulation #bendtime #braidgame #platformer #game #play #fun #mario (type game) #music #shirakammen #downstream #sound #graphics #player #animation