Simple (One Script Platformer)


@Stage\n\n@Square\n\nwhen flag clicked\nstart sound [Starship Mario v]\nswitch costume to (square v)\nswitch backdrop to (level 1 v)\ngo to x: (0) y: (-71)\nset rotation style [left-right v]\nshow\nset [blocky xv v] to [0]\nset [blocky yv v] to [0]\nforever\n    if <key (right arrow v) pressed?> then\n        change [blocky xv v] by (1.2)\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        change [blocky xv v] by (-1.2)\n        point in direction (-90)\n    end\n    change x by (blocky xv)\n    set [blocky xv v] to ((blocky xv) * (0.8))\n    if <touching color (#00cc44)?> then\n        change y by (1)\n        if <touching color (#00cc44)?> then\n            change y by (1)\n            if <touching color (#00cc44)?> then\n                change y by (1)\n                if <touching color (#00cc44)?> then\n                    change y by (1)\n                    if <touching color (#00cc44)?> then\n                        change x by ((blocky xv) * (-1))\n                        change y by (-4)\n                        set [blocky xv v] to (((direction) / (90)) * (-1))\n                        if <key (up arrow v) pressed?> then\n                            set [blocky yv v] to [12]\n                            set [blocky xv v] to (((direction) / (90)) * (-4))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <(x position) > [239]> then\n        if <<not <(backdrop [name v]) = [Level 4]>> and <not <(backdrop [name v]) = [Level 25]>>> then\n            switch backdrop to (next backdrop v)\n            go to x: (-180) y: (-71)\n            set [blocky xv v] to [0]\n            set [blocky yv v] to [0]\n        end\n    end\n    if <<touching color (#ff0000)?> or <touching color (#ff9400)?>> then\n        if <not <(backdrop [name v]) = [Level 5]>> then\n            go to x: (-180) y: (-71)\n            set [blocky xv v] to [0]\n            set [blocky yv v] to [0]\n        end\n    end\n    if <(x position) > [239]> then\n        if <(backdrop [name v]) = [Level 4]> then\n            switch backdrop to (next backdrop v)\n            go to x: (-180) y: (106)\n        end\n    end\n    if <<touching color (#ff0000)?> or <touching color (#ff9400)?>> then\n        if <(backdrop [name v]) = [Level 5]> then\n            go to x: (-180) y: (106)\n        end\n    end\n    if <touching color (#009933)?> then\n        switch costume to (square2 v)\n    else\n        switch costume to (square v)\n    end\n    change [blocky yv v] by (-1)\n    change y by (blocky yv)\n    if <touching color (#00cc44)?> then\n        change y by ((blocky yv) * (-1))\n        set [blocky yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#00cc44)?> then\n        if <key (up arrow v) pressed?> then\n            set [blocky yv v] to [12]\n        end\n    end\n    change y by (1)\n    if <key (r v) pressed?> then\n        if <not <(backdrop [name v]) = [Level 5]>> then\n            go to x: (-180) y: (-71)\n        end\n    end\n    if <key (r v) pressed?> then\n        if <(backdrop [name v]) = [Level 5]> then\n            go to x: (-180) y: (106)\n        end\n    end\n    if <touching color (#0033cc)?> then\n        set [blocky yv v] to [13.5]\n    end\n    if <(x position) > [239]> then\n        if <(backdrop [name v]) = [Level 25]> then\n            go to x: (-180) y: (-71)\n        end\n    end\nend\n\n