Platformer Template remix

Instructions: Laptop/PC: Jump with the W key or up arrow key, move left or right with the A and D keys or the left and right arrow keys.\n\nMobile: Guide the player with your finger. Tap a spot above the player to jump.

@Stage\n\nwhen flag clicked\nswitch backdrop to (intro screen v)\nhide variable [deaths v]\nhide variable [level v]\nhide variable [time v]\nhide variable [☁ world record time v]\nhide variable [total deaths v]\nhide variable [total time v]\nset [deaths v] to [0]\n\nwhen I receive [start game v]\nswitch backdrop to (level1 v)\nshow variable [deaths v]\nshow variable [level v]\nshow variable [time v]\nforever\n    set [level v] to ((backdrop [number v]) - (2))\nend\n\nwhen backdrop switches to [end v]\nhide variable [deaths v]\nhide variable [level v]\nshow variable [☁ world record time v]\nshow variable [total deaths v]\nshow variable [total time v]\nset [total deaths v] to (Deaths)\nset [time v] to (Time)\nif <(Time) < (☁ World Record Time)> then\n    set [☁ world record time v] to (Time)\nend\n\n@close options button\n\nwhen flag clicked\nhide\n\nwhen I receive [options v]\nwait (2.5) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nswitch backdrop to (intro screen v)\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nbroadcast (options hide v)\nrepeat (10)\n    set [ghost v] effect to (10)\nend\nhide\n\n@mousetrail option\n\nwhen flag clicked\nhide\n\nwhen I receive [options v]\nwait (1.67) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <(mousetrail) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nif <(mousetrail) = [1]> then\n    set [mousetrail v] to [0]\nelse\n    set [mousetrail v] to [1]\nend\n\nwhen I receive [options hide v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@music option\n\nwhen flag clicked\nhide\n\nwhen I receive [options v]\nwait (1) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <(music) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nif <(music) = [1]> then\n    set [music v] to [0]\n    broadcast (music off v)\nelse\n    set [music v] to [1]\n    broadcast (music on v)\nend\n\nwhen I receive [options hide v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@sfx option\n\nwhen flag clicked\nhide\n\nwhen I receive [options v]\nwait (1.33) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <(sfx) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nif <(sfx) = [1]> then\n    set [sfx v] to [0]\nelse\n    set [sfx v] to [1]\nend\n\nwhen I receive [options hide v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@optionsbutton\n\nwhen flag clicked\nhide\n\nwhen I receive [begin project v]\nwait (1.67) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nswitch backdrop to (options v)\nbroadcast (options v)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [start game v]\nhide\n\nwhen I receive [options hide v]\nwait (1.67) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\n@playbutton\n\nwhen flag clicked\nhide\n\nwhen I receive [begin project v]\nwait (1) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nwait (.5) seconds\nbroadcast (start game v)\nswitch backdrop to (level1 v)\nhide\n\nwhen I receive [options v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [options hide v]\nwait (1) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\n@controlsbutton\n\nwhen flag clicked\nset [am i clone? v] to [0]\nhide\n\nwhen I receive [begin project v]\nwait (1.33) seconds\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [options v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [start game v]\nhide\n\nwhen this sprite clicked\nif <(sfx) = [1]> then\n    start sound [pop v]\nend\nif <(am i clone?) = [1]> then\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nelse\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (costume2 v)\nset [am i clone? v] to [1]\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\n\nwhen I receive [options hide v]\nwait (1.33) seconds\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (50)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nhide\nforever\n    set [timer v] to (timer)\nend\n\nwhen [timer v] > (timer)\nhide variable [☁ world record time v]\nhide variable [deaths v]\nhide variable [level v]\nhide variable [time v]\nhide variable [total deaths v]\nhide variable [total time v]\nshow\ngo to [front v] layer\n\ngo to x: (0) y: (0)\n\n@intro\n\nwhen flag clicked\nshow\nswitch backdrop to (introscreen v)\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nclear graphic effects\nset [intro_phase_er718 v] to [1]\nset instrument to (21 v)\nset tempo to (120)\ncreate clone of (_myself_ v)\nchange [intro_phase_er718 v] by (1)\nstart sound [explosion v]\nplay note (47) for (4) beats\ncreate clone of (_myself_ v)\nchange [intro_phase_er718 v] by (1)\nstart sound [explosion v]\nplay note (54) for (4) beats\ncreate clone of (_myself_ v)\nchange [intro_phase_er718 v] by (1)\ncreate clone of (_myself_ v)\nstart sound [explosion v]\nplay note (47) for (7) beats\nwait (1.33) seconds\nbroadcast (begin project v)\nhide\n\nwhen I start as a clone\nif <(intro_phase_er718) = [1]> then\n    go to x: (0) y: (180)\n    go to [front v] layer\n    switch costume to (costume2 v)\n    glide (.17) secs to x: (0) y: (100)\n    wait (7.5) seconds\n    hide\n    delete this clone\nelse\n    if <(intro_phase_er718) = [2]> then\n        go to x: (0) y: (180)\n        go to [front v] layer\n        switch costume to (costume3 v)\n        glide (.17) secs to x: (0) y: (5)\n        wait (5.5) seconds\n        hide\n        delete this clone\n    else\n        if <(intro_phase_er718) = [3]> then\n            go to x: (0) y: (180)\n            go to [front v] layer\n            switch costume to (costume4 v)\n            glide (.17) secs to x: (0) y: (-75)\n            wait (2.5) seconds\n            hide\n            delete this clone\n        else\n            go to x: (0) y: (0)\n            go to [front v] layer\n            switch costume to (costume1 v)\n            set [ghost v] effect to (100)\n            wait (2) seconds\n            repeat (20)\n                change [ghost v] effect by (-5)\n            end\n            wait (2) seconds\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            hide\n            delete this clone\n        end\n    end\nend\n\nwait until <[] = [1]>\n\n@mousetrail\n\nwhen flag clicked\nhide\n\nwhen I receive [begin project v]\nclear graphic effects\nforever\n    if <(mousetrail) = [1]> then\n        show\n        go to [front v] layer\n        go to x: ((mouse x) - (10)) y: ((mouse y) - (10))\n        turn right (15) degrees\n        create clone of (_myself_ v)\n    else\n        hide\n    end\nend\n\nwhen I start as a clone\nset size to (pick random (20) to (120)) %\nrepeat (25)\n    turn right (15) degrees\n    change [ghost v] effect by (4)\nend\ndelete this clone\n\n@player\n\nwhen I receive [start game v]\nshow\ngo to x: (-215) y: (-50)\nset rotation style [left-right v]\nhide variable [y v]\nhide variable [x v]\nset [y v] to [0]\nset [x v] to [0]\nshow variable [deaths v]\nshow variable [level v]\nset volume to (80) %\nforever\n    change [y v] by (-1)\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        point in direction (-90)\n        change [x v] by (-1)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        point in direction (90)\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (-4)\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)) > [30]>>> then\n            if <(sfx) = [1]> then\n                start sound [Jump v]\n            end\n            set [y v] to [10]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-5]\n            else\n                set [x v] to [5]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <((mouse y) - (y position)) > [30]>>> and <touching color (#000000)?>> then\n        if <(sfx) = [1]> then\n            start sound [Jump v]\n        end\n        set [y v] to [10]\n    end\n    change y by (1)\n    if <touching color (#ff0000)?> then\n        go to x: (-215) y: (-50)\n        change [deaths v] by (1)\n    end\n    if <(x position) > [214]> then\n        go to x: (-215) y: (-50)\n        next backdrop\n    end\nend\n\nwhen flag clicked\nswitch costume to (player v)\nhide\n\nstart sound [boing v]\n\nset [y v] to [25.5]\n\nwhen backdrop switches to [end v]\nstop [other scripts in sprite v]\nhide\n\n