Platformer Engine || Mobile Friendly || #games #all
@Stage\n\nwhen flag clicked\nswitch backdrop to (sky v)\nforever\n    play sound (pick random (1) to (3)) until done\nend\n\nwhen flag clicked\nset volume to (100) %\nset [muted? v] to [0]\nforever\n    if <key (m v) pressed?> then\n        if <(muted?) = [0]> then\n            set [muted? v] to [1]\n            set volume to (0) %\n        else\n            set [muted? v] to [0]\n            set volume to (100) %\n        end\n        wait until <not <key (m v) pressed?>>\n    end\nend\n\n@Player\n\nwhen flag clicked\nshow\nswitch costume to (front v)\ngo to x: (-200) y: (0)\nset [x v] to [0]\nset [y v] to [0]\nset [level v] to [1]\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (.9)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-.9)\n    end\n    set [x v] to ((x) * (.9))\n    change x by (x)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (-5)\n                            change x by ((x) * (-1))\n                            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>> then\n                                if <(x) > [0]> then\n                                    set [x v] to [-5]\n                                else\n                                    set [x v] to [5]\n                                end\n                                set [y v] to [12]\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 v] by (-1)\n    change y by (y)\n    if <touching (level v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>> then\n            change [y v] by (12)\n        end\n    end\n    change y by (1)\n    if <<(x position) < [-240]> and <(level) = [1]>> then\n        set x to (-240)\n    end\n    if <<touching (spikes v)?> or <touching (saws v)?>> then\n        go to x: (-200) y: (0)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <<<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>> or <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>>> then\n        switch costume to (front v)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        switch costume to (right v)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        switch costume to (left v)\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>> then\n        switch costume to (up v)\n    end\n    if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>> then\n        switch costume to (up right v)\n    end\n    if <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>> then\n        switch costume to (up left v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [240]> then\n        go to x: (-240) y: (y position)\n        change [level v] by (1)\n    end\n    if <<(x position) < [-240]> and <not <(level) = [1]>>> then\n        go to x: (240) y: (y position)\n        change [level v] by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (water v)?> then\n        change [y v] by (-0.3)\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>> then\n            change [y v] by (2)\n        end\n        set [y v] to ((y) * (.9))\n    end\nend\n\n@Level\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (2) layers\nforever\n    switch costume to (level)\nend\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to (level)\nend\n\n@Words\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    switch costume to (level)\nend\n\n@Water\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to (level)\nend\n\n@Saws\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    turn right (saw vel) degrees\n    if <(level) = [4]> then\n        show\n        go to x: (10) y: (-20)\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nset [saw vel v] to [0]\nforever\n    repeat (20)\n        change [saw vel v] by (1)\n    end\n    repeat (40)\n        change [saw vel v] by (-1)\n    end\nend\n\n@Text\n\nwhen flag clicked\nset [text on? v] to [0]\ngo to x: (-160) y: (80)\nshow\nset [ghost v] effect to (100)\nforever\n    set size to (0) %\n    wait until <(text on?) = [1]>\n    repeat (10)\n        set size to ((size) + (((80) - (size)) / (3))) %\n        change [ghost v] effect by (-10)\n    end\n    wait until <(text on?) = [0]>\n    repeat (10)\n        set size to ((size) + (((0) - (size)) / (3))) %\n        change [ghost v] effect by (10)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (space v) pressed?> then\n        if <(text on?) = [0]> then\n            set [text on? v] to [1]\n        else\n            set [text on? v] to [0]\n        end\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\n@Music On/Off\n\nwhen flag clicked\ngo to x: (210) y: (155)\nforever\n    if <(muted?) = [0]> then\n        switch costume to (on v)\n    else\n        switch costume to (off v)\n    end\nend\n\n@TN\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n
Hi guys, this is my platformer engine!! There are spikes, saws and water, all in one neat pack. You are able to move around, jump and wall jump. This is basically all the movement things you need for a good platformer on scratch.\n\n★★★ CONTROLS ★★★\n• Move around - Arrow keys, WASD or mobile\n• Wall jump - Hold the up arrow key and either the left or right arrow key depending on which side the wall is\n• Mute/unmute music - Press the 'm' to mute and unmute the music\n• Show text - Press the space bar to show some text that talks about this engine\n\n★★★ HOW TO USE THIS ENGINE ★★★\nGo into the project code, click file and then press save to your computer. Make a new project, press file, click on load from your computer, choose the file you just downloaded and then change it to become your own game. You could also just remix this if you want, though.