Crumble- Puzzle Platformer v1.51
@Stage\n\nwhen flag clicked\nforever\n    play sound [Flavored Ice \(Epic 8-bit song!\) v] until done\n    wait (1) seconds\nend\n\n@Blank\n\n@Player\n\nwhen I receive [death v]\nplay sound [Death v] until done\n\nwhen I receive [hide all v]\nhide\n\nwhen I receive [start v]\nswitch backdrop to (bg v)\nset [level v] to [1]\nset [frame v] to [0]\nSpawn\nbroadcast (Refresh v)\nforever\n    go to [front v] layer\n    set size to (100) %\n    switch costume to (hitbox v)\n    change [sy v] by (-1)\n    if <<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(Jumping) = [False]>> and <(SY) > [-2]>> or <touching color (#991f31)?>> then\n        if <<(Boost) = [0]> and <not <touching color (#991f31)?>>> then\n            set [sy v] to [10]\n        else\n            set [sy v] to [14.5]\n        end\n        set [jumping v] to [True]\n    end\n    if <<color (#ff0000) is touching (#404456)?> or <color (#ff0000) is touching (#0f9cd4)?>> then\n        set size to (200) %\n        switch costume to (3 v)\n        broadcast (Death v)\n    end\n    change y by (SY)\n    Touch Y\n    change [sx v] by ((<<key (right arrow v) pressed?> or <key (d v) pressed?>> + (<<key (left arrow v) pressed?> or <key (a v) pressed?>> * (-1))) * (1.5))\n    set [sx v] to ((SX) * (0.8000005))\n    change x by (SX)\n    Touch X\n    switch costume to (death detector v)\n    if <touching color (#484e60)?> then\n        repeat (1)\n            set size to (200) %\n            broadcast (Game Tick v)\n            switch costume to (3 v)\n        end\n        broadcast (Death v)\n    end\n    switch costume to (boost detector v)\n    if <touching color (#713c41)?> then\n        set [boost v] to [1]\n    else\n        set [boost v] to [0]\n    end\n    set size to (200) %\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n        switch costume to (walk #)\n    else\n        if <<(Jumping) = [True]> and <not <<touching color (#703c41)?> or <touching color (#6f3e43)?>>>> then\n            switch costume to (3 v)\n        else\n            switch costume to (idle #)\n        end\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n    end\n    if <not <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> or <[] = [True]>>> then\n        set y to (([ceiling v] of ((y position) * (18)) ) / (18))\n    end\n    if <<<touching color (#981a2d)?> or <touching color (#495068)?>> and <(blocks) = [0]>> then\n        repeat (10)\n            broadcast (Game Tick v)\n        end\n        change [level v] by (1)\n        broadcast (next v)\n        hide\n        Spawn\n    end\n    if <key (n v) pressed?> then\n        repeat (10)\n            broadcast (Game Tick v)\n        end\n        change [level v] by (1)\n        broadcast (next v)\n        hide\n        Spawn\n    end\n    change [frame v] by (1)\n    broadcast (Game Tick v)\n    go to [front v] layer\nend\n\nwhen I receive [start v]\nset [walk # v] to [1]\nforever\n    wait (0.1) seconds\n    set [walk # v] to [2]\n    wait (0.1) seconds\n    set [walk # v] to [3]\n    wait (0.1) seconds\n    set [walk # v] to [4]\n    wait (0.1) seconds\n    set [walk # v] to [1]\nend\n\nwhen I receive [start v]\nset [idle # v] to [4]\nforever\n    wait (0.4) seconds\n    set [idle # v] to [5]\n    wait (0.4) seconds\n    set [idle # v] to [4]\nend\n\nwhen I receive [restart v]\nSpawn\n\ndefine Touch X\nif <(crushed) = [false]> then\n    if <<<<touching color (#703c41)?> or <touching (invis hitbox v)?>> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <touching color (#434a5f)?>> then\n        repeat until <not <<<<touching color (#703c41)?> or <touching (invis hitbox v)?>> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <touching color (#434a5f)?>>>\n            if <not <(SX) = [0]>> then\n                change x by ((0) - (((SX) / ([abs v] of (SX) )) * (1.000000000000000000000000000000000000000000000000005)))\n            end\n        end\n        set [sx v] to [0]\n    end\nend\n\ndefine Touch Y\nif <<color (#ff0000) is touching (#404456)?> or <color (#ff0000) is touching (#2abcec)?>> then\n    set size to (200) %\n    switch costume to (3 v)\n    broadcast (Death v)\n    hide\n    set [crushed v] to [true]\n    stop [this script v]\nelse\n    if <(crushed) = [false]> then\n        if <<<<touching color (#703c41)?> or <touching (invis hitbox v)?>> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <touching color (#434a5f)?>> then\n            repeat until <not <<<<touching color (#703c41)?> or <touching (invis hitbox v)?>> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <touching color (#434a5f)?>>>\n                change y by ((0) - ((SY) / ([abs v] of (SY) )))\n            end\n            if <(SY) < [0]> then\n                set [jumping v] to [False]\n            end\n            set [sy v] to [0]\n        end\n    end\nend\n\ndefine Spawn\nset [keys collected v] to [0]\npoint in direction (90)\nbroadcast (Refresh v)\nset size to (200) %\nswitch costume to (4 v)\nset rotation style [don't rotate v]\nset rotation style [left-right v]\nshow\ngo to x: (((item (((Level) * (2)) - (1)) of [spawnpoints v]) + (0.5)) * (36)) y: (((item ((Level) * (2)) of [spawnpoints v]) - (0.5)) * (36))\nset [ghost v] effect to (0)\ngo to [front v] layer\nset [sx v] to [0]\nset [sy v] to [0]\nset [grid x v] to [0]\nset [grid y v] to [0]\nset [moving? v] to [False]\nset [speed v] to [0]\nset [jumping v] to [True]\nset [switched blocks v] to [false]\nset [crushed v] to [false]\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\nstop [this script v]\n\nwhen I receive [death v]\nhide\nSpawn\n\n@Tiles\n\ndefine setup\nstop [other scripts in sprite v]\nswitch backdrop to (bg v)\nif <(Level) > ((length of [spawnpoints v]) / (2))> then\n    broadcast (end v)\n    switch backdrop to (end v)\n    stop [other scripts in sprite v]\n    stop [this script v]\nend\nMake border\ngo to x: (-198) y: (126)\nswitch costume to (x v)\nset size to (200) %\nset [@ blocks v] to [0]\nset [blocks v] to [0]\nset [counter v] to [1]\nset [number v] to [1]\nset [# v] to []\nset [#2 v] to []\nset [original v] to [false]\nhide\nrepeat (8)\n    repeat (12)\n        switch costume to (letter (counter) of (item (Level) of [layouts v]))\n        set [ghost v] effect to (0)\n        if <<<(costume [name v]) = [8]> or <(costume [name v]) = [4]>> or <<(costume [name v]) = [2]> or <<(costume [name v]) = [6]> or <(costume [name v]) = [0]>>>> then\n            stamp\n        else\n            create clone of (_myself_ v)\n        end\n        change x by (36)\n        change [counter v] by (1)\n        change [number v] by (1)\n    end\n    set x to (-198)\n    change y by (-36)\n    change [counter v] by (3)\n    change [number v] by (3)\nend\nset [original v] to [true]\n\nwhen I receive [setup v]\nerase all\nsetup\n\nwhen I receive [restart v]\nbroadcast (setup v)\nerase all\ndelete this clone\n\nwhen I receive [death v]\nbroadcast (setup v)\nerase all\ndelete this clone\n\nwhen I receive [start v]\nbroadcast (setup v)\nerase all\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen [r v] key pressed\nif <(playing) = [1]> then\n    broadcast (restart v)\nend\nwait until <not <key (r v) pressed?>>\n\nwhen I receive [next v]\nbroadcast (setup v)\nerase all\ndelete this clone\n\nwhen I receive [start v]\nset [playing v] to [1]\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen flag clicked\nbroadcast (start v)\n\nwhen I start as a clone\nif <(costume [name v]) = [x]> then\n    delete this clone\nend\nif <<(costume [number v]) > [21]> and <(costume [number v]) < [30]>> then\n    go to [back v] layer\n    go [forward v] (10) layers\nend\nshow\nwait (0.15) seconds\nif <not <<(costume [name v]) = [m]> or <(costume [name v]) = [+]>>> then\n    forever\n        if <<(costume [name v]) = [k]> and <<touching color (#9fa5bd)?> or <<touching (player v)?> and <(distance to [player v]) < [30]>>>> then\n            wait (0.05) seconds\n            broadcast (Unlock v)\n            switch costume to (smoke1 v)\n            start sound [Door v]\n            repeat (3)\n                wait (0.005) seconds\n                next costume\n            end\n            wait (0.005) seconds\n            delete this clone\n        end\n        if <<<touching (player v)?> and <(costume [name v]) = ["]>> and <(distance to [player v]) < [34]>> then\n            wait (0.1) seconds\n            switch costume to (" bounce v)\n            wait (0.15) seconds\n            switch costume to (" v)\n        end\n        if <(costume [name v]) = [v]> then\n            set [block type v] to [v]\n            forever\n                if <(Level) > [20]> then\n                    switch costume to (v hitbox v)\n                    go to [front v] layer\n                    go [backward v] (1) layers\n                    change [v sy v] by (-1)\n                    change y by (v SY)\n                    Touch Y\n                    if <touching color (#1599c2)?> then\n                        switch costume to (v v)\n                    else\n                        switch costume to (v_stopped v)\n                    end\n                end\n            end\n        end\n        if <<<(costume [name v]) = [b]> or <(costume [name v]) = [b_pressed]>> and <<<touching (player v)?> and <<(Jumping) = [false]> and <(distance to [player v]) < [30]>>> or <touching color (#424655)?>>> then\n            set [switched blocks v] to [true]\n            switch costume to (b_pressed v)\n            broadcast (swap blocks v)\n        end\n        if <<(costume [name v]) = [b_pressed]> and <not <<<touching (player v)?> and <(distance to [player v]) < [30]>> or <touching color (#424655)?>>>> then\n            wait (0.5) seconds\n            set [switched blocks v] to [false]\n            switch costume to (b v)\n            broadcast (swap blocks v)\n        end\n        if <<(costume [name v]) = [b]> and <<not <<touching (tiles v)?> or <<touching (invis hitbox v)?> or <touching (player v)?>>>> or <touching color (#1599c2)?>>> then\n            wait (0.005) seconds\n            switch costume to (smoke1 v)\n            repeat (3)\n                wait (0.005) seconds\n                next costume\n            end\n            wait (0.005) seconds\n            delete this clone\n        end\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) < [6]> then\n    set [block type v] to (costume [name v])\n    change [blocks v] by (1)\n    wait (0.05) seconds\n    if <(costume [name v]) = [@]> then\n        change [@ blocks v] by (1)\n    end\n    forever\n        if <(costume [name v]) = [@]> then\n            if <(blocks) = (@ blocks)> then\n                set [block type v] to [@ breakable]\n                switch costume to (@ breakable v)\n            end\n        else\n            Set costume (block type)\n        end\n    end\nend\nif <<(costume [name v]) = [*]> or <(costume [name v]) = [#]>> then\n    wait (0.05) seconds\n    set [block type v] to (costume [name v])\nend\n\ndefine Make border\nerase all\ngo to [back v] layer\ngo [forward v] (10) layers\nset size to (200) %\ngo to x: (-234) y: (162)\nswitch costume to (bg1 v)\nstamp\nchange x by (36)\nswitch costume to (bg2 v)\nrepeat (12)\n    stamp\n    change x by (36)\nend\nswitch costume to (bg3 v)\nstamp\nrepeat (7)\n    set x to (-234)\n    change y by (-36)\n    switch costume to (bg4 v)\n    stamp\n    set x to (234)\n    switch costume to (bg5 v)\n    stamp\n    change x by (36)\nend\ngo to x: (-234) y: (-126)\nswitch costume to (bg4 v)\nstamp\nchange x by (36)\nswitch costume to (2 v)\nrepeat (12)\n    if <not <(Level) = [30]>> then\n        stamp\n    end\n    change x by (36)\nend\nswitch costume to (bg5 v)\nstamp\ngo to x: (-234) y: (-162)\nswitch costume to (bg7 v)\nstamp\nchange x by (36)\nswitch costume to (bg8 v)\nrepeat (12)\n    stamp\n    change x by (36)\nend\nswitch costume to (bg6 v)\nstamp\nchange x by (36)\n\nwhen I receive [unlock v]\nif <(costume [name v]) = [+]> then\n    wait (0.05) seconds\n    switch costume to (smoke1 v)\n    repeat (3)\n        wait (0.005) seconds\n        next costume\n    end\n    wait (0.005) seconds\n    delete this clone\nend\nif <(costume [name v]) = [=]> then\n    set [block type v] to [m]\n    switch costume to (m v)\nend\n\nwhen I start as a clone\nforever\n    set size to (200) %\nend\n\ndefine Touch Y\nif <<<touching color (#703c41)?> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <<touching color (#434a5f)?> or <touching (invis hitbox v)?>>> then\n    repeat until <not <<<touching color (#703c41)?> or <<touching color (#6f3e43)?> or <<touching color (#345551)?> or <touching color (#0e6588)?>>>> or <<touching color (#434a5f)?> or <touching (invis hitbox v)?>>>>\n        change y by ((0) - ((v SY) / ([abs v] of (v SY) )))\n    end\n    set [v sy v] to [0]\nend\n\ndefine Set costume (type)\nswitch costume to (type)\nif <<touching (player v)?> and <<([y position v] of [player v]) > ((y position) + (34))> and <<([x position v] of [player v]) < ((x position) + (30))> and <([x position v] of [player v]) > ((x position) - (30))>>>> then\n    if <not <(type) = [!]>> then\n        wait until <<not <touching (player v)?>> or <<([x position v] of [player v]) > ((x position) + (35))> or <([x position v] of [player v]) < ((x position) - (35))>>>\n    end\n    if <(type) = [!]> then\n        wait (1.005) seconds\n        switch costume to (smoke1 v)\n        start sound [Crunch v]\n        repeat (3)\n            wait (0.005) seconds\n            next costume\n        end\n        change [blocks v] by (-1)\n        wait (0.005) seconds\n        delete this clone\n    end\n    if <<(type) = [m]> or <(type) = [^]>> then\n        wait (0.005) seconds\n        switch costume to (smoke1 v)\n        start sound [Crunch v]\n        repeat (3)\n            wait (0.005) seconds\n            next costume\n        end\n        change [blocks v] by (-1)\n        wait (0.005) seconds\n        delete this clone\n    else\n        if <(costume [name v]) = [@ breakable]> then\n            wait (0.005) seconds\n            switch costume to (smoke1 v)\n            start sound [Crunch v]\n            repeat (3)\n                wait (0.005) seconds\n                next costume\n            end\n            change [blocks v] by (-1)\n            change [@ blocks v] by (-1)\n            wait (0.005) seconds\n            delete this clone\n        end\n    end\nend\nif <<touching color (#404456)?> and <(Level) > [20]>> then\n    if <(type) = [!]> then\n        switch costume to (! v)\n        wait (1.005) seconds\n        switch costume to (smoke1 v)\n        start sound [Crunch v]\n        repeat (3)\n            wait (0.005) seconds\n            next costume\n        end\n        change [blocks v] by (-1)\n        wait (0.005) seconds\n        delete this clone\n    end\n    if <<(type) = [m]> or <(type) = [^]>> then\n        switch costume to (type)\n        wait (0.005) seconds\n        switch costume to (smoke1 v)\n        start sound [Crunch v]\n        repeat (3)\n            wait (0.005) seconds\n            next costume\n        end\n        change [blocks v] by (-1)\n        wait (0.005) seconds\n        delete this clone\n    else\n        if <(type) = [@ breakable]> then\n            wait (0.005) seconds\n            switch costume to (smoke1 v)\n            start sound [Crunch v]\n            repeat (3)\n                wait (0.005) seconds\n                next costume\n            end\n            change [blocks v] by (-1)\n            change [@ blocks v] by (-1)\n            wait (0.005) seconds\n            delete this clone\n        end\n    end\nend\n\nif <(Level) > [20]> then\n    switch costume to (m hitbox v)\nend\n\nswitch costume to (type)\nset [level v] to [21]\n\ndefine handle swap blocks\nif <not <(costume [name v]) = [m]>> then\n    if <(switched blocks) = [true]> then\n        if <(block type) = [#]> then\n            switch costume to (* v)\n        end\n        if <(block type) = [*]> then\n            if <<(costume [name v]) = [*]> and <touching color (#424655)?>> then\n                switch costume to (* v)\n                wait until <not <touching color (#424655)?>>\n                switch costume to (# v)\n            else\n                switch costume to (# v)\n            end\n        end\n    else\n        if <(block type) = [#]> then\n            if <<(costume [name v]) = [*]> and <touching color (#424655)?>> then\n                switch costume to (* v)\n                wait until <not <touching color (#424655)?>>\n                switch costume to (# v)\n            else\n                switch costume to (# v)\n            end\n        end\n        if <(block type) = [*]> then\n            switch costume to (* v)\n        end\n    end\nend\n\nwhen I receive [swap blocks v]\nhandle swap blocks\n\nif <(original) = [false]> then\n\nstart sound [Door v]\n\nstart sound [Crunch v]\n\n@Level counter\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nshow\nif <(n) = [1]> then\n    forever\n        go to [front v] layer\n        switch costume to (letter (1) of (Level))\n        if <(letter (1) of (Level)) = []> then\n            hide\n        else\n            show\n        end\n    end\nend\nif <(n) = [2]> then\n    forever\n        go to [front v] layer\n        switch costume to (letter (2) of (Level))\n        if <(letter (2) of (Level)) = []> then\n            hide\n        else\n            show\n        end\n    end\nend\n\nwhen I receive [end v]\ndelete this clone\n\nwhen flag clicked\nset size to (100) %\nhide\ngo to x: (-224) y: (164)\nset [n v] to [0]\nrepeat (2)\n    change [n v] by (1)\n    create clone of (_myself_ v)\n    change x by (16)\nend\n\nwhen I receive [next v]\ngo to [front v] layer\n\nwhen I receive [death v]\ngo to [front v] layer\n\nwhen I receive [restart v]\ngo to [front v] layer\n\n@Klowdz\n\nwhen I start as a clone\nset [ghost v] effect to (pick random (20) to (40))\nset [klowd type v] to (pick random (1) to (3))\nchange [clouds v] by (1)\nshow\ngo to x: (-300) y: (pick random (-20) to (160))\nset y to ((([floor v] of ((y position) * (18)) ) / (18)) + (2))\nset [speed v] to (pick random (1) to (1.5))\nrepeat until <(x position) > [300]>\n    switch costume to (beeg v)\n    go to [back v] layer\n    change x by (Speed)\n    switch costume to (Klowd type)\nend\nchange [clouds v] by (-1)\ndelete this clone\n\nwhen flag clicked\nset [clouds v] to [0]\n\nforever\n    if <(clouds) < [4]> then\n        create clone of (_myself_ v)\n    end\n    wait (pick random (4.5) to (7)) seconds\nend\n\nwhen I receive [end v]\nwait (0.05) seconds\nstop [other scripts in sprite v]\n\nwhen I receive [end v]\ndelete this clone\n\nwhen I receive [setup v]\ngo to [back v] layer\n\n@invis hitbox\n\ndefine hitbox x: (x) y: (y)\nhide\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [ghost v] effect to (100)\nset [original v] to [false]\nshow\n\nwhen I receive [death v]\ndelete this clone\n\nwhen I receive [next v]\ndelete this clone\n\nwhen I receive [restart v]\ndelete this clone\n\nwhen I receive [setup v]\nsetup\n\nwhen I receive [start v]\ndelete this clone\n\nwhen flag clicked\nset [original v] to [true]\nhide\n\nwhen I receive [hitbox v]\nif <(original) = [true]> then\n    hitbox x: (hitbox x) y: (hitbox y)\nend\n\ndefine setup\ngo to x: (-198) y: (126)\nswitch costume to (0 invis hitbox v)\nset size to (200) %\nset [@ blocks v] to [0]\nset [blocks v] to [0]\nset [counter v] to [1]\nset [number v] to [1]\nset [# v] to []\nset [#2 v] to []\nset [original v] to [false]\nhide\nrepeat (8)\n    repeat (12)\n        switch costume to (b v)\n        set [ghost v] effect to (0)\n        if <(letter (counter) of (item (Level) of [layouts v])) = [0]> then\n            create clone of (_myself_ v)\n        end\n        change x by (36)\n        change [counter v] by (1)\n        change [number v] by (1)\n    end\n    set x to (-198)\n    change y by (-36)\n    change [counter v] by (3)\n    change [number v] by (3)\nend\nset [original v] to [true]\nTest\n\n@cycle\n\ndefine cycle\nif <<(Level) = [29]> or <(Level) = [30]>> then\n    repeat until <(Level) > [30]>\n        set [cycle countdown v] to [3]\n        repeat (3)\n            wait (1) seconds\n            change [cycle countdown v] by (-1)\n            start sound [Ding v]\n        end\n        set [switched blocks v] to [true]\n        broadcast (swap blocks v)\n        set [cycle countdown v] to [3]\n        repeat (3)\n            wait (1) seconds\n            change [cycle countdown v] by (-1)\n            start sound [Ding v]\n        end\n        set [switched blocks v] to [false]\n        broadcast (swap blocks v)\n    end\nend\n\nwhen I receive [setup v]\nstop [other scripts in sprite v]\ncycle\n\n@Cycle counter\n\nwhen flag clicked\nset size to (100) %\nhide\ngo to x: (224) y: (164)\nforever\n    go to [front v] layer\n    switch costume to (cycle countdown)\n    if <<(Level) = [29]> or <(Level) = [30]>> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [next v]\ngo to [front v] layer\n\nwhen I receive [death v]\ngo to [front v] layer\n\nwhen I receive [restart v]\ngo to [front v] layer\n\n@Thumbnail\n\nwhen flag clicked\nset [timer v] to [0.0001]\nhide\nforever\n    go to [front v] layer\n    set [timer v] to ((timer) + (0.0001))\nend\n\nwhen [timer v] > (Timer)\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nbroadcast (Hide all v)\n\n
Welcome to Crumble!\n\nStep on all of the brown and yellow blocks to break them, and then make your way to the flag to win!\nThere are currently 30 levels to solve; good luck!\n\nArrow keys/ WASD to move, and R to restart the level.\nPress N to skip a level (only if you REALLY need to!)\n\nHINT: If an arrow is pointing at a block, it may mean that you need to skip over that block and come back to it later! Or maybe it's telling you which key or button to use? Use this information to help you solve the level!