- Hidden World - A Platformer


@Stage\n\nwhen flag clicked\nforever\n    if <(level) < [12]> then\n        switch backdrop to (backdrop1 v)\n    else\n        switch backdrop to (backdrop2 v)\n    end\nend\n\n@rendering\n\nwhen flag clicked\nset [previous level v] to [0]\ngo to x: (0) y: (0)\nset [level v] to [1]\nforever\n    switch costume to (level)\nend\n\nwhen I receive [switch level v]\nif <(level) > [0]> then\n    set [previous level v] to (level)\nend\nchange [level v] by (1)\n\nwhen I receive [switch previous level v]\nif <(level) > [1]> then\n    set [previous level v] to (level)\nend\nchange [level v] by (-1)\n\n@background\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nforever\n    switch costume to (level)\nend\n\n@tiny bloops\n\nwhen flag clicked\npoint in direction (90)\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [bloops v] to [0]\nset [stable? v] to [0]\nset [cloneid bloop v] to [0]\nrepeat (7)\n    change [cloneid bloop v] by (1)\n    create clone of (_myself_ v)\n    wait (0) seconds\nend\n\nwhen I start as a clone\nif <(CloneID bloop) = [1]> then\n    forever\n        go to x: (-58) y: (-75)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [2]> then\n    forever\n        go to x: (-13) y: (-65)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [3]> then\n    forever\n        go to x: (25) y: (-75)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [4]> then\n    forever\n        go to x: (67) y: (-65)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [5]> then\n    forever\n        go to x: (118) y: (-63)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [6]> then\n    forever\n        go to x: (160) y: (-65)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\nif <(CloneID bloop) = [7]> then\n    forever\n        go to x: (202) y: (-75)\n        show?\n        if <touching (player v)?> then\n            set [stable? v] to [1]\n        end\n        movement check\n    end\nend\n\ndefine movement\nset [y v] to [0]\nset [x v] to [0]\nshow\nif <(pick random (1) to (10)) > [5]> then\n    set [bloops v] to [1]\nelse\n    set [bloops v] to [2]\nend\nrepeat until <touching (rendering v)?>\n    change [y v] by (-1)\n    change y by (y)\nend\nif <touching (rendering v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nforever\n    if <(bloops) = [1]> then\n        change [x v] by (1)\n        turn right (5) degrees\n    end\n    if <(bloops) = [2]> then\n        change [x v] by (-1)\n        turn right (-5) degrees\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (rendering v)?> then\n        change y by (1)\n        if <touching (rendering v)?> then\n            change y by (1)\n            if <touching (rendering v)?> then\n                change y by (1)\n                if <touching (rendering v)?> then\n                    change y by (1)\n                    if <touching (rendering v)?> then\n                        change x by ((x) * (-1))\n                        change y by (-4)\n                        if <(x) > [0]> then\n                            set [x v] to [-5]\n                        else\n                            set [x v] to [5]\n                        end\n                        set [y v] to [0]\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (y)\n    if <touching (rendering v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    change y by (1)\n    if <touching (_edge_ v)?> then\n        hide\n        delete this clone\n    end\n    if <not <(level) = [10]>> then\n        hide\n        delete this clone\n    end\nend\n\ndefine show?\nif <(stable?) = [0]> then\n    if <(level) = [10]> then\n        show\n    else\n        hide\n    end\nend\n\nset [y v] to [10]\n\nset [level v] to [10]\n\ndefine movement check\nif <(stable?) = [0]> then\n\nrepeat until <<touching (_edge_ v)?> or <not <(level) = [10]>>>\n\n@hitbox\n\nwhen I receive [next level v]\nset [y v] to [0]\ngo to x: (-230) y: (-110)\n\nwhen I receive [previous level spawn v]\nset [y v] to [0]\ngo to x: (230) y: (-110)\n\nchange [ghost v] effect by (25)\nchange [color v] effect by (25)\n\nwhen I receive [death spawn v]\nset [y v] to [0]\nif <(level) > (previous level)> then\n    go to x: (-230) y: (-110)\nend\nif <(previous level) > (level)> then\n    go to x: (230) y: (-110)\nend\n\nset [y v] to [0]\n\nwhen flag clicked\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (-200) y: (-50)\nshow\nset [ghost v] effect to (100)\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (4)\n        set [left/right. v] to [2]\n    else\n        if <not <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>>> then\n            set [left/right. v] to [0]\n        end\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n        change [x v] by (-4)\n        set [left/right. v] to [1]\n    else\n        if <not <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n            set [left/right. v] to [0]\n        end\n    end\n    if <<<<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <<key (left arrow v) pressed?> or <key (a v) pressed?>>> or <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <<mouse down?> and <(x position) > (mouse x)>>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <<mouse down?> and <(mouse x) > (x position)>>>> then\n        set [left/right. v] to [0]\n    end\n    set [x v] to ((X) * (0.5))\n    change x by (X)\n    if <touching (rendering v)?> then\n        change y by (1)\n        if <touching (rendering v)?> then\n            change y by (1)\n            if <touching (rendering v)?> then\n                change y by (1)\n                if <touching (rendering v)?> then\n                    change y by (1)\n                    if <touching (rendering v)?> then\n                        change x by ((X) * (-1))\n                        change y by (-4)\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (Y)\n    if <touching (rendering v)?> then\n        change y by ((Y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching (rendering v)?> then\n        if <<<<key (up arrow v) pressed?> or <key (space v) pressed?>> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y v] to [10]\n        end\n    end\n    change y by (1)\n    if <(x position) > [235]> then\n        if <not <(level) = [12]>> then\n            broadcast (prepare next level v) and wait\n        end\n    end\n    if <[-238] > (x position)> then\n        if <(level) > [1]> then\n            broadcast (previous level v) and wait\n        end\n    end\n    if <[-180] > (y position)> then\n        broadcast (death v) and wait\n    end\n    if <touching (death v)?> then\n        broadcast (death v) and wait\n    end\nend\n\n@player\n\nwhen flag clicked\nset [left/right. v] to [2]\nset rotation style [left-right v]\nforever\n    go to (hitbox v)\n    if <(left/right.) = [1]> then\n        point in direction (-90)\n        switch costume to (costume2 v)\n        repeat until <not <(left/right.) = [1]>>\n            next costume\n            next costume\n            next costume\n            wait (0) seconds\n        end\n    end\n    if <(left/right.) = [2]> then\n        point in direction (90)\n        switch costume to (costume2 v)\n        repeat until <not <(left/right.) = [2]>>\n            next costume\n            next costume\n            next costume\n            wait (0) seconds\n        end\n    end\n    if <(left/right.) = [0]> then\n        switch costume to (costume2 v)\n    end\nend\n\nrepeat until <<<not <key (left arrow v) pressed?>> and <not <key (a v) pressed?>>> or <<mouse down?> and <(mouse x) > (x position)>>>\n    if <<<not <key (right arrow v) pressed?>> and <not <key (d v) pressed?>>> and <<mouse down?> and <(x position) > (mouse x)>>> then\n    else\n    end\nend\n\nwhen flag clicked\nforever\n    go to (hitbox v)\nend\n\nrepeat until <<not <key (right arrow v) pressed?>> and <not <key (d v) pressed?>>>\n    if <<not <key (left arrow v) pressed?>> and <not <key (a v) pressed?>>> then\n        next costume\n        next costume\n        next costume\n        wait (0) seconds\n    else\n        switch costume to (costume2 v)\n    end\nend\nswitch costume to (costume2 v)\n\nwhen I receive [death v]\nif <(death) = [0]> then\n    set [death v] to [1]\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    wait (0) seconds\n    broadcast (death spawn v)\n    wait (.1) seconds\n    repeat (10)\n        change [ghost v] effect by (-10)\n        change [brightness v] effect by (-10)\n    end\nelse\nend\n\nwhen flag clicked\nset [death v] to [0]\n\nwhen I receive [death spawn v]\nset [death v] to [0]\n\n@next level\n\nwhen I receive [prepare next level v]\ngo to [front v] layer\nshow\ngo to x: (0) y: (0)\nrepeat (11)\n    change x by (75)\nend\nbroadcast (switch level v)\nbroadcast (next level v)\nrepeat (7)\n    change x by (-75)\nend\nhide\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [previous level v]\ngo to [front v] layer\nshow\ngo to x: (0) y: (0)\nrepeat (11)\n    change x by (75)\nend\nbroadcast (switch previous level v)\nbroadcast (previous level spawn v)\nrepeat (7)\n    change x by (-75)\nend\nhide\n\n@ball droppy thingy\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\nset [lvl 2 drop v] to [0]\nforever\n    if <(level) = [2]> then\n        show\n        if <touching (hitbox v)?> then\n            if <(lvl 2 drop) = [0]> then\n                set [lvl 2 drop v] to [1]\n                change y by (2)\n                wait (0) seconds\n                change y by (3)\n                broadcast (spider burst v)\n                wait (0) seconds\n                change y by (-2)\n                wait (0) seconds\n                change y by (-3)\n                wait (0) seconds\n                change y by (-4)\n                wait (0) seconds\n                change y by (-5)\n                wait (0) seconds\n                change y by (-6)\n                wait (0) seconds\n                change y by (-7)\n                wait (0) seconds\n                change y by (-8)\n                wait (0) seconds\n                change y by (-9)\n                wait (0) seconds\n                change y by (-10)\n                repeat (5)\n                    change y by (-10)\n                end\n            end\n        end\n    else\n        hide\n    end\nend\n\nchange y by (5)\nchange y by (5)\nwait (0) seconds\nchange y by (5)\nwait (0) seconds\n\n@insect thingy \n\nwhen flag clicked\ngo to x: (12) y: (0)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nforever\n    if <(level) = [3]> then\n        show\n        if <[100] > (distance to [player v])> then\n            change y by (1)\n        end\n    else\n        hide\n    end\nend\n\nwait (0) seconds\n\n@insect thingy 2\n\nwhen flag clicked\ngo to x: (72) y: (-46)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nforever\n    if <(level) = [4]> then\n        show\n        if <[50] > (distance to [player v])> then\n            hide\n            broadcast (explode v) and wait\n            forever\n                hide\n            end\n        end\n    else\n        hide\n    end\nend\n\nwait (0) seconds\n\nforever\nend\n\n@smoke exploding effect\n\nwhen flag clicked\nset [explode v] to [0]\nhide\ngo to [front v] layer\n\nwhen I start as a clone\nswitch costume to (pick random (1) to (2))\nset size to (10) %\nshow\nclear graphic effects\nset [brightness v] effect to (-50)\ngo to x: (70) y: (-45)\npoint in direction (pick random (0) to (360))\nrepeat (5)\n    go to [front v] layer\n    turn right (pick random (-15) to (15)) degrees\n    move (4) steps\n    change size by (-2)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [explode v]\nif <(explode) = [0]> then\n    set [explode v] to [1]\n    set size to (10) %\n    repeat (10)\n        create clone of (_myself_ v)\n    end\nend\n\n@insect thingy 3\n\nwhen flag clicked\ngo to x: (-49) y: (0)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nforever\n    if <(level) = [4]> then\n        show\n        set y to ((((distance to [player v]) / (5)) * (-1)) + (50))\n    else\n        hide\n    end\nend\n\nwait (0) seconds\n\nchange y by (10)\n\n@ignore\n\nset [movement_mobile v] to [0]\n\ndefine resize_left\nrepeat until <touching (_edge_ v)?>\n    change x by (-1)\nend\nchange x by (1)\nrepeat until <touching (_edge_ v)?>\n    change y by (-1)\nend\nchange x by (-1)\n\ndefine resize_right\nrepeat until <touching (_edge_ v)?>\n    change x by (1)\nend\nchange x by (-1)\nrepeat until <touching (_edge_ v)?>\n    change y by (-1)\nend\nchange x by (1)\n\nwhen flag clicked\n\nset [clone_id v] to [0]\ngo to x: (0) y: (0)\nset [ghost v] effect to (70)\nhide\ngo to [front v] layer\nrepeat (2)\n    change [clone_id v] by (1)\n    create clone of (_myself_ v)\nend\n\nresize_left\n\nresize_right\n\nwhen I start as a clone\ngo to x: (0) y: (0)\nshow\nif <(clone_id) = [1]> then\n    forever\n        if <(mobile_user.) = [1]> then\n            switch costume to (left - jump v)\n            go to x: (0) y: (0)\n        else\n            if <(mobile_user.) = [2]> then\n                switch costume to (left -no_jump v)\n                go to x: (0) y: (0)\n            else\n                if <(mobile_user.) = [3]> then\n                    switch costume to (left - jump v)\n                    go to x: (0) y: (0)\n                end\n            end\n        end\n        set size to (size) %\n        resize_left\n    end\nend\nif <(clone_id) = [2]> then\n    forever\n        if <(mobile_user.) = [1]> then\n            switch costume to (right -no_jump v)\n            go to x: (0) y: (0)\n        else\n            if <(mobile_user.) = [2]> then\n                switch costume to (right -jump v)\n                go to x: (0) y: (0)\n            else\n                if <(mobile_user.) = [3]> then\n                    switch costume to (right -jump v)\n                    go to x: (0) y: (0)\n                end\n            end\n        end\n        set size to (size) %\n        resize_right\n    end\nend\n\nwhen flag clicked\n\nforever\n    if <key (1 v) pressed?> then\n        set [mobile_user. v] to [1]\n    else\n        if <key (2 v) pressed?> then\n            set [mobile_user. v] to [2]\n        else\n            if <key (3 v) pressed?> then\n                set [mobile_user. v] to [3]\n            end\n        end\n    end\nend\n\nchange size by (-1)\n\nchange size by (-1)\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\n\nforever\n    show\n    if <(mobile_user.) = [1]> then\n        switch costume to (left - jump v)\n        go to x: (0) y: (0)\n    else\n        if <(mobile_user.) = [2]> then\n            switch costume to (left -no_jump v)\n            go to x: (0) y: (0)\n        else\n            if <(mobile_user.) = [3]> then\n                switch costume to (left - jump v)\n                go to x: (0) y: (0)\n            end\n        end\n    end\n    set size to (size) %\n    resize_left\nend\n\nhide\n\nwhen flag clicked\nhide\n\nforever\n    if <<(x position) > ((mouse x) + ((10) + (((x position) * (1)) / (20))))> and <(y position) > ((mouse y) + ((-23) + (((y position) * (-1)) / (20))))>> then\n        if <<(x position) > ((mouse x) + ((10) + (((x position) * (1)) / (20))))> and <((mouse y) + ((50) + (((y position) * (1)) / (20)))) > (y position)>> then\n            set [mobile_movments_#_ v] to [1]\n        else\n            set [mobile_movments_#_ v] to [0]\n        end\n    else\n        set [mobile_movments_#_ v] to [0]\n    end\nend\n\n@ignore2\n\nwhen flag clicked\nhide\n\n@platformer engine\n\nwhen flag clicked\nhide\n\nset [spider v] to [0]\n\ndefine spider burst\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (0) y: (0)\nshow\nforever\n    if <(pick random (1) to (10)) > [5]> then\n        set [spider v] to [1]\n    else\n        set [spider v] to [2]\n    end\n    if <(pick random (1) to (10)) > [9]> then\n        set [spider v] to [3]\n    end\n    if <(spider) = [1]> then\n        change [x v] by (2)\n    end\n    if <(spider) = [2]> then\n        change [x v] by (-2)\n    end\n    set [x v] to ((X) * (0.9))\n    change x by (X)\n    if <touching (rendering v)?> then\n        change y by (1)\n        if <touching (rendering v)?> then\n            change y by (1)\n            if <touching (rendering v)?> then\n                change y by (1)\n                if <touching (rendering v)?> then\n                    change y by (1)\n                    if <touching (rendering v)?> then\n                        change x by ((X) * (-1))\n                        change y by (-4)\n                        if <(spider) = [3]> then\n                            if <(X) > [0]> then\n                                set [x v] to [-5]\n                            else\n                                set [x v] to [5]\n                            end\n                            set [y v] to [10]\n                        else\n                            set [y v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (Y)\n    if <touching (rendering v)?> then\n        change y by ((Y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching (rendering v)?> then\n        if <(spider) = [3]> then\n            set [y v] to [10]\n        end\n    end\n    change y by (1)\n    if <touching (_edge_ v)?> then\n        hide\n        delete this clone\n    end\n    if <not <(level) = [2]>> then\n        hide\n        delete this clone\n    end\nend\n\nwhen I receive [spider burst v]\nspider burst\n\n@Sprite3\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\ngo to [back v] layer\nforever\n    if <(level) = [11]> then\n        show\n    else\n        hide\n    end\nend\n\n@end scene\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\ngo to [back v] layer\nforever\n    if <(level) = [12]> then\n        show\n    else\n        hide\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (-100)\nset size to (1000) %\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@song\n\nwhen flag clicked\nforever\n    play sound [Lavender Town \(Original Japanese Version from Pokemon Red and Green\) v] until done\nend\n\n@death\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (3) layers\nshow\nforever\n    switch costume to (level)\nend\n\n