Electronic  (A Platformer Series)

Instructions: This was my entry in platfomer contest! 1st Place\n\nNo spam or advertising\nIf you want to advertise then go here:\nhttps://scratch.mit.edu/studios/27062219/projects/\n-------------------------------------------------------------------------\nGoal of the game:You have to meet your friend,Electric\nThere are 8 Easy Levels and 8 Hard Levels\nAll of them are 100% possible\n---------------------------- Instructions ----------------------------\nFull screen recommended\nSpam the green flag 2 times\nPress play button and choose a difficulty\nArrow keys or use your finger to move\nDon't touch Red\nYellow and Orange are bouncy\nPress S to skip a level\nPress R to restart a level\n\nNote: Once you meet your friend electric,you can control him with wasd keys\n------------------------------- Credits -------------------------------\nAll art done by me\nCoding: @CopperStar15, @250119code2 and Me                    \nMusic Composed by @KIKOKO_

@Stage\n\nwhen flag clicked\nforever\n    if <not <(Music volume) = [0]>> then\n        play sound [Menu Music v] until done\n    end\nend\n\nwhen [s v] key pressed\nbroadcast (show v)\nnext backdrop\n\nwhen flag clicked\nset [music volume v] to [100]\nswitch backdrop to (plain v)\n\n@Electronic\n\nwhen flag clicked\nhide\nset [state v] to [Gameplay]\n\nwhen I receive [message1 v]\nif <(Mode) = [easy]> then\n    set size to (50) %\n    switch backdrop to (easy 1 v)\n    switch costume to (angry hard 1 v)\nelse\n    set size to (25) %\n    switch backdrop to (hard 1 \(confirmed\) v)\n    switch costume to (angry hard 1 v)\nend\ngo to x: (-218) y: (-103)\nset rotation style [left-right v]\nset [x vel. v] to [0]\nset [y vel. v] to [0]\nshow\nforever\n    if <not <(State) = [CutScene]>> then\n        if <(Mode) = [easy]> then\n            if <(y position) = [-180]> then\n                go to x: (Spawn X) y: (Spawn Y)\n                set [x vel. v] to [0]\n                set [y vel. v] to [0]\n            end\n        else\n            if <(y position) = [-179]> then\n                go to x: (Spawn X) y: (Spawn Y)\n                set [x vel. v] to [0]\n                set [y vel. v] to [0]\n            end\n        end\n        if <(x position) > [234]> then\n            broadcast (show v)\n            switch backdrop to (next backdrop v)\n            go to x: (Spawn X) y: (Spawn Y)\n            set [x v] to [0]\n            set [y v] to [0]\n        end\n        if <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> then\n            change [x vel. v] by (x vel control)\n            point in direction (90)\n        end\n        if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n            change [x vel. v] by ((x vel control) * (-1))\n            point in direction (-90)\n        end\n        set [x vel. v] to ((x vel.) * (.9))\n        change x by (x vel.)\n        if <touching color (#3af9ff)?> then\n            change y by (1)\n            if <touching color (#3af9ff)?> then\n                change y by (1)\n                if <touching color (#3af9ff)?> then\n                    change y by (1)\n                    if <touching color (#3af9ff)?> then\n                        change y by (1)\n                        if <touching color (#3af9ff)?> then\n                            change y by (1)\n                            if <touching color (#3af9ff)?> then\n                                change y by (-5)\n                                change x by ((x vel.) * (-1))\n                                if <<key (up arrow v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>> then\n                                    set [y vel. v] to [10]\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                                else\n                                    set [x vel. v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y vel. v] by (-.5)\n        change y by (y vel.)\n        if <touching color (#3af9ff)?> then\n            change y by ((y vel.) * (-1))\n            set [y vel. v] to [0]\n        end\n        change y by (-1)\n        if <<touching color (#3af9ff)?> and <<key (up arrow v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>>> then\n            set [y vel. v] to [10]\n        end\n        change y by (1)\n        if <touching color (#ff0000)?> then\n            broadcast (message2 v)\n        end\n        if <touching color (#ffbb00)?> then\n            if <(Mode) = [easy]> then\n                set [y vel. v] to [16]\n            else\n                set [y vel. v] to [18]\n            end\n        else\n            if <touching color (#ffdc00)?> then\n                set [y vel. v] to [-15.5]\n            else\n                if <touching color (#ff7b00)?> then\n                    set [x vel. v] to [16]\n                    set [y vel. v] to [3]\n                else\n                    if <touching color (#f37500)?> then\n                        set [x vel. v] to [-16]\n                        set [y vel. v] to [3]\n                    else\n                        if <touching color (#ff820c)?> then\n                            set [x vel. v] to [9]\n                            set [y vel. v] to [3]\n                        else\n                            if <touching color (#f37c0c)?> then\n                                set [x vel. v] to [-9]\n                                set [y vel. v] to [9]\n                            else\n                                if <touching color (#f18118)?> then\n                                    set [x vel. v] to [9]\n                                    set [y vel. v] to [9]\n                                else\n                                    if <touching color (#e67b17)?> then\n                                        set [x vel. v] to [-9]\n                                        set [y vel. v] to [-9]\n                                    else\n                                        if <touching color (#ef790b)?> then\n                                            set [x vel. v] to [9]\n                                            set [y vel. v] to [-9]\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n\n    set [x vel. v] to [16]\n    set [y vel. v] to [3]\nend\n\nbroadcast (message2 v)\n\nwhen [s v] key pressed\nif <(Mode) = [easy]> then\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nelse\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nend\n\nwhen [r v] key pressed\nif <(Mode) = [easy]> then\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nelse\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nend\n\nwhen I receive [message2 v]\nif <(Mode) = [easy]> then\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nelse\n    go to x: (Spawn X) y: (Spawn Y)\n    set [x v] to [0]\n    set [y v] to [0]\nend\n\nwhen [timer v] > (0.01)\nhide\n\nwhen I receive [message1 v]\nforever\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\n\nwhen I start as a clone\nif <(Mode) = [easy]> then\n    set size to (50) %\n    switch costume to (effect v)\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (-2)\n    end\n    delete this clone\nelse\n    set size to (25) %\n    switch costume to (effect v)\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (-1)\n    end\n    delete this clone\nend\n\nwhen [g v] key pressed\n\nset [x vel control v] to [1]\n\nwhen [l v] key pressed\n\nset [x vel control v] to [2]\n\nwhen flag clicked\nforever\n    if <(Mode) = [easy]> then\n        if <(backdrop [number v]) = [2]> then\n            set [spawn x v] to [-218]\n            set [spawn y v] to [-103]\n        else\n            if <(backdrop [number v]) = [3]> then\n                set [spawn x v] to [-218]\n                set [spawn y v] to [-103]\n            else\n                if <(backdrop [number v]) = [4]> then\n                    set [spawn x v] to [-218]\n                    set [spawn y v] to [-103]\n                else\n                    if <(backdrop [number v]) = [5]> then\n                        set [spawn x v] to [-218]\n                        set [spawn y v] to [-103]\n                    else\n                        if <(backdrop [number v]) = [6]> then\n                            set [spawn x v] to [-218]\n                            set [spawn y v] to [-103]\n                        else\n                            if <(backdrop [number v]) = [7]> then\n                                set [spawn x v] to [-218]\n                                set [spawn y v] to [-103]\n                            else\n                                if <(backdrop [number v]) = [8]> then\n                                    set [spawn x v] to [-218]\n                                    set [spawn y v] to [-103]\n                                else\n                                    if <(backdrop [number v]) = [9]> then\n                                        set [spawn x v] to [-218]\n                                        set [spawn y v] to [-103]\n                                    else\n                                        if <(backdrop [number v]) = [10]> then\n                                            set [spawn x v] to [-218]\n                                            set [spawn y v] to [-103]\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    else\n        if <(backdrop [number v]) = [11]> then\n            set [spawn x v] to [-218]\n            set [spawn y v] to [-115]\n        else\n            if <(backdrop [number v]) = [12]> then\n                set [spawn x v] to [-218]\n                set [spawn y v] to [-115]\n            else\n                if <(backdrop [number v]) = [13]> then\n                    set [spawn x v] to [-218]\n                    set [spawn y v] to [-115]\n                else\n                    if <(backdrop [number v]) = [14]> then\n                        set [spawn x v] to [-200]\n                        set [spawn y v] to [-130]\n                    else\n                        if <(backdrop [number v]) = [15]> then\n                            set [spawn x v] to [-215]\n                            set [spawn y v] to [135]\n                        else\n                            if <(backdrop [number v]) = [16]> then\n                                set [spawn x v] to [-195]\n                                set [spawn y v] to [-130]\n                            else\n                                if <(backdrop [number v]) = [17]> then\n                                    set [spawn x v] to [49]\n                                    set [spawn y v] to [-133]\n                                else\n                                    if <(backdrop [number v]) = [18]> then\n                                        set [spawn x v] to [-207]\n                                        set [spawn y v] to [-90]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nif <(Mode) = [hard]> then\n\nwhen flag clicked\nforever\n    wait (pick random (2) to (5)) seconds\n    eye blink \nend\n\ndefine eye blink \nswitch costume to (angry hard 1 v)\nrepeat (19)\n    next costume\nend\nrepeat (19)\n    previous costume\nend\n\ndefine previous costume\nswitch costume to ((costume [number v]) - (1))\n\n@Electric\n\nwhen [timer v] > (0.01)\n\nhide\n\nwhen flag clicked\nhide\nforever\n    if <<(backdrop [number v]) = [10]> or <(backdrop [number v]) = [19]>> then\n        repeat until <<(backdrop [number v]) = [10]> or <(backdrop [number v]) = [19]>>\n            show\n        end\n    else\n        hide\n    end\nend\n\nwhen backdrop switches to [love, fav and follow v]\nset size to (50) %\ngo to x: (170) y: (-20)\nset rotation style [left-right v]\nset [x vel. v] to [0]\nset [y vel. v] to [0]\nshow\nforever\n    if <key (d v) pressed?> then\n        change [x vel. v] by (1)\n        point in direction (-90)\n    end\n    if <key (a v) pressed?> then\n        change [x vel. v] by (-1)\n        point in direction (90)\n    end\n    set [x vel. v] to ((x vel.) * (.9))\n    change x by (x vel.)\n    if <touching color (#3af9ff)?> then\n        change y by (1)\n        if <touching color (#3af9ff)?> then\n            change y by (1)\n            if <touching color (#3af9ff)?> then\n                change y by (1)\n                if <touching color (#3af9ff)?> then\n                    change y by (1)\n                    if <touching color (#3af9ff)?> then\n                        change y by (1)\n                        if <touching color (#3af9ff)?> then\n                            change y by (-5)\n                            change x by ((x vel.) * (-1))\n                            if <key (w v) pressed?> then\n                                set [y vel. v] to [10]\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                            else\n                                set [x vel. v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y vel. v] by (-.5)\n    change y by (y vel.)\n    if <touching color (#3af9ff)?> then\n        change y by ((y vel.) * (-1))\n        set [y vel. v] to [0]\n    end\n    change y by (-1)\n    if <<touching color (#3af9ff)?> and <key (w v) pressed?>> then\n        set [y vel. v] to [10]\n    end\n    change y by (1)\nend\n\nwhen backdrop switches to [love, fav and follow v]\nforever\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\n\nwhen backdrop switches to [love, fav and follow 2 v]\nset size to (25) %\ngo to x: (170) y: (-20)\nset rotation style [left-right v]\nset [x vel. v] to [0]\nset [y vel. v] to [0]\nshow\nforever\n    if <key (d v) pressed?> then\n        change [x vel. v] by (1)\n        point in direction (-90)\n    end\n    if <key (a v) pressed?> then\n        change [x vel. v] by (-1)\n        point in direction (90)\n    end\n    set [x vel. v] to ((x vel.) * (.9))\n    change x by (x vel.)\n    if <touching color (#3af9ff)?> then\n        change y by (1)\n        if <touching color (#3af9ff)?> then\n            change y by (1)\n            if <touching color (#3af9ff)?> then\n                change y by (1)\n                if <touching color (#3af9ff)?> then\n                    change y by (1)\n                    if <touching color (#3af9ff)?> then\n                        change y by (1)\n                        if <touching color (#3af9ff)?> then\n                            change y by (-5)\n                            change x by ((x vel.) * (-1))\n                            if <key (w v) pressed?> then\n                                set [y vel. v] to [10]\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                            else\n                                set [x vel. v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y vel. v] by (-.5)\n    change y by (y vel.)\n    if <touching color (#3af9ff)?> then\n        change y by ((y vel.) * (-1))\n        set [y vel. v] to [0]\n    end\n    change y by (-1)\n    if <<touching color (#3af9ff)?> and <key (w v) pressed?>> then\n        set [y vel. v] to [10]\n    end\n    change y by (1)\nend\n\nwhen backdrop switches to [love, fav and follow 2 v]\nforever\n    create clone of (_myself_ v)\n    wait (0.001) seconds\nend\n\nshow\n\nwhen I start as a clone\nif <(Mode) = [easy]> then\n    set size to (50) %\n    switch costume to (2 v)\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (-2)\n    end\n    delete this clone\nelse\n    set size to (25) %\n    switch costume to (2 v)\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (-1)\n    end\n    delete this clone\nend\n\n@TB\n\nwhen flag clicked\nshow\nforever\n    set [ghost v] effect to (100)\nend\n\nwhen flag clicked\nshow\nforever\n    go [forward v] (1) layers\nend\n\n@Next Level\n\nwhen flag clicked\nswitch costume to (0 v)\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\nwhen I receive [show v]\nshow\nnext costume\ngo to [front v] layer\nclear graphic effects\nwait (1) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\n    broadcast (message2 v)\nend\nbroadcast (message2 v)\nhide\ngo to [back v] layer\n\nwhen [timer v] > (0.01)\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [cut scene 1 show v]\nclear graphic effects\ngo to [front v] layer\nswitch costume to (10 v)\nshow\nwait (3) seconds\nhide\nbroadcast (Hide v)\n\nwhen [h v] key pressed\nbroadcast (Hide v)\n\n@Animated TB\n\nwhen flag clicked\nswitch costume to (normal v)\ngo to x: (0) y: (0)\nshow\n\nwhen I receive [message1 v]\nstop [other scripts in sprite v]\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\nwhen flag clicked\nforever\n    wait (pick random (2) to (5)) seconds\n    eye blink \nend\n\ndefine eye blink \nswitch costume to (normal v)\nrepeat (21)\n    next costume\nend\nrepeat (21)\n    previous costume\nend\n\ndefine previous costume\nswitch costume to ((costume [number v]) - (1))\n\n@Electronic Text\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (play4 v)\nset size to (105) %\ngo to x: (0) y: (0)\nshow\n\nwhen backdrop switches to [easy 1 v]\nhide\n\nwhen flag clicked\nrepeat until <<(backdrop [number v]) = [2]> or <(backdrop [number v]) = [11]>>\n    set y to (([sin v] of ((timer) * (300)) ) * (5))\nend\n\nwhen backdrop switches to [hard 1 \(confirmed\) v]\nhide\n\n@Play Game Button4\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (play3 v)\nset size to (110) %\ngo to x: (110) y: (0)\nshow\n\nwhen backdrop switches to [easy 1 v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((125) - (size)) / (5))\n    else\n        change size by (((110) - (size)) / (5))\n    end\nend\n\nwhen this sprite clicked\nbroadcast (message3 v)\nhide\n\n@Play Game Button2\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (easy2 v)\nset size to (105) %\ngo to x: (110) y: (40)\nhide\n\nwhen backdrop switches to [easy 1 v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((115) - (size)) / (5))\n    else\n        change size by (((105) - (size)) / (5))\n    end\nend\n\nwhen this sprite clicked\nbroadcast (show v)\nbroadcast (message1 v)\nset [mode v] to [easy]\nset [state v] to [Gameplay]\n\nwhen I receive [message3 v]\ngo to x: (110) y: (40)\nshow\n\nwhen backdrop switches to [hard 1 \(confirmed\) v]\nhide\n\n@Play Game Button3\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (hard3 v)\nset size to (105) %\ngo to x: (110) y: (-40)\nhide\n\nwhen backdrop switches to [hard 1 \(confirmed\) v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((115) - (size)) / (5))\n    else\n        change size by (((105) - (size)) / (5))\n    end\nend\n\nwhen this sprite clicked\nbroadcast (show v)\nbroadcast (message1 v)\nset [mode v] to [hard]\nset [state v] to [Gameplay]\n\nwhen I receive [message3 v]\ngo to x: (110) y: (-40)\nshow\n\nwhen backdrop switches to [easy 1 v]\nhide\n\n