Platformer Engine #Games

Instructions: New Game Out! :) https://scratch.mit.edu/projects/456360446/\n\nThis is an engine and it is not a full game! :)\n\nThere are 2 levels\n\nYou can link your platformer you made with this engine in the comments and I will check it out! :)

@Stage\n\n@Cube\n\nwhen flag clicked\nplay sound [Vexento - Pixel Party v] until done\n\nwhen flag clicked\nset [level v] to [1]\nbroadcast (NEXT LEVEL v)\nforever\n    if <key (left arrow v) pressed?> then\n        change [x vel v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x vel v] by (1)\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x vel) * (-1))\n        if <key (up arrow v) pressed?> then\n            if <(x vel) > [0]> then\n                set [x vel v] to [-10]\n            else\n                set [x vel v] to [10]\n            end\n            set [y vel v] to [15]\n        else\n            set [x vel v] to [0]\n        end\n    end\n    change [y vel v] by (-1)\n    change y by (y vel)\n    if <touching (level v)?> then\n        change y by ((y vel) - ((y vel) * (2)))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    if <<touching (level v)?> and <key (up arrow v) pressed?>> then\n        set [y vel v] to [15]\n    end\n    change y by (1)\n    create clone of (_myself_ v)\n    if <(x position) > [250]> then\n        change [level v] by (1)\n        broadcast (NEXT LEVEL v) and wait\n    end\n    if <touching (spikes v)?> then\n        broadcast (restart v)\n    end\n    if <touching (bounce v)?> then\n        set [y vel v] to [19]\n    end\n    if <touching (enemy v)?> then\n        set [y vel v] to [15]\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [next level v]\nbroadcast (restart v)\n\nwhen I receive [restart v]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-226) y: (-4)\n\nwhen flag clicked\ngo to x: (-224) y: (-3)\n\nwhen flag clicked\nforever\n    if <touching (lava v)?> then\n        broadcast (restart v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [9]> then\n        broadcast (The End So  Ya v)\n    end\nend\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Bounce\n\ndefine Clone at (x pos) (y pos)\ngo to x: (x pos) y: (y pos)\ncreate clone of (_myself_ v)\n\nwhen I receive [next level v]\nif  then\n    delete this clone\nend\nif <(Level) = [2]> then\n    Clone at [-11] [-71]\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    if <touching (cube v)?> then\n        switch costume to (costume2 v)\n        wait (00.1) seconds\n    else\n        switch costume to (costume1 v)\n        wait (00.1) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Enemy\n\nwhen flag clicked\ngo to x: (-224) y: (-3)\n\ndefine Clone at (x pos) (y pos)\ngo to x: (x pos) y: (y pos)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nforever\n    if <([x position v] of [cube v]) < (x position)> then\n        change [x vel v] by (-0.5)\n    end\n    if <(x position) < ([x position v] of [cube v])> then\n        change [x vel v] by (0.5)\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x vel) * (-1))\n        if <(([y position v] of [cube v]) - (50)) > (y position)> then\n            if <(x vel) > [0]> then\n                set [x vel v] to [-10]\n            else\n                set [x vel v] to [10]\n            end\n            set [y vel v] to [15]\n        else\n            set [x vel v] to [0]\n        end\n    end\n    change [y vel v] by (-1)\n    change y by (y vel)\n    if <touching (level v)?> then\n        change y by ((y vel) - ((y vel) * (2)))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    change y by (1)\n    if <touching (spikes v)?> then\n        delete this clone\n    end\n    if <touching (bounce v)?> then\n        set [y vel v] to [19]\n    end\n    if <touching (cube v)?> then\n        change y by (-1)\n        if <<touching (level v)?> and <(([y position v] of [cube v]) - (5)) > (y position)>> then\n            delete this clone\n        else\n            broadcast (restart v)\n        end\n        change y by (1)\n    end\nend\n\nwhen I receive [restart v]\nif  then\n    delete this clone\nend\nif <(Level) = [1]> then\n    Clone at [166] [-94]\nend\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen I receive [restart v]\nif  then\n    delete this clone\nend\nif <(Level) = [5]> then\n    Clone at [166] [-94]\nend\n\n@Lava\n\nwhen flag clicked\nforever\n    set [tide v] to [0]\n    repeat (10)\n        change [tide v] by (1)\n    end\n    repeat (20)\n        change [tide v] by (-1)\n    end\n    repeat (10)\n        change [tide v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    set y to (Tide)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [4]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [2]> then\n        show\n        go to [back v] layer\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [6]> then\n        show\n        go to [back v] layer\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nbroadcast (Message v)\nshow\ngo to [front v] layer\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@Joining\n\nwhen flag clicked\nhide\n\nwhen I receive [connecting v]\nswitch costume to (joining v)\nshow\n\nwhen flag clicked\nswitch costume to (connected v)\nshow\ngo to [back v] layer\n\n@Sprite1\n\nwhen flag clicked\nset [costume v] to [0]\nhide\nforever\n    if <not <<(LOVED__) = [1]> and <(FAVED___) = [1]>>> then\n        wait (pick random (30) to (40)) seconds\n        switch costume to (costume1 v)\n        go to x: (0) y: (50)\n        show\n        go to [front v] layer\n        start sound [pop v]\n        repeat (9)\n            change y by (-6)\n        end\n        repeat (5)\n            change y by (3)\n        end\n        repeat (5)\n            change y by (-1)\n        end\n        wait (2) seconds\n        repeat (15)\n            change y by (7)\n        end\n        hide\n    end\n    if <(Costume) > [0]> then\n        hide\n        stop [this script v]\n    end\nend\n\n@You Win\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen flag clicked\nforever\n    if <(Level) = [3]> then\n        show\n        go to [front v] layer\n        switch costume to (splash-screen v)\n    end\nend\n\nwhen flag clicked\nset [level v] to [1]\n\n@Thumbnail\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\n