Platformer Template


@Stage\n\nwhen flag clicked\nswitch backdrop to (join [1] [])\n\nwhen I receive [next v]\nnext backdrop\n\n@Scratch Cat\n\nwhen flag clicked\nbroadcast (message1 v)\nforever\n    if <(y position) > [175]> then\n        set [y v] to [0]\n        change y by (-5)\n    end\nend\n\nwhen I receive [message1 v]\ngo to x: (-200) y: (150)\nset rotation style [left-right v]\nshow\nset [y v] to [0]\nset [x v] to [0]\nset [crouch v] to [0]\nset [costume v] to [13]\nforever\n    if <key (down arrow v) pressed?> then\n        set size to (25) %\n        set [crouch v] to [1]\n    else\n        set size to (50) %\n        if <(crouch) = [1]> then\n            change y by (12)\n        end\n        change y by (2)\n        if <<touching color (#000000)?> and <(crouch) = [1]>> then\n            set size to (25) %\n            change y by (-12)\n        else\n            set [crouch v] to [0]\n        end\n        change y by (-2)\n    end\n    change [y v] by (-0.5)\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        change [x v] by (0.7)\n        if <(costume [number v]) < [16]> then\n            next costume\n        else\n            switch costume to (1 v)\n        end\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        change [x v] by (-0.7)\n        if <(costume [number v]) < [16]> then\n            next costume\n        else\n            switch costume to (1 v)\n        end\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    set [costume v] to (costume [number v])\n    switch costume to (hitbox v)\n    if <touching color (#000008)?> then\n        change y by (1)\n        if <touching color (#000008)?> then\n            change y by (1)\n            if <touching color (#000008)?> then\n                change y by (1)\n                if <touching color (#000008)?> then\n                    change y by (1)\n                    if <touching color (#000008)?> then\n                        change y by (1)\n                        if <touching color (#000008)?> then\n                            change x by ((x) * (-1))\n                            change x by (-1)\n                            change y by (-4)\n                            change x by (1)\n                            if <key (up arrow v) pressed?> then\n                                if <(x) > [0]> then\n                                    set [x v] to [-8]\n                                else\n                                    set [x v] to [8]\n                                end\n                                set [y v] to [10]\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching color (#000008)?> then\n        set [y2 v] to (y position)\n        set [y3 v] to ((y) * (-1))\n        change y by (y3)\n        set [y v] to [0]\n        if <(y3) > [10]> then\n            set y to ((y2) + (12))\n        end\n    end\n    change y by (-1)\n    if <touching color (#000008)?> then\n        if <key (up arrow v) pressed?> then\n            set [y v] to (pick random (8.5) to (10.5))\n        end\n    end\n    if <(x position) > [237]> then\n        broadcast (message1 v)\n        broadcast (next v)\n    end\n    if <(y position) < [-170]> then\n        broadcast (message1 v)\n        start sound [hurt v]\n    end\n    if <touching color (#ff0000)?> then\n        broadcast (message1 v)\n        start sound [hurt v]\n    end\n    if <touching color (#003fff)?> then\n        set [y v] to [15]\n        stop all sounds\n        start sound [jump v]\n    end\n    switch costume to (costume)\nend\n\nwhen flag clicked\nforever\n    if <(y) > [0.5]> then\n        repeat until <not <(y) > [0.5]>>\n            switch costume to (19 v)\n        end\n        repeat (10)\n            switch costume to (19 v)\n        end\n        switch costume to (13 v)\n        set [costume v] to [13]\n        switch costume to (13 v)\n    end\n    if <(y) < [-1.5]> then\n        repeat until <not <(y) < [-0.5]>>\n            switch costume to (20 v)\n        end\n        wait (0.4) seconds\n        switch costume to (13 v)\n        set [costume v] to [13]\n        switch costume to (13 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(y) > [2]> then\n        if <key (up arrow v) pressed?> then\n            stop all sounds\n            play sound [jump v] until done\n        end\n        wait until <(y) < [2]>\n    end\nend\n\n@Timer\n\nwhen flag clicked\nshow\nset size to (50) %\nforever\n    go to x: (-230) y: (167)\n    set [i v] to [1]\n    set [time v] to (round (timer))\n    broadcast (resetTimer v)\n    repeat ((length of (time)) - (1))\n        switch costume to (letter (i) of (time))\n        change [i v] by (1)\n        create clone of (_myself_ v)\n        change x by (15)\n    end\n    switch costume to (letter (i) of (time))\n    wait until <not <(round (timer)) = (time)>>\nend\n\nwhen I receive [resettimer v]\ndelete this clone\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\n