Blocky Platformer


@Stage\n\nwhen I receive [>start game v]\nshow variable [fails v]\nforever\n    reset timer\n    if <<(Level) < [14]> or <(Level) > [20]>> then\n        switch backdrop to (backdrop1 v)\n    else\n        if <(Level) > [17]> then\n            switch backdrop to (backdrop3 v)\n        else\n            switch backdrop to (backdrop2 v)\n        end\n    end\nend\n\nshow variable [level v]\n\n@tile\n\nwhen I receive [level next v]\ndelete this clone\n\nwhen I receive [>start game v]\nset size to (235) %\ngo to x: (0) y: (0)\nset [fails v] to [0]\nbroadcast (tile generate v)\n\ndefine clone\nset size to (260) %\nif <(costume [number v]) = [6]> then\n    set size to (266) %\nend\ncreate clone of (_myself_ v)\n\ndefine tile generate\ngo to x: (-230) y: (-170)\nrepeat (item (Level) of [levelsize 1-18 v])\n    switch costume to (sky v)\n    set size to (100) %\n    repeat (24)\n        if <touching (lvl v)?> then\n            set size to (10) %\n            if <touching color (#ccffdd)?> then\n                switch costume to (grass v)\n                clone\n            else\n                if <touching color (#cccccc)?> then\n                    switch costume to (dirt v)\n                    clone\n                else\n                    if <touching color (#ffd499)?> then\n                        switch costume to (lava v)\n                        clone\n                    else\n                        if <touching color (#e5e5e5)?> then\n                            switch costume to (dirt2 v)\n                            clone\n                        else\n                            if <touching color (#66004c)?> then\n                                switch costume to (goal v)\n                                clone\n                            else\n                                if <touching color (#99ffbb)?> then\n                                    switch costume to (tall grass v)\n                                    clone\n                                else\n                                    if <touching color (#b2b2b2)?> then\n                                        switch costume to (stone v)\n                                        clone\n                                    else\n                                        if <touching color (#00ff55)?> then\n                                            switch costume to (sign1 v)\n                                            clone\n                                        else\n                                            if <touching color (#ffe9cc)?> then\n                                                switch costume to (sign2 v)\n                                                clone\n                                            else\n                                                if <touching color (#00cc44)?> then\n                                                    switch costume to (mushroom v)\n                                                    clone\n                                                else\n                                                    if <touching color (#009933)?> then\n                                                        switch costume to (tree v)\n                                                        clone\n                                                    else\n                                                        if <touching color (#7f7f7f)?> then\n                                                            switch costume to (shiny metal v)\n                                                            clone\n                                                        else\n                                                            if <touching color (#666666)?> then\n                                                                switch costume to (dull metal v)\n                                                                clone\n                                                            else\n                                                                if <touching color (#8c8c8c)?> then\n                                                                    switch costume to (pipe v)\n                                                                    clone\n                                                                else\n                                                                    delete this clone\n                                                                end\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        else\n            delete this clone\n        end\n        switch costume to (sky v)\n        set size to (100) %\n        change x by (20)\n    end\n    change x by (-470)\n    change y by (20)\nend\nhide\nbroadcast (hide note v)\n\nwhen I receive [tile generate v]\nshow\nwait (0.1) seconds\ntile generate\n\nbroadcast (level next v)\n\nbroadcast (delete clones v)\n\nwhen I receive [delete clones v]\ndelete this clone\n\n@lvl\n\nwhen I receive [>start game v]\nset [level v] to [1]\ngo to x: (0) y: (-100)\nswitch costume to (tiny v)\nset size to (2000) %\nswitch costume to (costume1 v)\nforever\n    switch costume to ((Level) + (1))\n    if <<(Level) = [18]> or <<(Level) = [19]> or <(Level) = [20]>>> then\n        set [stickyness v] to [0.95]\n    else\n        set [stickyness v] to [0.9]\n    end\nend\n\nwhen I receive [>start game v]\ndelete (all) of [levelsize 1-18 v]\nadd [5] to [levelsize 1-18 v]\nadd [5] to [levelsize 1-18 v]\nadd [7] to [levelsize 1-18 v]\nadd [12] to [levelsize 1-18 v]\nadd [8] to [levelsize 1-18 v]\nadd [14] to [levelsize 1-18 v]\nadd [9] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [14] to [levelsize 1-18 v]\nadd [9] to [levelsize 1-18 v]\nadd [5] to [levelsize 1-18 v]\nadd [13] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\nadd [16] to [levelsize 1-18 v]\n\nbroadcast (level next v)\n\nwhen I receive [tile generate v]\nset [ghost v] effect to (0)\n\nwhen I receive [hide note v]\nset [ghost v] effect to (100)\n\ngo to [front v] layer\n\nswitch costume to (tiny v)\nset size to (2000) %\nswitch costume to (costume1 v)\n\nset [ghost v] effect to (0)\n\ngo to x: (0) y: (-100)\n\nchange x by (10)\n\nchange y by (1)\n\n@generate\n\nwhen I receive [level next v]\nswitch costume to (costume1 v)\n\nwhen I receive [hide note v]\nswitch costume to (costume2 v)\n\nwhen I receive [>start game v]\nswitch costume to (costume1 v)\ngo to [front v] layer\ngo to x: (100) y: (167)\nset size to (400) %\n\n@Counter 1\n\nwhen I receive [add1 v]\nnext costume\nif <(costume [number v]) = [11]> then\n    broadcast (add10 v)\n    switch costume to (costume0 v)\nend\n\nwhen [space v] key pressed\nif <(toggle- counter) = [count]> then\n    set [toggle- counter v] to [var.]\nelse\n    set [toggle- counter v] to [count]\nend\n\nwhen I receive [level next v]\nbroadcast (add1 v)\n\nwhen I receive [>start game v]\nswitch costume to (costume1 v)\nset size to (300) %\ngo to x: (-50) y: (165)\nset [number- counter v] to [0]\nset [toggle- counter v] to [count]\nforever\n    if <(toggle- counter) = [var.]> then\n        switch costume to ((1) + (letter (length of (number- counter)) of (number- counter)))\n    end\nend\n\n@Counter 2\n\nwhen I receive [add10 v]\nnext costume\nif <(costume [number v]) = [11]> then\n    broadcast (add100 v)\n    switch costume to (costume0 v)\nend\n\nwhen I receive [>start game v]\nswitch costume to (costume0 v)\nset size to (300) %\ngo to (counter 1 v)\nchange x by (-20)\nforever\n    if <(toggle- counter) = [var.]> then\n        switch costume to ((1) + (letter ((length of (number- counter)) - (1)) of (number- counter)))\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nreset timer\nhide\n\nhide variable [fails v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n@awesome-llama Game start\n\nwhen flag clicked\nhide variable [fails v]\nhide variable [level v]\nshow\nswitch costume to (start v)\ngo to x: (0) y: (0)\nwait (0.002) seconds\ngo to [front v] layer\nrepeat (18)\n    next costume\n    wait (0.03) seconds\nend\nwait (0.6) seconds\nrepeat (10)\n    change [ghost v] effect by (25)\nend\nhide\nbroadcast (Finish startup v)\nstop [other scripts in sprite v]\n\n@player\n\nwhen I receive [finish startup v]\ngo to x: (-208) y: (-80)\nshow\nbroadcast (>START GAME v)\nset [stickyness v] to [0.9]\nset [fails v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    if <[2] = ([costume # v] of [generate v])> then\n        if <key (right arrow v) pressed?> then\n            change [xv v] by ((1) + (0))\n            point in direction (90)\n        end\n        if <key (left arrow v) pressed?> then\n            change [xv v] by ((-1) - (0))\n            point in direction (-90)\n        end\n    end\n    set [xv v] to ((Xv) * (Stickyness))\n    change x by (Xv)\n    if <touching color (#ff00bf)?> then\n        broadcast (level next v)\n    end\n    if <<(y position) < [-165]> or <touching color (#ff9400)?>> then\n        if <(Level) = [18]> then\n            go to x: (-104) y: (15)\n        else\n            go to x: (-208) y: (-80)\n        end\n        change [fails v] by (1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <touching (lvl v)?> then\n        change y by (1)\n        if <touching (lvl v)?> then\n            change y by (1)\n            if <touching (lvl v)?> then\n                change y by (1)\n                if <touching (lvl v)?> then\n                    change y by (1)\n                    if <touching (lvl v)?> then\n                        change y by (1)\n                        if <touching (lvl v)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> and <[2] = ([costume # v] of [generate v])>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                if <(Level) = [19]> then\n                                    set [yv v] to [10]\n                                else\n                                    set [yv v] to [15]\n                                end\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching (lvl v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (lvl v)?> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [12]\n        end\n    end\n    change y by (1)\nend\n\nwhen I receive [level next v]\nbroadcast (tile generate v)\nif <(Level) = [18]> then\n    go to x: (-104) y: (15)\nelse\n    go to x: (-208) y: (-80)\nend\nchange [level v] by (1)\nset [xv v] to [0]\nset [yv v] to [0]\n\n