Sunlight Explorer: A Platformer

Instructions: hElLo gUyS! a nEw pRoJecT bY mE! uSe aRrOw kEyS tO pLay, oR yOu can eVeN uSe wAsD! i hOpE yOu eNjoy!

@Stage\n\nwhen flag clicked\nforever\n    play sound [Bounc3 - Paradise on E.mp3 v] until done\n    set volume to (30) %\nend\n\n@Level\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [ghost v] effect to (0)\nforever\n    go to [back v] layer\nend\n\nwhen I receive [next level v]\nnext costume\n\n@Player\n\nwhen flag clicked\nswitch costume to (player2 v)\nshow\nforever\n    if <<(x position) > [240]> and <touching (_edge_ v)?>> then\n        broadcast (Next level v)\n    end\n    if <<touching (spikes v)?> or <<(y position) < [-170]> and <touching (_edge_ v)?>>> then\n        broadcast (Restart v)\n        create clone of (_myself_ v)\n    end\n    if <touching (bounce v)?> then\n        set [y v] to [20]\n    end\n    create clone of (trail thingy v)\nend\n\nwhen [r v] key pressed\nbroadcast (Restart v)\n\nwhen I receive [next level v]\nbroadcast (Restart v)\nnext backdrop\n\nwhen I receive [restart v]\ngo to x: (-220) y: (-30)\nset [y v] to [0]\n\nwhen I start as a clone\nclear graphic effects\nset rotation style [all around v]\nrepeat (20)\n    turn right (15) degrees\n    change y by (10)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <touching (water v)?> then\n        change [y v] by (1.5)\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            change [y v] by (1.5)\n        end\n        if <<key (down arrow v) pressed?> or <<mouse down?> and <(y position) > (mouse y)>>> then\n            change [y v] by (-1.5)\n        end\n    end\nend\n\nwhen flag clicked\nbroadcast (Restart v)\nswitch costume to (costume1 v)\nshow\nset [x v] to [0]\nset [y v] to [0]\nforever\n    go to [front v] layer\n    change [y v] by (-1)\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n        point in direction (-90)\n    end\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> then\n        change [x v] by (1)\n        point in direction (90)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\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) * (-1))\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y v] to [15]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching (level v)?> 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 <<mouse down?> and <(mouse y) > (y position)>>> and <touching (level v)?>> then\n        set [y v] to [15]\n    end\n    change y by (1)\nend\n\n@Trail thingy\n\nwhen flag clicked\nforever\n    hide\n    go to (player v)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nclear graphic effects\nset [ghost v] effect to (50)\ngo [forward v] (1) layers\nrepeat (10)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\n@Huh eyes\n\nwhen flag clicked\nforever\n    Fix\nend\n\ndefine Fix\ngo to (player v)\ngo to [front v] layer\nshow\nif <touching (player v)?> then\n    set [ghost v] effect to (0)\nelse\n    set [ghost v] effect to (100)\nend\nset size to (22) %\n\nwhen flag clicked\nswitch costume to (costume2 v)\nforever\n    wait (pick random (3) to (5)) seconds\n    repeat (5)\n        next costume\n        go to [front v] layer\n    end\n    repeat (5)\n        switch costume to ((costume [number v]) - (1))\n        go to [front v] layer\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (pick random (1) to (3)) seconds\nend\n\nwhen I start as a clone\nswitch costume to (pick random (1) to (3))\nset [ghost v] effect to (pick random (40) to (70))\ngo to [back v] layer\ngo to x: (300) y: (pick random (150) to (0))\nrepeat until <(x position) < [-290]>\n    show\n    change x by (-5)\nend\ndelete this clone\n\n@grass\n\ndefine Grass from (xpos1) to (xpos2)\nshow\nclear graphic effects\ngo to x: (xpos1) y: (-1)\npoint in direction (90)\nrepeat until <(x position) = (xpos2)>\n    show\n    change x by (pick random (1) to (3))\n    set size to (pick random (50) to (150)) %\n    if <(pick random (1) to (2)) = [2]> then\n        create clone of (_myself_ v)\n    end\n    go to [back v] layer\nend\nhide\n\nwhen I start as a clone\nGrass\nchange x by (10)\nif <not <touching (level v)?>> then\n    change x by (-10)\nend\nforever\n    go to [back v] layer\n    if <<touching (player v)?> or <<touching (other v)?> or <touching (wind v)?>>> then\n        Sway\n    end\nend\n\ndefine Grass\nswitch costume to (base hitbox v)\nif <touching (level v)?> then\n    repeat until <<not <touching (level v)?>> or <touching (level v)?>>\n        change y by (1)\n    end\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\n    change x by (-4)\nelse\n    repeat until <touching (level v)?>\n        change y by (-2)\n        if <touching (_edge_ v)?> then\n            delete this clone\n        end\n    end\nend\nswitch costume to (pick random (1) to (6))\n\ndefine Sway\nset [magnitude v] to (((xmotion) + (pick random (-2.0) to (2.0))) * (2))\nset [sway v] to [0]\nrepeat until <<[0] = (round ((Magnitude) * (2)))> or <<<<touching (player v)?> or <touching (other v)?>> or <touching (wind v)?>> and <([abs v] of (Magnitude) ) < ([abs v] of ((xmotion) * (2)) )>>>\n    point in direction ((90) - ((([sin v] of (sway) ) * (Magnitude)) * (12)))\n    change [sway v] by (-10)\n    set [magnitude v] to ((0.95) * (Magnitude))\nend\n\nwhen flag clicked\nGrass from [-240] to [240]\n\nwhen I receive [next level v]\nif  then\n    delete this clone\nend\nGrass from [-240] to [240]\n\n@Tips\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [1]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev1 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [2]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev2 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [3]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev3 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [5]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev5 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [4]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev4 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [6]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev6 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\n\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [7]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev7 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [8]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev8 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [10]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev10 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [9]>\nshow\nset [ghost v] effect to (50)\nswitch costume to (lev9 v)\ngo to x: (0) y: (200)\nglide (0.5) secs to x: (0) y: (150)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nrepeat (10)\n    change [ghost v] effect by (5)\n    change y by (5)\nend\nhide\n\n@Spikes\n\nwhen flag clicked\nforever\n    tick\nend\n\ndefine tick\nswitch costume to ([costume # v] of [level v])\ngo to [back v] layer\n\n@bounce\n\nwhen flag clicked\nforever\n    hide\n    if <([costume # v] of [level v]) = [5]> then\n        go to x: (-99) y: (-62)\n        create clone of (_myself_ v)\n        wait until <not <([costume # v] of [level v]) = [5]>>\n    end\n    if <([costume # v] of [level v]) = [6]> then\n        go to x: (-99) y: (-62)\n        create clone of (_myself_ v)\n        go to x: (99) y: (-62)\n        create clone of (_myself_ v)\n        wait until <not <([costume # v] of [level v]) = [6]>>\n    end\n    if <([costume # v] of [level v]) = [8]> then\n        go to x: (-140) y: (-62)\n        create clone of (_myself_ v)\n        wait until <not <([costume # v] of [level v]) = [8]>>\n    end\n    if <([costume # v] of [level v]) = [9]> then\n        delete this clone\n    end\n    if <([costume # v] of [level v]) = [10]> then\n        go to x: (-200) y: (-62)\n        create clone of (_myself_ v)\n        wait until <not <([costume # v] of [level v]) = [6]>>\n    end\nend\n\nwhen I start as a clone\nforever\n    show\n    if <touching (player v)?> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I receive [next level v]\ndelete this clone\n\n@Water\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (0) y: (0)\nset [tide v] to [0]\nforever\n    repeat (10)\n        change [tide v] by (-0.1)\n    end\n    repeat (20)\n        change [tide v] by (0.1)\n    end\n    repeat (10)\n        change [tide v] by (-0.1)\n    end\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    switch costume to ([costume # v] of [level v])\n    set [ghost v] effect to (50)\n    change y by (tide)\n    go to [back v] layer\nend\n\ngo [backward v] (1) layers\n\n@Sprite1\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    reset timer\n    set size to (120) %\n    switch costume to (costume2 v)\nend\n\nwhen [timer v] > (0.03)\nset [ghost v] effect to (100)\nrepeat (20)\n    go to [front v] layer\n    switch costume to (costume2 v)\n    change size by (-1)\n    change [ghost v] effect by (-5)\n    switch costume to (costume1 v)\nend\ngo to [front v] layer\n\n