Synchrony || A Platformer
@Stage\n\n@Blank\n\n@Player\n\nwhen flag clicked\nhide\n\ndefine Tick\nchange y by (1)\nx\ny\ntest die\ntest win\nchange y by (-1)\n\ndefine x\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(Left?) = [True]>> then\n    point in direction (-90)\n    change [xv v] by (-2)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(Right?) = [True]>> then\n    point in direction (90)\n    change [xv v] by (2)\nend\nchange x by (round (xv))\nset [xv v] to ((xv) * (0.8))\nif <touching (ground v)?> then\n    repeat (5)\n        change y by (1)\n        if <not <touching (ground v)?>> then\n            stop [this script v]\n        end\n    end\n    change y by (-5)\n    if <(xv) > [0]> then\n        repeat until <not <touching (ground v)?>>\n            change x by (-1)\n        end\n    else\n        repeat until <not <touching (ground v)?>>\n            change x by (1)\n        end\n    end\n    set [xv v] to [0]\nelse\n    stop [this script v]\nend\n\ndefine y\nchange y by (-1)\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(Jump?) = [True]>> and <touching (ground v)?>> then\n    set [yv v] to [16]\nend\nif <touching (trampoline v)?> then\n    set [yv v] to [20]\nend\nchange y by (yv)\nchange [yv v] by (-2)\nif <touching (ground v)?> then\n    if <(yv) > [0]> then\n        repeat until <not <touching (ground v)?>>\n            change y by (-1)\n        end\n    else\n        repeat until <not <touching (ground v)?>>\n            change y by (1)\n        end\n    end\n    set [yv v] to [0]\nelse\n    stop [this script v]\nend\n\ndefine test die\nif <<touching (danger v)?> or <touching (opponent v)?>> then\n    set [status v] to [lose]\nend\n\ndefine test win\nif <(x position) > [240]> then\n    set [status v] to [win]\nend\n\nwhen I receive [green flag v]\nset [level v] to [1]\nforever\n    broadcast (lose v) and wait\n    set [yv v] to [0]\n    set [xv v] to [0]\n    set [status v] to []\n    go to x: (-210) y: (-50)\n    show\n    repeat until <(status) > []>\n        Tick\n    end\n    if <(status) = [win]> then\n        change [level v] by (1)\n        broadcast (win v) and wait\n    end\n    if <(Level) > [16]> then\n        stop [all v]\n    end\nend\n\nwhen [r v] key pressed\nset [status v] to [lose]\nwait until <not <key (r v) pressed?>>\n\nwhen [n v] key pressed\nset [status v] to [win]\nwait until <not <key (n v) pressed?>>\n\nwhen [b v] key pressed\nif <(Level) > [1]> then\n    change [level v] by (-1)\n    broadcast (win v) and wait\n    go to x: (-210) y: (-50)\nend\nwait until <not <key (n v) pressed?>>\n\n@Ground\n\nwhen I receive [win v]\nswitch costume to (Level)\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (Level)\n\nwhen I receive [green flag v]\nshow\n\nwhen flag clicked\nhide\n\n@Danger\n\nwhen I receive [win v]\nnext costume\n\nwhen I receive [win v]\nswitch costume to (Level)\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (Level)\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Joystick Engine\n\ndefine Get Direction From x: (x2) y: (y2) To x: (x) y: (y)\nset [dir v] to (((90) - ([atan v] of (((y) - (y2)) / ((x) - (x2))) )) + (<((x) - (x2)) < [0]> * (180)))\n\ndefine Joystick at x: (x) y: (y) Size: (size)\nbroadcast (Delete Joystick Clones v) and wait\nswitch costume to (joy v)\nset size to (size) %\nshow\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [delete joystick clones v]\nrepeat (5)\n    delete this clone\nend\nhide\n\nwhen I start as a clone\nswitch costume to (stick v)\nset size to (([size v] of [joystick engine v]) / (2)) %\nforever\n    go to x: ([x position v] of [joystick engine v]) y: ([y position v] of [joystick engine v])\n    set [touching? v] to [0]\n    wait until <mouse down?>\n    if <(GhostEffect) = [20]> then\n        set [touching? v] to [1]\n        repeat until <not <mouse down?>>\n            go to x: (mouse x) y: (mouse y)\n            Get Direction From x: ([x position v] of [joystick engine v]) y: ([y position v] of [joystick engine v]) To x: (x position) y: (y position)\n            change x by (([sin v] of (Dir) ) * (2))\n            change y by (([cos v] of (Dir) ) * (2))\n            if <not <touching (joystick engine v)?>> then\n                go to x: (([x position v] of [joystick engine v]) + (([sin v] of (Dir) ) * ((size) * (0.3)))) y: (([y position v] of [joystick engine v]) + (([cos v] of (Dir) ) * ((size) * (0.3))))\n            end\n            change x by ((([sin v] of (Dir) ) * (2)) * (-1))\n            change y by ((([cos v] of (Dir) ) * (2)) * (-1))\n            Direction -> Controls Script HERE\n        end\n        set [jump? v] to [False]\n        set [right? v] to [False]\n        set [left? v] to [False]\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    show\n    set [ghost v] effect to ((GhostEffect) - (5))\n    go to [front v] layer\nend\n\ndefine Direction -> Controls Script HERE\nset [jump? v] to [False]\nset [right? v] to [False]\nset [left? v] to [False]\nif <(y position) > [-100]> then\n    set [jump? v] to [True]\nend\nif <(x position) > [159]> then\n    set [right? v] to [True]\nend\nif <(x position) < [159]> then\n    set [left? v] to [True]\nend\n\ndefine (number or text)\n\nwhen I receive [green flag v]\nJoystick at x: [159] y: [-100] Size: [300]\nforever\n    switch costume to (joy v)\n    if <<(distance to [mouse-pointer v]) < ((size) / (5))> or <(Touching?) = [1]>> then\n        set [ghosteffect v] to [20]\n    else\n        set [ghosteffect v] to [90]\n    end\n    set [ghost v] effect to (GhostEffect)\nend\n\n@Music\n\nwhen I receive [green flag v]\nforever\n    play sound [Floating v] until done\nend\n\nwhen [m v] key pressed\nif <(volume) = [0]> then\n    set volume to (100) %\nelse\n    set volume to (0) %\nend\n\n@Trampoline\n\nwhen I receive [win v]\nswitch costume to (Level)\n\nwhen flag clicked\nswitch costume to (Level)\n\nwhen I receive [green flag v]\nshow\n\nwhen flag clicked\nhide\n\n@Opponent\n\ndefine Level-10\nif <(Level) = [10]> then\n    set [opponent velocity v] to [0]\n    go to x: (210) y: (19)\n    show\n    repeat until <not <(Level) = [10]>>\n        if <([x position v] of [player v]) < (x position)> then\n            change [opponent velocity v] by (-2)\n            point in direction (-90)\n        end\n        if <([x position v] of [player v]) > (x position)> then\n            change [opponent velocity v] by (2)\n            point in direction (90)\n        end\n        change x by (round (Opponent Velocity))\n        set [opponent velocity v] to ((Opponent Velocity) * (0.8))\n    end\n    hide\n    stop [this script v]\nend\n\nwhen I receive [win v]\nbroadcast (Check v)\n\nwhen I receive [lose v]\nbroadcast (Check v)\n\nwhen flag clicked\nhide\n\nwhen I receive [check v]\nLevel-10\nLevel-12\n\ndefine Level-12\nif <(Level) = [12]> then\n    set [opponent velocity v] to [0]\n    go to x: (150) y: (19)\n    show\n    repeat until <not <(Level) = [12]>>\n        if <([x position v] of [player v]) < (x position)> then\n            change [opponent velocity v] by (-1)\n            point in direction (-90)\n        end\n        if <([x position v] of [player v]) > (x position)> then\n            change [opponent velocity v] by (1)\n            point in direction (90)\n        end\n        change x by (round (Opponent Velocity))\n        set [opponent velocity v] to ((Opponent Velocity) * (0.9))\n    end\n    hide\n    stop [this script v]\nend\n\n@Intro\n\nwhen flag clicked\nset [saturn-rings v] to [false]\nset [# v] to [0]\nClone [4]\n\nwhen I receive [green flag v]\nhide\ndelete this clone\n\nwhen I start as a clone\nshow\nif <(#) = [1]> then\n    go to x: (0) y: (0)\n    set size to (0) %\n    switch costume to (logo v)\n    show\n    repeat (7)\n        change size by (10)\n    end\n    repeat (4)\n        change size by (-5)\n    end\n    set [saturn-rings v] to [true]\n    repeat (5)\n        change y by (10)\n    end\nend\nif <(#) = [2]> then\n    hide\n    switch costume to (s v)\n    set rotation style [don't rotate v]\n    wait (0.00000011) seconds\n    repeat (120)\n        set [# v] to [5]\n        go to x: (pick random (-230) to (-200)) y: (pick random (-120) to (120))\n        create clone of (_myself_ v)\n        go to x: (pick random (230) to (200)) y: (pick random (-120) to (120))\n        create clone of (_myself_ v)\n    end\n    broadcast (green flag v)\n    hide\nend\nif <(#) = [3]> then\n    hide\n    set [ghost v] effect to (100)\n    switch costume to (words v)\n    wait until <(Saturn-Rings) = [true]>\n    go to x: (0) y: (-100)\n    show\n    repeat (20)\n        change [ghost v] effect by (-5)\n    end\nend\nif <(#) = [4]> then\n    go to x: (0) y: (0)\n    set size to (100) %\n    go to [back v] layer\n    show\n    switch costume to (backdrop v)\nend\nif <(#) = [5]> then\n    go to [back v] layer\n    go [forward v] (1) layers\n    set size to (pick random (10) to (30)) %\n    if <not <touching color (#000000)?>> then\n        show\n    end\n    if <(x position) > [0]> then\n        repeat until <(x position) < [0]>\n            point in direction (-90)\n            move (10) steps\n        end\n    else\n        repeat until <(x position) > [0]>\n            point in direction (90)\n            move (10) steps\n        end\n    end\n    delete this clone\nend\n\ndefine Clone (#)\nrepeat (#)\n    change [# v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nstart sound [Triumph v]\n\nwhen I receive [green flag v]\nstop all sounds\n\n@Thumbnail\n\nwhen [timer v] > (0)\ngo to x: (0) y: (0)\nif <(Level) > [16]> then\n    set [brightness v] effect to (100)\n    switch costume to (win screen v)\n    go to [front v] layer\n    broadcast (End v)\n    show\n    repeat (20)\n        go to [front v] layer\n        change [brightness v] effect by (-5)\n    end\n    set [level v] to [0]\n    forever\n        play sound [Alone For Now v] until done\n    end\nelse\n    set [brightness v] effect to (100)\n    switch costume to (thumbnail v)\n    go to [front v] layer\n    show\n    repeat (20)\n        go to [front v] layer\n        change [brightness v] effect by (-5)\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen I receive [end v]\nforever\n    reset timer\nend\n\n@Notification \n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\ngo to x: (0) y: (70)\nshow\nforever\n    wait (pick random (7) to (10)) seconds\n    Notify\nend\n\ndefine Notify\nset [yv v] to [-70]\nrepeat (7)\n    set [yv v] to ((Yv) * (0.5))\n    change y by (Yv)\nend\nchange y by (-1)\nwait (3) seconds\nglide (0.3) secs to x: (0) y: (70)\n\n
★ Description ★\nSynchrony is a mobile-friendly, non-generic platformer. With 16 challenging levels this game is sure be a blast to play. Not to mention it's amazing minimalistic graphics, and epic songs. Play Synchrony now, in the box on your left.\n\n★ Instructions ★\n• Arrow Keys, WASD, or Joystick to move.\n• The two blue squares move in exact synchrony.\n• N to skip, and B to go back.\n• M to mute/unmute.\n• Have fun.\n• Follow the instructions.\n\n★ Tips ★\n• Remember that the two cubes move in exact synchrony, therefor you can use them to anchor each other midair.