Sonic the Cube (A Platformer)

Instructions: |Sonic the Cube|\n*Instructions*\nUse the arrow keys to move (Or drag if you are on mobile.)\nAvoid obstacles!\nCollect rings!\nLike, Favorite, and Follow! (YES THIS IS PART OF THE INSTRUCTIONS GO LIKE, FAVORITE, AND FOLLOW!)\nThanks!

@Stage\n\nwhen flag clicked\nforever\n    play sound [Green Hill Zone \(LOOP\) - Sonic The Hedgehog2 v] until done\nend\n\n@Player\n\nwhen flag clicked\nset [gravity v] to [-1.5]\nset [jump force v] to [14]\nset [acceleration v] to [2.5]\nset [resistance v] to [0.8]\nbroadcast (Setup v) and wait\nReset and Begin Level\n\ndefine Move - in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        set x to (last value)\n        set [speed x v] to [0]\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        set y to (last value)\n        if <(speed y) < [0]> then\n            set [falling v] to [0]\n        end\n        set [speed y v] to [0]\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (gate v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > [0]>>> then\n    if <(falling) < [3]> then\n        set [speed y v] to (JUMP FORCE)\n    end\nend\nchange [speed y v] by (GRAVITY)\n\ndefine Controls - Left and Right\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    change [speed x v] by ((0) - (ACCELERATION))\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [speed x v] by (ACCELERATION)\n    point in direction (90)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\npoint in direction (90)\nBegin Scene # [1] go to x, y: [-150] [55]\n\nwhen I receive [game loop v]\nset [pixelate v] effect to (0)\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x, y: [235] []\nend\nif <<touching (danger2 v)?> or <touching (danger v)?>> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nset x to (x)\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nFix Collision in Direction [0]\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (150)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (big hitbox v)\nset rotation style [don't rotate v]\n\ndefine Set Costume\nset rotation style [left-right v]\nswitch costume to (player v)\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\nplay sound [Crunch v] until done\nrepeat (10)\n    change [pixelate v] effect by (25)\n    change [ghost v] effect by (10)\nend\nwait (0.5) seconds\ngo to x: (-158) y: (62)\nReset and Begin Level\n\nwhen I receive [gotta go fast v]\nset [acceleration v] to [5.1]\nset [jump force v] to [20]\n\nwhen I receive [no more speed :\( v]\nset [acceleration v] to [2]\nset [jump force v] to [14]\n\nwhen flag clicked\ngo to x: (-158) y: (62)\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\n@Coin\n\nwhen I receive [change scene v]\nif <(SCENE #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (player v)?>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nif <(costume [name v]) = [Coin]> then\n    start sound [Coin v]\n    change [coins v] by (1)\nelse\n    start sound [Magic Spell v]\n    add (costume [name v]) to [collected v]\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\ndelete all of [collected v]\nset [frame v] to [0]\nset [coins v] to [0]\nhide\nPlace [Coin] scene [1] xy [-37] [-22]\nPlace [Coin] scene [1] xy [129] [-21]\nPlace [Coin] scene [2] xy [115] [-26]\nPlace [Coin] scene [2] xy [-11] [-27]\nPlace [Coin] scene [3] xy [34] [45]\nPlace [Coin] scene [4] xy [7] [64]\nPlace [Coin] scene [4] xy [-85] [11]\nPlace [Coin] scene [4] xy [95] [16]\nPlace [Coin] scene [5] xy [-88] [38]\nPlace [Coin] scene [5] xy [171] [-28]\nPlace [Coin] scene [6] xy [-41] [-27]\nPlace [Coin] scene [6] xy [90] [-27]\nPlace [Coin] scene [6] xy [209] [59]\nPlace [Coin] scene [7] xy [143] [-20]\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\nend\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nif <(SCENE #) = [4]> then\n    go to x: (0) y: (3)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [3]> then\n    go to x: (10) y: (1)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [2]> then\n    go to x: (7) y: (1)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [5]> then\n    go to x: (-1) y: (1)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [6]> then\n    go to x: (0) y: (0)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [7]> then\n    go to x: (132) y: (24)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [8]> then\n    go to x: (1) y: (4)\n    forever\n        point in direction (90)\n    end\nend\nif <(SCENE #) = [9]> then\n    go to x: (1) y: (5)\n    forever\n        point in direction (90)\n    end\nend\n\n@Hints\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nif <(SCENE #) = [4]> then\n    go to x: (-5) y: (16)\nend\nif <(SCENE #) = [5]> then\n    go to x: (-5) y: (16)\nend\nif <(SCENE #) = [7]> then\n    go to x: (-5) y: (16)\nend\n\n@TN\n\nwhen flag clicked\nrepeat (10)\n    change [color v] effect by (25)\n    change [pixelate v] effect by (25)\n    change [ghost v] effect by (10)\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [gotta go fast v]\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.001) seconds\nhide\n\n@Speed\n\nwhen flag clicked\nshow\nswitch costume to (speeeeeeeeeed v)\ngo to x: (172) y: (-144)\n\nwhen this sprite clicked\nbroadcast (GOTTA GO FAST v)\nswitch costume to (no more speed :\( v)\nwait (5) seconds\nbroadcast (NO MORE SPEED :\( v)\nhide\nwait (30) seconds\nshow\nswitch costume to (speeeeeeeeeed v)\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n