Mystical City - Scrolling Platformer

Instructions: Welcome to the Mystical city, a scrolling platformer! There are currently 5 levels, please let me know if you would like me to create more! (Currently making more levels!) :D\n#Games #All #Stories #Art\n---Backstory---\nYou once lived in an amazing city, Mystical city! Everything was great...unitl invaders attacked. They destryoyed everything, and capured your friends! They left behind spikes, icicles, and dangerous water pits! It's your job to save them! \n\nAfter hours and days of working on this, I have finally finished this! Phew! A few weeks ago, I was wondering if I should try something new in Scratch. I decided to try out a scrolling platformer! It was definetely alot of work, since I'm new to this, but I am so glad to share it! :D\n---Instructions---\n1) Use arrow keys to move.\n2) Avoid spikes, icicles, and water!\n3) Touch the cyan flag at the end of each level to go to the next level. \n4) Good luck, you'll need it!\n\n---Hints---\n1) Try jumping on the text that says "jump" in level 3\n2) Don't be fooled by holes. They could be something at the bottom...\n3) Jump on clouds for boosts (and yes, it is possible to jump though clouds if you get the right angle XD)\n\n(Also, the end is a parallax)\n\nPlease let me know if you spotted any errors or bugs! I will try my best to fix them. Scratch on! :)\n\n\n

@Stage\n\n@Sprite1\n\nwhen I receive [start intro v]\nplay sound [music v] until done\n\n@character\n\nwhen flag clicked\ngo to x: (-115) y: (-85)\nhide\n\nwhen I receive [play v]\nforever\n    if <touching color (#bdd9ff)?> then\n        broadcast (dead v)\n        fade out\n        hide\n        broadcast (play v)\n    end\n    if <(y position) < [-170]> then\n        broadcast (dead v)\n        fade out\n        hide\n        broadcast (play v)\n    end\n    if <touching (arrow v)?> then\n        broadcast (dead v)\n        fade out\n        hide\n        broadcast (play v)\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <<<touching (platform v)?> and <not <touching color (#ffffff)?>>> and <not <touching color (#bdd9ff)?>>> then\n        if <(Jump) = [1]> then\n            set [touch wall v] to [1]\n            set [scroll y_ jumping v] to [0]\n            repeat until <<touching (platform v)?> or <(y position) < [-170]>>\n                change y by (Scroll y_ jumping)\n                change [scroll y_ jumping v] by (-0.5)\n            end\n            set [touch wall v] to [0]\n        end\n    else\n        set [touch wall v] to [0]\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <not <touching (platform v)?>> then\n        wait (0.001) seconds\n        if <(Jump) = [0]> then\n            set [scroll y_ jumping v] to [0]\n            set [mid-air v] to [1]\n            repeat until <touching (platform v)?>\n                change y by (Scroll y_ jumping)\n                change [scroll y_ jumping v] by (-0.5)\n            end\n        end\n    else\n        set [mid-air v] to [0]\n    end\nend\n\ndefine fade out\nrepeat (3)\n    change [ghost v] effect by (33)\nend\n\nwhen I receive [play v]\nset [win v] to [0]\nforever\n    if <touching color (#7affec)?> then\n        if <(win) = [0]> then\n            set [win v] to [1]\n            broadcast (next level v)\n        end\n    end\nend\n\ndefine fade in\nrepeat (3)\n    change [ghost v] effect by (-33)\nend\n\nwhen I receive [play v]\ngo to [front v] layer\ngo to x: (-115) y: (-65)\nwait (0.3) seconds\nshow\nfade in\nset [scroll y_ jumping v] to [0]\nset [jump v] to [0]\nforever\n    if <key (up arrow v) pressed?> then\n        set [jump v] to [1]\n        if <<(Touch wall) = [0]> and <(mid-air) = [0]>> then\n            set [scroll y_ jumping v] to [6]\n            repeat (20)\n                change y by (Scroll y_ jumping)\n                change [scroll y_ jumping v] by (-0.3)\n            end\n            repeat until <touching (platform v)?>\n                change y by (Scroll y_ jumping)\n                change [scroll y_ jumping v] by (-0.3)\n            end\n            set [jump v] to [0]\n        end\n    end\nend\n\n@platform\n\ndefine slide right\nset [slide v] to [-5]\nrepeat (10)\n    change x by (slide)\n    change [slide v] by (0.5)\nend\n\ndefine slide left\nset [slide v] to [5]\nrepeat (10)\n    change x by (slide)\n    change [slide v] by (-0.5)\nend\n\nwhen I receive [play v]\nforever\n    if <key (right arrow v) pressed?> then\n        wait until <not <key (right arrow v) pressed?>>\n        if <not <key (left arrow v) pressed?>> then\n            slide right\n        end\n    end\n    if <key (left arrow v) pressed?> then\n        wait until <not <key (left arrow v) pressed?>>\n        if <not <key (right arrow v) pressed?>> then\n            slide left\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    set [platform x v] to (x position)\n    set [platform y v] to (y position)\nend\n\nwhen I receive [play v]\nforever\n    if <key (up arrow v) pressed?> then\n        if <<(Touch wall) = [0]> and <(mid-air) = [0]>> then\n            set [jump_platform v] to [-6]\n            repeat (20)\n                change y by (jump_platform)\n                change [jump_platform v] by (0.3)\n            end\n            repeat until <(Jump) = [0]>\n                change y by (jump_platform)\n                change [jump_platform v] by (0.3)\n            end\n        end\n    end\nend\n\nwhen flag clicked\ngo to x: (235) y: (0)\nswitch costume to (level 1 v)\ngo to x: (235) y: (0)\n\nwhen I receive [next level v]\nif <(level) = [6]> then\n    broadcast (end v)\nelse\n    wait (0.5) seconds\n    next costume\n    broadcast (play v)\nend\n\nwhen I receive [play v]\nglide (0.5) secs to x: (235) y: (0)\ngo to [back v] layer\nset [scroll y_ platform v] to [0]\nset [scroll y_ jumping v] to [0]\nforever\n    if <key (right arrow v) pressed?> then\n        if <(Touch wall) = [0]> then\n            if <(mid-air) = [0]> then\n                change x by (-7)\n                change [enemy scroll x v] by (-1)\n            end\n        end\n    end\n    if <key (left arrow v) pressed?> then\n        if <(Touch wall) = [0]> then\n            if <(mid-air) = [0]> then\n                change x by (7)\n                change [enemy scroll x v] by (1)\n            end\n        end\n    end\n    if <(Touch wall) = [1]> then\n        set [scroll y_ platform v] to [0]\n        repeat until <(Touch wall) = [0]>\n            change y by (Scroll y_ platform)\n            change [scroll y_ platform v] by (0.4)\n        end\n        set [scroll y_ platform v] to [0]\n    end\n    if <(mid-air) = [1]> then\n        set [scroll y_ platform v] to [0]\n        repeat until <(mid-air) = [0]>\n            change y by (Scroll y_ platform)\n            change [scroll y_ platform v] by (0.4)\n        end\n        set [scroll y_ platform v] to [0]\n    end\nend\n\n@stars 1\n\nwhen flag clicked\ngo to x: (263) y: (77)\nforever\n    set [ghost v] effect to (30)\n    go to [back v] layer\n    set x to (platform x)\nend\n\nwhen flag clicked\nforever\n    repeat (10)\n        change y by (0.5)\n    end\n    repeat (10)\n        change y by (-0.5)\n    end\nend\n\n@stars 2\n\nwhen flag clicked\ngo to x: (223) y: (-14)\nforever\n    set [ghost v] effect to (10)\n    go to [back v] layer\n    set x to (platform x)\nend\n\nwait (pick random (0) to (1)) seconds\n\nwhen flag clicked\nforever\n    repeat (10)\n        change y by (0.5)\n    end\n    repeat (10)\n        change y by (-0.5)\n    end\nend\n\nwhen I receive [play v]\n\n@story\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (10) layers\nshow\n\nshow\n\nwhen flag clicked\n\nwait (1) seconds\n\nwhen I receive [end intro v]\ngo to [front v] layer\ngo [forward v] (1000000000000000000000000) layers\nwait (0.5) seconds\nbroadcast (story part 1 v)\nwait (1.5) seconds\nbroadcast (story part 2 v)\nwait (1.5) seconds\nbroadcast (story part 3 v)\nwait (1.5) seconds\nbroadcast (story part 4 v)\nwait (1.5) seconds\nbroadcast (play v)\nfade out\n\ngo to [back v] layer\n\ngo to [back v] layer\n\ndefine fade out\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\n@next level\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen I receive [next level v]\nif <(level) = [6]> then\n    hide\nelse\n    change [level v] by (1)\n    go to x: (-7) y: (346)\n    show\n    glide (1) secs to x: (-7) y: (-344)\n    hide\nend\n\nstop [all v]\n\n@cloud \n\nwhen flag clicked\n\nwhen I start as a clone\ngo to [back v] layer\ngo to x: (330) y: (pick random (50) to (150))\nset [ghost v] effect to (pick random (40) to (70))\nswitch costume to (pick random (1) to (3))\nset size to (pick random (70) to (100)) %\nshow\nrepeat until <(x position) < [-225]>\n    change x by (-30)\nend\ndelete this clone\n\nwhen I receive [play v]\nhide\nforever\n    wait (pick random (0.01) to (0.9)) seconds\n    create clone of (_myself_ v)\nend\n\n@story part 1\n\ndefine fade in\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [story part 1 v]\ngo to [front v] layer\ngo [forward v] (1000000000000000000000000) layers\nshow\nfade in\n\nwhen I receive [play v]\nfade out\nhide\n\ndefine fade out\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\n@story part 2\n\nwhen I receive [story part 2 v]\ngo to [front v] layer\ngo [forward v] (1000000000000000000000000) layers\nshow\nfade in\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\ndefine fade in\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [play v]\nfade out\nhide\n\ndefine fade out\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\n@story part 3\n\nwhen I receive [story part 3 v]\ngo to [front v] layer\ngo [forward v] (1000000000000000000000000) layers\nshow\nfade in\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\ndefine fade out\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\ndefine fade in\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [play v]\nfade out\nhide\n\n@story part 4\n\nwhen I receive [story part 4 v]\ngo to [front v] layer\ngo [forward v] (1000000000000000000000000) layers\nshow\nfade in\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\ndefine fade in\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [play v]\nfade out\nhide\n\ndefine fade out\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\n@Intro\n\ndefine GlideX (x) GlideY (y) Size: (size) Direction: (direction) Speed: (speed)\nrepeat until <<(round (x position)) = (x)> and <<(round (y position)) = (y)> and <<(round (size)) = (size)> and <(round (direction)) = (direction)>>>>\n    change x by (((x) - (x position)) / (speed))\n    change y by (((y) - (y position)) / (speed))\n    change size by (((size) - (size)) / (speed))\n    turn right (((direction) - (direction)) / (speed)) degrees\nend\n\nwhen I receive [start intro v]\nIntro\n\ndefine Intro\nReset\nwait (1) seconds\nset [clone id v] to [slide]\nrepeat (3)\n    create clone of (_myself_ v)\n    wait (.1) seconds\n    change [brightness v] effect by (5)\nend\nwait (.01) seconds\nset [clone id v] to [logo]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone id v] to [name]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone id v] to [shockwave1]\ncreate clone of (_myself_ v)\nset [clone id v] to [shockwave2]\ncreate clone of (_myself_ v)\nset [clone id v] to [shockwave3]\ncreate clone of (_myself_ v)\nset [clone id v] to [shockwave4]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone id v] to [square1]\ncreate clone of (_myself_ v)\nwait (.1) seconds\nset [clone id v] to [square2]\ncreate clone of (_myself_ v)\nwait (.1) seconds\nset [clone id v] to [square1]\ncreate clone of (_myself_ v)\nset [clone id v] to [Circle]\ncreate clone of (_myself_ v)\nwait (3) seconds\nbroadcast (end intro v)\n\nwhen I start as a clone\nif <(Clone ID) = [slide]> then\n    set [ghost v] effect to (0)\n    show\n    switch costume to (slide v)\n    go to x: (0) y: (-360)\n    repeat (18)\n        change x by ((x position) / (-4))\n        change y by ((y position) / (-4))\n    end\nend\n\ndefine Reset\nhide\nclear graphic effects\nset size to (100) %\npoint in direction (90)\ngo to x: (0) y: (0)\nset [i v] to [0]\nset [clone id v] to [0]\nset [direction vel. v] to [0]\nset [y vel. v] to [0]\n\nwhen I start as a clone\nif <(Clone ID) = [logo]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (logo | @rc_legend v)\n    set size to (250) %\n    point in direction (0)\n    set [direction vel. v] to [0]\n    set [y vel. v] to [0]\n    set y to (-500)\n    repeat (100)\n        set [y vel. v] to (((y Vel.) * (.8)) + (((0) - (y position)) / (9)))\n        set [direction vel. v] to (((Direction Vel.) * (.9)) + (((90) - (direction)) / (9)))\n        change y by (y Vel.)\n        turn right (Direction Vel.) degrees\n        change size by (((100) - (size)) / (9))\n    end\nend\n\nwhen I start as a clone\nif <(Clone ID) = [name]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (name | @rc_legend v)\n    set size to (100) %\n    go to x: (0) y: (-360)\n    GlideX [0] GlideY [0] Size: [100] Direction: [90] Speed: [5]\n    wait (1) seconds\n    GlideX [0] GlideY [-70] Size: [100] Direction: [90] Speed: [5]\n    wait (1) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [shockwave1]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (shockwave v)\n    go to x: (0) y: (160)\n    set [color v] effect to (0)\n    set size to (0) %\n    repeat (22)\n        next costume\n        change size by (((300) - (size)) / (9))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (((300) - (size)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [shockwave2]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (shockwave v)\n    go to x: (0) y: (-160)\n    set [color v] effect to (0)\n    set size to (0) %\n    repeat (22)\n        next costume\n        change size by (((300) - (size)) / (9))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (((300) - (size)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [shockwave3]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (shockwave v)\n    go to x: (160) y: (0)\n    set [color v] effect to (0)\n    set size to (0) %\n    repeat (22)\n        next costume\n        change size by (((300) - (size)) / (9))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (((300) - (size)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [shockwave4]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (shockwave v)\n    go to x: (-160) y: (0)\n    set [color v] effect to (0)\n    set size to (0) %\n    repeat (22)\n        next costume\n        change size by (((300) - (size)) / (9))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (((300) - (size)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [square1]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (square1 v)\n    set size to (1) %\n    go to x: (-240) y: (0)\n    repeat (26)\n        turn right (5) degrees\n        switch costume to (blank v)\n        change size by ((size) / (3.5))\n        switch costume to (square1 v)\n        change x by (((0) - (x position)) / (6))\n    end\nend\n\nwhen I start as a clone\nif <(Clone ID) = [square2]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (square2 v)\n    set size to (1) %\n    go to x: (-240) y: (0)\n    repeat (26)\n        turn right (5) degrees\n        switch costume to (blank v)\n        change size by ((size) / (3.5))\n        switch costume to (square2 v)\n        change x by (((0) - (x position)) / (6))\n    end\nend\n\nwhen I start as a clone\nif <(Clone ID) = [Circle]> then\n    set [brightness v] effect to (0)\n    show\n    switch costume to (circle v)\n    set size to (100) %\n    go to x: (0) y: (-300)\n    set [ball size v] to [20]\n    repeat (30)\n        change y by (Ball Size)\n        change [ball size v] by (-1)\n    end\n    set [ball size v] to [1200]\n    repeat (12)\n        switch costume to (blank v)\n        change size by (Ball Size)\n        change [ball size v] by (-100)\n        switch costume to (circle v)\n    end\nend\n\nwhen I receive [end intro v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (1) seconds\nforever\n    delete this clone\nend\n\nwhen flag clicked\nbroadcast (Start Intro v)\n\n@Sprite2\n\nwhen flag clicked\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [end v]\ngo to [front v] layer\nshow\nfade in\nforever\n    go to x: ((mouse x) / (20)) y: ((mouse y) / (20))\nend\n\ndefine fade in\nrepeat (3)\n    change [ghost v] effect by (-33)\nend\n\n@tn\n\nwhen flag clicked\ngo to x: (-16) y: (-19)\ngo to [front v] layer\nhide\n\ngo to [front v] layer\ngo to x: (-16) y: (-19)\nshow\n\n@Sprite3\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\n\nwhen this sprite clicked\nbroadcast (next level v)\n\nwhen I receive [next level v]\nhide\n\n