Thank You, Teachers - A Platformer


@Stage\n\nwhen flag clicked\nforever\n    if <[3] > (level)> then\n        switch backdrop to (grey v)\n    else\n        switch backdrop to (rainbowww v)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [Jessie J - Flashlight \(Lyrics\).mp3 v] until done\nend\n\n@Character\n\nwhen flag clicked\npoint in direction (90)\ngo to [front v] layer\nset [level v] to [1]\ngo to x: (-180) y: (80)\nset [xv v] to [0]\nset [yv v] to [0]\n\ndefine Controls Mode\nif <key (left arrow v) pressed?> then\n    switch costume to (run_1 v)\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    switch costume to (run_1 v)\n    change [xv v] by (1)\nend\nset [xv v] to ((xv) * (0.85))\nchange x by (xv)\nif <touching (ground v)?> then\n    change y by (-2)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (-5)\n                            change x by ((-1) * (xv))\n                            if <<key (up arrow v) pressed?> and <not <(xv) = [0]>>> then\n                                set [mode v] to [walljump]\n                                set [yv v] to [8]\n                                set [xv v] to (((xv) / ([abs v] of (xv) )) * (-10))\n                            else\n                                set [mode v] to [wallslide]\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (2)\nend\nchange y by (-3)\nif <touching (ground v)?> then\n    if <(yv) = [-3]> then\n        if <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> then\n            set [mode v] to [run]\n        else\n            if <([abs v] of (xv) ) > [.1]> then\n                set [mode v] to [skid]\n            else\n                set [mode v] to [stand]\n            end\n        end\n    end\n    if <key (up arrow v) pressed?> then\n        set [mode v] to [jump]\n        set [yv v] to [7]\n    end\nend\nif <<<<(mode) = [jump]> or <(mode) = [walljump]>> and <(yv) < [0]>> or <<<(mode) = [run]> or <(mode) = [skid]>> and <(yv) < [-3]>>> then\n    set [mode v] to [fall]\nend\nchange y by (5)\nif <(yv) > [-15]> then\n    change [yv v] by (-0.5)\nend\nchange y by (-2)\nif <not <touching (ground v)?>> then\n    change y by (-1)\n    if <not <touching (ground v)?>> then\n        change y by (-1)\n        if <not <touching (ground v)?>> then\n            change y by (-1)\n            if <not <touching (ground v)?>> then\n                change y by (-1)\n                if <not <touching (ground v)?>> then\n                    change y by (-1)\n                    if <not <touching (ground v)?>> then\n                        change y by (5)\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (2)\nchange y by (yv)\nif <touching (ground v)?> then\n    change y by (-2)\n    if <touching (ground v)?> then\n        change y by ((-1) * (yv))\n        set [yv v] to [-3]\n    end\n    change y by (2)\nend\n\ndefine Reset Mode\nif <<(y position) < [-170]> or <touching (obstacle v)?>> then\n    go to x: (-180) y: (80)\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\nif <touching (portal v)?> then\n    go to x: (-180) y: (80)\n    set [xv v] to [0]\n    set [yv v] to [0]\n    change [level v] by (1)\n    broadcast (Next lvl v)\nend\nif <touching (door v)?> then\n    go to x: (-180) y: (80)\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\n\ndefine Costumes_set\nif <(mode) = [fall]> then\n    switch costume to (fall v)\nend\nif <(mode) = [walljump]> then\n    switch costume to (walljump v)\nend\nif <(mode) = [wallslide]> then\n    switch costume to (wallslide v)\nend\nif <(mode) = [jump]> then\n    switch costume to (jump v)\nend\nif <(mode) = [stand]> then\n    switch costume to (stand v)\nend\nif <(mode) = [run]> then\n    if <key (right arrow v) pressed?> then\n        switch costume to (run_1 v)\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to (run_1 v)\n    end\nend\nif <key (right arrow v) pressed?> then\n    point in direction (90)\nend\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\nend\n\ndefine Platform_Sensing\nif <<touching (platforms v)?> and <key (down arrow v) pressed?>> then\n    repeat until <<touching (platforms v)?> or <<touching (ground v)?> or <(y position) < [-170]>>>\n        change [yv v] by (-3)\n    end\nend\n\nwhen flag clicked\nforever\n    Controls Mode\nend\n\nwhen flag clicked\nforever\n    Costumes_set\nend\n\nwhen flag clicked\nforever\n    Platform_Sensing\nend\n\nwhen flag clicked\nforever\n    Reset Mode\nend\n\nwhen flag clicked\nforever\n    wait (0.00001) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(level) < [3]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume2 v)\nend\nrepeat (25)\n    change [ghost v] effect by (4)\n    change size by (-3)\nend\ndelete this clone\n\nwhen I start as a clone\nif <(level) < [3]> then\n    change [color v] effect by (0)\nelse\n    forever\n        change [color v] effect by (10)\n    end\nend\n\ndefine Bounce Effect\nif <touching (spring v)?> then\n    set [yv v] to [12]\nend\n\nwhen flag clicked\nforever\n    Bounce Effect\nend\n\ndefine Speed Effect\nif <touching (you-can v)?> then\n    set [xv v] to ((xv) * (2))\nend\n\nwhen flag clicked\nforever\n    Speed Effect\nend\n\ndefine Key-Door_Sensing\nif <touching (key v)?> then\n    broadcast (Touched v)\n    wait until <not <touching (key v)?>>\nend\n\nwhen flag clicked\nforever\n    Key-Door_Sensing\nend\n\ndefine Ladder_Sensing\nif <<touching (ladder v)?> and <key (up arrow v) pressed?>> then\n    change [yv v] by (0.4)\nend\n\nwhen flag clicked\nforever\n    Ladder_Sensing\nend\n\n@Ground\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Obstacle\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Platforms\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Text\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Portal\n\nwhen flag clicked\nshow\nset size to (100) %\ngo to x: (190) y: (-110)\nforever\n    glide (1) secs to x: (x position) y: ((y position) + (20))\n    glide (1) secs to x: (x position) y: ((y position) - (20))\nend\n\nwhen I start as a clone\nif <(level) < [3]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume2 v)\nend\nrepeat (25)\n    change size by (-2)\n    change [ghost v] effect by (4)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    wait (0.001) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(level) < [3]> then\n    change [color v] effect by (0)\nelse\n    forever\n        change [color v] effect by (10)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) < [3]> 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 <(level) = [14]> then\n        hide\n    else\n        show\n    end\nend\n\n@Spring\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@You-Can\n\nwhen flag clicked\nshow\nforever\n    switch costume to (level)\nend\n\n@Door\n\nwhen I receive [touched v]\nstart sound [Collect v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [next lvl v]\nclear graphic effects\nif <(level) = [10]> then\n    show\nend\nif <(level) = [12]> then\n    show\nend\n\nwhen flag clicked\nshow\nforever\n    switch costume to (level)\nend\n\n@Key\n\nwhen I receive [touched v]\nrepeat (10)\n    change [color v] effect by (25)\nend\nhide\n\nwhen I receive [next lvl v]\nclear graphic effects\nif <(level) = [10]> then\n    show\nend\nif <(level) = [12]> then\n    show\nend\n\nwhen flag clicked\nshow\nforever\n    switch costume to (level)\nend\n\n@Ladder\n\nwhen flag clicked\ngo to x: (-31) y: (9)\nhide\nforever\n    if <(level) = [11]> then\n        show\n    else\n        hide\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    go to x: (0) y: (0)\n    show\n    set [ghost v] effect to (100)\nend\n\n