Opposite - A Platformer


@Stage\n\nwhen flag clicked\nset [intro? v] to [1]\nset [level v] to [1]\nswitch backdrop to (intro v)\n\nwhen I receive [green flag v]\nset [intro? v] to [0]\nswitch backdrop to (game v)\nwait (1) seconds\nforever\n    play sound [Sneaky Snitch v] until done\nend\n\n@Player\n\ndefine Place Player\ngo to x: (210) y: (0)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\nPlace Player\nSet size to: [50]\nhide variable [y v]\nhide variable [x v]\nset [y v] to [0]\nset [x v] to [0]\nforever\n    Gravity, Platform Detection, Physics\nend\n\ndefine Set size to: (size)\nset size to (size) %\n\ndefine Gravity, Platform Detection, Physics\nforever\n    change [y v] by (-1)\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [x v] by (-1)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [x v] by (1)\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 (down arrow v) pressed?> or <key (s v) pressed?>> then\n            set [y v] to [17]\n            if <(x) > [0]> 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 (down arrow v) pressed?> or <key (s v) pressed?>> and <touching (level v)?>> then\n        set [y v] to [15]\n    end\n    change y by (1)\n    if <<<touching (obstacles v)?> or <(y position) < [-175]>> or <key (r v) pressed?>> then\n        broadcast (Death Flash v)\n        Place Player\n    end\n    if <(x position) < [-230]> then\n        change [level v] by (1)\n        broadcast (Flash v)\n        Place Player\n    end\n    if <touching (bounce v)?> then\n        set [y v] to [20]\n    end\n    if <touching (advance v)?> then\n        set [x v] to [-15]\n    else\n        set [x v] to (x)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Level\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Obstacles\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\n    go [backward v] (1) layers\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Words\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go [backward v] (1) layers\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\ndefine Smooth Glide From: (startx) (starty) Smooth Glide To: (endx) (endy) Smooth Glide For: (seconds)\ngo to x: (startx) y: (starty)\nglide (seconds) secs to x: (endx) y: (endy)\n\nwhen I receive [flash v]\nSmooth Glide From: [281] [0] Smooth Glide To: [0] [0] Smooth Glide For: [1.5]\n\n@Eyes\n\nwhen flag clicked\nset size to (50) %\nforever\n    repeat (10)\n        change size by (.1)\n    end\n    repeat (10)\n        change size by (-.1)\n    end\nend\n\nwait (.5) seconds\nnext costume\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\ngo to x: (() / ()) y: (((mouse y) / (5)) / ([y position v] of [player v]))\n\nset x to (([x position v] of [player v]) / (1.02))\nset y to (([y position v] of [player v]) / (1.02))\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Piks Button\n\nwhen flag clicked\nhide\n\ndefine Sense <touching?> <clicked?>\nif <touching?> then\n    change [brightness v] effect by (((60) - (size)) * (0.2))\n    change size by (((60) - (size)) * (0.2))\n    if <clicked?> then\n        broadcast (Flash v)\n        broadcast (NL v)\n        change [level v] by (1)\n        wait (.2) seconds\n    end\nelse\n    change [brightness v] effect by (((50) - (size)) * (0.2))\n    change size by (((50) - (size)) * (0.2))\nend\n\nwhen I receive [green flag v]\nshow\nforever\n    go to x: (200) y: (-160)\n    if <(Level) = [8]> then\n        hide\n        Sense <> <>\n    else\n        repeat until <(Level) = [8]>\n            show\n            Sense <touching (mouse-pointer v)?> <mouse down?>\n            Dir Control [1000] [3] (timer) [90]\n        end\n    end\nend\n\ndefine Dir Control (d in) (d out) (d timer) (d return)\npoint in direction ((([sin v] of ((d timer) * (d in)) ) * (d out)) + (d return))\n\n@Flash\n\nwhen flag clicked\nset size to (100) %\ngo to x: (0) y: (0)\nhide\n\ndefine Flash (flash in) (repeat flash in) (secs between f) (flash set back)\nset [ghost v] effect to (0)\nshow\nwait (secs between f) seconds\nrepeat (repeat flash in)\n    change [ghost v] effect by (flash in)\nend\nwait (secs between f) seconds\nset [ghost v] effect to (flash set back)\nbroadcast (NL v)\n\nwhen I receive [flash v]\nFlash [25] [15] [0.1] [100]\n\n@Help\n\nwhen I receive [green flag v]\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-25)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (25)\nend\nhide\n\nwhen flag clicked\nhide\n\n@Advance\n\nwhen flag clicked\nhide\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\n    go [backward v] (1) layers\nend\n\nwhen I receive [green flag v]\nshow\n\n@Bounce\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\n    go [backward v] (1) layers\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@TN\n\nwhen flag clicked\nhide\n\n@Level Shadows\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\n@Player Shadow\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag v]\nshow\n\ngo to [back v] layer\n\n@Death Flash\n\nwhen flag clicked\nset size to (100) %\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [death flash v]\nif <(Intro?) = [0]> then\n    Flash [25] [15] [0.1] [100]\nelse\n    hide\nend\n\ndefine Flash (flash in) (repeat flash in) (secs between f) (flash set back)\nset [ghost v] effect to (0)\nshow\nwait (secs between f) seconds\nrepeat (repeat flash in)\n    change [ghost v] effect by (flash in)\nend\nwait (secs between f) seconds\nset [ghost v] effect to (flash set back)\n\n@Intro\n\nwhen flag clicked\nstart sound [Intro Sound v]\nPlay intro: Come in (fade and glide in \(from bottom\)) Wait [1.1] Seconds: Come out (spin out)\nbroadcast (green flag v)\n\ndefine clean up\nclear graphic effects\nshow\ngo to x: (0) y: (0)\nset size to (100) %\n\ndefine spin in\nset size to (0) %\npoint in direction (0)\nset [ghost v] effect to (100)\nrepeat (10)\n    turn right ((3.45) - ((direction) * (-0.2))) degrees\n    change size by ((22) - ((size) / (5)))\n    change [ghost v] effect by (-10)\nend\npoint in direction (90)\n\ndefine fade in and glide in (from left)\nshow\nset [ghost v] effect to (100)\ngo to x: (-180) y: (0)\nrepeat (9)\n    change x by ((5) - ((x position) * (0.2)))\n    change [ghost v] effect by (-10)\n    wait (0.03) seconds\nend\ngo to x: (0) y: (0)\n\ndefine fade in and glide in (from bottom)\nshow\nset [ghost v] effect to (100)\ngo to x: (0) y: (-190)\nrepeat (10)\n    change y by ((5) - ((y position) * (0.2)))\n    change [ghost v] effect by (-10)\n    wait (0.03) seconds\nend\n\ndefine big then small\nset [xonic size v] to [0]\nwait (0.4) seconds\nrepeat (10)\n    change [xonic size v] by (1)\n    change size by (xonic size)\nend\nset [xonic size v] to [0]\nrepeat (8)\n    change [xonic size v] by (-5)\n    change [ghost v] effect by (10)\n    change size by (xonic size)\nend\nhide\n\ndefine spin out\nrepeat (10)\n    turn right ((3.45) - ((direction) * (0.2))) degrees\n    change size by ((-2) - ((size) / (5)))\n    change [ghost v] effect by (10)\nend\nhide\npoint in direction (90)\n\ndefine fade in and glide in (from right)\nshow\nset [ghost v] effect to (100)\ngo to x: (180) y: (0)\nrepeat (9)\n    change x by ((-5) - ((x position) * (0.2)))\n    change [ghost v] effect by (-10)\n    wait (0.03) seconds\nend\ngo to x: (0) y: (0)\n\ndefine grow in\nshow\nset [ghost v] effect to (100)\nset size to (0) %\nrepeat (10)\n    change size by ((22) - ((size) / (5)))\n    change [ghost v] effect by (-10)\nend\nset size to (100) %\n\ndefine fade in and glide in (from top)\nshow\nset [ghost v] effect to (100)\ngo to x: (0) y: (190)\nrepeat (10)\n    change y by ((-5) - ((y position) * (0.2)))\n    change [ghost v] effect by (-10)\n    wait (0.03) seconds\nend\n\ndefine Play intro: Come in (come in) Wait (seconds) Seconds: Come out (come out)\nclean up\nset [come out v] to (come out)\nset [come in v] to (come in)\nif <(come in) = [1]> then\n    fade in and glide in (from top)\nend\nif <(come in) = [2]> then\n    fade in and glide in (from bottom)\nend\nif <(come in) = [3]> then\n    fade in and glide in (from left)\nend\nif <(come in) = [4]> then\n    fade in and glide in (from right)\nend\nif <(come in) = [5]> then\n    shrink in\nend\nif <(come in) = [6]> then\n    grow in\nend\nif <(come in) = [7]> then\n    spin in\nend\nif <(come in) = [8]> then\n    fade, glide and grow\nend\nif <(come in) = [9]> then\nwait (seconds) seconds\nif <(come out) = [6]> then\n    small fade\nend\nif <(come out) = [7]> then\n    up and down\nend\nif <(come out) = [8]> then\n    big then small\nend\nif <(come out) = [9]> then\n    spin out\nend\n\ndefine fade, glide and grow\ngo to x: (0) y: (-180)\nset size to (1) %\nset [ghost v] effect to (100)\nrepeat (25)\n    change y by (((0) - (y position)) * (0.25))\n    change size by (((100) - (size)) * (0.25))\n    change [ghost v] effect by (-10)\nend\n\ndefine small fade\nrepeat (10)\n    change y by ((-5) - ((y position) * (0.2)))\n    change [ghost v] effect by (10)\n    wait (0.03) seconds\nend\n\ndefine up and down\nrepeat (10)\n    change y by ((5) - ((y position) * (0.2)))\n    change [ghost v] effect by (2.5)\nend\nrepeat (30)\n    change y by (((5) - ((y position) * (0.2))) * (-1))\n    change [ghost v] effect by (3)\nend\n\ndefine shrink in\ngo to x: (0) y: (0)\nset size to (175) %\nset [ghost v] effect to (100)\nrepeat (50)\n    change size by (((100) - (size)) * (0.25))\n    change [ghost v] effect by (-5)\nend\n\n