Ninja Platformer

Instructions: CONTROLS:\n\nW, Space, or Up Arrow - Jump\n\nA or Left Arrow - Move Left\n\nD or Right Arrow - Move Right\n\nM - Toggle Sound\n\nN - Night/Day Mode\n\nP - Increase the Speed the Platforms Move\n\nINSTRUCTIONS:\n\n~Objective is to stay on the platforms as long as you can.\n\n~Get points by bouncing or collecting gold and silver pieces.\n\n~Red pieces will kill you.\n\n~Touching blue kills you.\n\n~Platforms move randomly.\n\n~You can double jump.

@Stage\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        switch backdrop to (background1 v)\n    else\n        switch backdrop to (background2 v)\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <key (n v) pressed?> then\n        if <(night) = [0]> then\n            set [night v] to [1]\n            wait (0.5) seconds\n        else\n            set [night v] to [0]\n            wait (0.5) seconds\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <key (p v) pressed?> then\n        change [time v] by (1)\n        wait (0.2) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <(music) = [1]> then\n        play sound [Anamanaguchi - A v] until done\n        set [music v] to [2]\n    end\n    if <(music) = [2]> then\n        play sound [Anamanaguchi - H v] until done\n        set [music v] to [3]\n    end\n    if <(music) = [3]> then\n        play sound [tylerk_-_thats_e v] until done\n        set [music v] to [4]\n    end\n    if <(music) = [4]> then\n        play sound [Anamanaguchi - A1 v] until done\n        set [music v] to [1]\n    end\nend\n\nwhen I receive [start v]\nset [time v] to [2]\nset [yvel v] to [0]\nset [score v] to [0]\nset [changed v] to [1]\n\nwhen flag clicked\nbroadcast (Start v)\n\nwhen flag clicked\nforever\n    if <(Score) > (Hi-Score)> then\n        set [hi-score v] to (Score)\n    end\nend\n\nwhen flag clicked\nset [local hi-score v] to [0]\nset [night v] to [0]\nset [score v] to [0]\nset [hi-score v] to [0]\nset [music v] to (pick random (1) to (4))\n\nwhen I receive [start v]\nforever\n    if <key (m v) pressed?> then\n        if <(volume) = [0]> then\n            change volume by (100)\n            wait (0.5) seconds\n        else\n            change volume by (-100)\n            wait (0.5) seconds\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Score) > (Local Hi-Score)> then\n        set [local hi-score v] to (Score)\n    end\nend\n\n@Ninja\n\nwhen I receive [start v]\nforever\n    if <<touching (platform1 v)?> and <(y position) < (p1ypos)>> then\n        set [yvel v] to [-5]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (platform2 v)?> and <(y position) < (p2ypos)>> then\n        set [yvel v] to [-5]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<<touching (platform1 v)?> and <(y position) > (p1ypos)>> or <<<touching (platform2 v)?> and <(y position) > (p2ypos)>> or <<touching (platform3 v)?> and <(y position) > (p3ypos)>>>> then\n        set [yvel v] to [9]\n    else\n        change [yvel v] by (-1)\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (platform1 v)?> and <(y position) > (p1ypos)>> then\n        set [jump v] to [0]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(y position) < [-170]> then\n        if <(Hi-Score) > (☁ Hi-Score)> then\n            set [☁ hi-score v] to (Hi-Score)\n        end\n        broadcast (Start v)\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<<key (space v) pressed?> or <key (w v) pressed?>> or <key (up arrow v) pressed?>> then\n        if <<(jump) < [2]> and <key (space v) pressed?>> then\n            set [yvel v] to [12]\n            change [jump v] by (1)\n            wait until <not <key (space v) pressed?>>\n        end\n        if <<(jump) < [2]> and <key (w v) pressed?>> then\n            set [yvel v] to [12]\n            change [jump v] by (1)\n            wait until <not <key (w v) pressed?>>\n        end\n        if <<(jump) < [2]> and <key (up arrow v) pressed?>> then\n            set [yvel v] to [12]\n            change [jump v] by (1)\n            wait until <not <key (up arrow v) pressed?>>\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change x by (-10)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change x by (10)\n    end\nend\n\nwhen I receive [start v]\nforever\n    set [ypos v] to (y position)\nend\n\nwhen I receive [start v]\nforever\n    change y by (yvel)\nend\n\nwhen I receive [start v]\ngo to [front v] layer\ngo to x: (0) y: (60)\n\nwhen I receive [start v]\nforever\n    turn right (10) degrees\nend\n\nwhen I receive [start v]\nforever\n    if <<<touching (platform1 v)?> and <(y position) > (p1ypos)>> or <<<touching (platform2 v)?> and <(y position) > (p2ypos)>> or <<touching (platform3 v)?> and <(y position) > (p3ypos)>>>> then\n        change [score v] by (10)\n        wait until <not <<<touching (platform1 v)?> and <(y position) > (p1ypos)>> or <<<touching (platform2 v)?> and <(y position) > (p2ypos)>> or <<touching (platform3 v)?> and <(y position) > (p3ypos)>>>>>\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (platform3 v)?> and <(y position) > (p3ypos)>> then\n        set [jump v] to [0]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (platform3 v)?> and <(y position) < (p3ypos)>> then\n        set [yvel v] to [-5]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(y position) > [175]> then\n        set [yvel v] to [-5]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(yvel) < [-15]> then\n        set [yvel v] to [-15]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (platform2 v)?> and <(y position) > (p2ypos)>> then\n        set [jump v] to [0]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(night) = [0]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen this sprite clicked\nsay [Thank you for playing! Have fun and feel free to leave feedback!] for (5) seconds\n\n@Silver\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    turn right (-15) degrees\nend\n\nwhen I receive [start v]\nhide\ngo to x: (-500) y: (-500)\nwait (10) seconds\nforever\n    wait (pick random (5) to (10)) seconds\n    go to x: (pick random (-200) to (200)) y: (pick random (-150) to (150))\n    show\n    wait until <touching (ninja v)?>\n    go to x: (-500) y: (-500)\n    change [score v] by (100)\n    start sound [collectcoin v]\n    hide\nend\n\n@Gold\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    turn right (-15) degrees\nend\n\nwhen I receive [start v]\nhide\ngo to x: (-500) y: (-500)\nwait (20) seconds\nforever\n    if <not <touching (ninja v)?>> then\n        wait (pick random (10) to (15)) seconds\n        go to x: (240) y: (pick random (-160) to (160))\n        show\n        glide (3) secs to x: (-240) y: (y position)\n        hide\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <touching (ninja v)?> then\n        go to x: (-500) y: (-500)\n        change [score v] by (300)\n        start sound [collectcoin v]\n        hide\n    end\nend\n\n@Red\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    turn right (-15) degrees\nend\n\nwhen I receive [start v]\nhide\ngo to x: (-500) y: (-500)\nwait (30) seconds\nforever\n    if <not <touching (ninja v)?>> then\n        wait (pick random (15) to (20)) seconds\n        go to x: (pick random (-200) to (200)) y: (175)\n        show\n        glide (2) secs to x: (x position) y: (-181)\n        hide\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <touching (ninja v)?> then\n        broadcast (Start v)\n    end\nend\n\n@Platform1\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen I receive [start v]\nforever\n    set [p1ypos v] to (y position)\nend\n\nwhen I receive [start v]\nforever\n    if <(y position) > [120]> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\n    if <<touching (platform3 v)?> or <touching (platform2 v)?>> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\nend\n\nwhen I receive [start v]\ngo to x: (-80) y: (-50)\n\nwhen I receive [start v]\nforever\n    wait until <(Changed) = [1]>\n    wait ((7) / (time)) seconds\n    go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (25)))\n    change [time v] by (0.2)\n    set [changed v] to [2]\nend\n\n@Platform2\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen I receive [start v]\nforever\n    set [p2ypos v] to (y position)\nend\n\nwhen I receive [start v]\ngo to x: (80) y: (-50)\n\nwhen I receive [start v]\nforever\n    wait until <(Changed) = [2]>\n    wait ((7) / (time)) seconds\n    go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    change [time v] by (0.2)\n    set [changed v] to [3]\nend\n\nwhen I receive [start v]\nforever\n    if <(y position) > [120]> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\n    if <<touching (platform1 v)?> or <touching (platform3 v)?>> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\nend\n\n@Platform3\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        set [brightness v] effect to (0)\n    else\n        set [brightness v] effect to (-25)\n    end\nend\n\nwhen I receive [start v]\nforever\n    set [p3ypos v] to (y position)\nend\n\nwhen I receive [start v]\ngo to x: (0) y: (40)\n\nwhen I receive [start v]\nforever\n    wait until <(Changed) = [3]>\n    wait ((7) / (time)) seconds\n    go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    change [time v] by (0.2)\n    set [changed v] to [1]\nend\n\nwhen I receive [start v]\nforever\n    if <(y position) > [120]> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\n    if <<touching (platform1 v)?> or <touching (platform2 v)?>> then\n        go to x: (pick random (-200) to (200)) y: (pick random (-150) to ((ypos) + (80)))\n    end\nend\n\n@Cloud1\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen flag clicked\nshow\ngo [backward v] (100) layers\ngo to x: (pick random (-170) to (170)) y: (pick random (15) to (170))\nforever\n    change x by (-1)\n    wait (0.2) seconds\nend\n\nwhen flag clicked\nforever\n    if <(x position) < [-235]> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        wait (pick random (3) to (5)) seconds\n        go to x: (240) y: (pick random (15) to (140))\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\n@Cloud2\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen flag clicked\nshow\ngo [backward v] (100) layers\ngo to x: (pick random (-170) to (170)) y: (pick random (15) to (170))\nforever\n    change x by (-1)\n    wait (0.3) seconds\nend\n\nwhen flag clicked\nforever\n    if <(x position) < [-235]> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        wait (pick random (3) to (5)) seconds\n        go to x: (240) y: (pick random (15) to (140))\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\n@Cloud3\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) < [-235]> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        wait (pick random (3) to (5)) seconds\n        go to x: (240) y: (pick random (15) to (140))\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\nwhen flag clicked\ngo [backward v] (100) layers\nshow\ngo to x: (pick random (-170) to (170)) y: (pick random (15) to (170))\nforever\n    change x by (-1)\n    wait (0.5) seconds\nend\n\n@Moon\n\nwhen flag clicked\nforever\n    repeat until <(y position) > [165]>\n        change y by (1)\n        wait (15) seconds\n    end\n    repeat until <(y position) < [86]>\n        change y by (-1)\n        wait (15) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (cloud1 v)?> or <<touching (cloud2 v)?> or <touching (cloud3 v)?>>> then\n        go [backward v] (1) layers\n    end\nend\n\nwhen flag clicked\nforever\n    if <(night) = [0]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [235]> then\n        hide\n        wait (pick random (0) to (0)) seconds\n        go to x: (-240) y: (85)\n        show\n    end\nend\n\nwhen flag clicked\ngo to x: (-240) y: (85)\nforever\n    change x by (1)\n    wait (5) seconds\nend\n\nwhen this sprite clicked\nsay [I hope you enjoy my game! Thank you for playing!] for (5) seconds\n\n