NinjaRun™ A Platformer
@Stage\n\nwhen flag clicked\nforever\n    if <(sound?) = [1]> then\n        play sound [3d v] until done\n        wait (2) seconds\n    end\nend\n\n@blank\n\n@blank2\n\n@all\n\ndefine Tri Fill (x1) (y1) (x2) (y2) (x3) (y3) (outline)\nset [_tri2 v] to ([sqrt v] of ((((x2) - (x3)) * ((x2) - (x3))) + (((y2) - (y3)) * ((y2) - (y3)))) )\nset [_tri3 v] to ([sqrt v] of ((((x1) - (x3)) * ((x1) - (x3))) + (((y1) - (y3)) * ((y1) - (y3)))) )\nset [_tri4 v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\nset [_tri1 v] to (((_tri2) + ((_tri3) + (_tri4))) / (2))\nset [_tri0 v] to ((2) * ([sqrt v] of ((((_tri1) - (_tri2)) * (((_tri1) - (_tri3)) * ((_tri1) - (_tri4)))) / (_tri1)) ))\nchange [_tri1 v] by (_tri1)\ngo to x: (((((_tri2) * (x1)) + ((_tri3) * (x2))) + ((_tri4) * (x3))) / (_tri1)) y: (((((_tri2) * (y1)) + ((_tri3) * (y2))) + ((_tri4) * (y3))) / (_tri1))\nset pen size to (_tri0)\npen down\nif <(_tri0) > [0]> then\n    if <<(_tri3) < (_tri2)> or <(_tri4) < (_tri2)>> then\n        if <<(_tri2) < (_tri3)> or <(_tri4) < (_tri3)>> then\n            set [_tri1 v] to ((x position) - (x3))\n            set [_tri2 v] to ((y position) - (y3))\n        else\n            set [_tri1 v] to ((x position) - (x2))\n            set [_tri2 v] to ((y position) - (y2))\n        end\n    else\n        set [_tri1 v] to ((x position) - (x1))\n        set [_tri2 v] to ((y position) - (y1))\n    end\n    set [_tri1 v] to (([sqrt v] of (((_tri1) * (_tri1)) + ((_tri2) * (_tri2))) ) / ((_tri0) / (2)))\n    set [_tri1 v] to ((0.5) - ((0.5) / (_tri1)))\n    set [_tri2 v] to (((x position) - (x1)) / (_tri0))\n    set [_tri3 v] to (((y position) - (y1)) / (_tri0))\n    set [_tri4 v] to (((x position) - (x2)) / (_tri0))\n    set [_tri5 v] to (((y position) - (y2)) / (_tri0))\n    set [_tri6 v] to (((x position) - (x3)) / (_tri0))\n    set [_tri7 v] to (((y position) - (y3)) / (_tri0))\n    repeat ([floor v] of (([log v] of ((1) / (_tri0)) ) / ([log v] of (_tri1) )) )\n        set [_tri0 v] to ((_tri1) * (_tri0))\n        set pen size to ((_tri0) + (.5))\n        go to x: ((x1) + ((_tri0) * (_tri2))) y: ((y1) + ((_tri0) * (_tri3)))\n        go to x: ((x2) + ((_tri0) * (_tri4))) y: ((y2) + ((_tri0) * (_tri5)))\n        go to x: ((x3) + ((_tri0) * (_tri6))) y: ((y3) + ((_tri0) * (_tri7)))\n        go to x: ((x1) + ((_tri0) * (_tri2))) y: ((y1) + ((_tri0) * (_tri3)))\n    end\nend\nset pen size to (outline)\ngo to x: (x1) y: (y1)\ngo to x: (x2) y: (y2)\ngo to x: (x3) y: (y3)\ngo to x: (x1) y: (y1)\npen up\n\ndefine calculate tri.\nset [sin x v] to ([sin v] of (ROT X) )\nset [cos x v] to ([cos v] of (ROT X) )\nset [sin y v] to ([sin v] of (ROT Y) )\nset [cos y v] to ([cos v] of (ROT Y) )\n\ndefine xyz SetUp (x) (y) (z)\npunto 3 ((x) - (_CAM X)) ((y) - (_CAM Y)) ((z) - (_CAM Z))\npunto 3 (((x3) * (Cos Y)) + ((z3) * (Sin Y))) (y3) (((z3) * (Cos Y)) - ((x3) * (Sin Y)))\npunto 3 (x3) (((y3) * (Cos X)) - ((z3) * (Sin X))) (((y3) * (Sin X)) + ((z3) * (Cos X)))\n\ndefine punto 3 (x) (y) (z)\nset [x3 v] to (x)\nset [y3 v] to (y)\nset [z3 v] to (z)\n\ndefine fill 3D tri (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) res (res) brillo (brillo)\nxyz SetUp (x1) (y1) (z1)\nset [x1 v] to (x3)\nset [y1 v] to (y3)\nset [z1 v] to (z3)\nxyz SetUp (x2) (y2) (z2)\nset [x2 v] to (x3)\nset [y2 v] to (y3)\nset [z2 v] to (z3)\nxyz SetUp (x3) (y3) (z3)\nif <not <<(z1) < (plano cercano)> and <<(z2) < (plano cercano)> and <(z3) < (plano cercano)>>>> then\n    set pen (brightness v) to ((100) - (brillo))\n    if <(z1) < (plano cercano)> then\n        set [z1 v] to (plano cercano)\n    end\n    if <(z2) < (plano cercano)> then\n        set [z2 v] to (plano cercano)\n    end\n    if <(z3) < (plano cercano)> then\n        set [z3 v] to (plano cercano)\n    end\n    set [-1 v] to ((TAMAÑO) * ((1) / (z1)))\n    set [-2 v] to ((TAMAÑO) * ((1) / (z2)))\n    set [-3 v] to ((TAMAÑO) * ((1) / (z3)))\n    if <is compiled?> then\n        Tri Fill ((x1) * (-1)) ((y1) * (-1)) ((x2) * (-2)) ((y2) * (-2)) ((x3) * (-3)) ((y3) * (-3)) [1]\n    else\n        Tri Fill ((x1) * (-1)) ((y1) * (-1)) ((x2) * (-2)) ((y2) * (-2)) ((x3) * (-3)) ((y3) * (-3)) (res)\n    end\nend\n\nwhen flag clicked\nreset timer\nhide\nset [level v] to [#]\nset [_cam x v] to [50]\nset [_cam y v] to [100]\nset [_cam z v] to [0]\nset [tamaño v] to [300]\nset [plano cercano v] to [120]\nset [_player x v] to [0]\nset [_player y v] to [0]\nset [_player z v] to [0]\nset [y.vel v] to [0]\nset [rot x v] to [-35]\nset [rot y v] to [0]\nset [fps_2 v] to [0]\nset [pso v] to [50]\nforever\n    if <(can move?) = [1]> then\n        erase all\n        tic\n        change [fps_2 v] by (1)\n    end\nend\n\ndefine cam\nchange [rot x v] by ((5) * (<key (up arrow v) pressed?> - <key (down arrow v) pressed?>))\nchange [rot y v] by ((5) * (<key (left arrow v) pressed?> - <key (right arrow v) pressed?>))\nif <(ROT X) < [-90]> then\n    set [rot x v] to [-90]\nend\nif <[0] < (ROT X)> then\n    set [rot x v] to [0]\nend\nset [_cam x v] to ((_player x) + ((400) * ((Sin Y) * (Cos X))))\nset [_cam y v] to ((_player y) + ((-400) * (Sin X)))\nset [_cam z v] to ((_player z) + ((-400) * ((Cos Y) * (Cos X))))\n\ndefine delete from lists\ndelete all of [@x v]\ndelete all of [@y v]\ndelete all of [@z v]\ndelete all of [@colors v]\ndelete all of [@brightness v]\ndelete all of [@negro v]\ndelete all of [@x_sorting v]\ndelete all of [@y_sorting v]\ndelete all of [@z_sorting v]\ndelete all of [_collisions v]\ndelete all of [_lava v]\ndelete all of [_bounce v]\ndelete all of [__move v]\ndelete all of [__moving platforms v]\ndelete all of [_end v]\ndelete all of [_signs v]\ndelete all of [%enemies v]\nset [--mpc v] to [0]\n\ndefine create world\nif <(level) = [#]> then\n    set [_player x v] to [0]\n    set [_player y v] to [-80]\n    set [_player z v] to [0]\n    _tower [-100] [-100] [100] [100] [-100] color [34] brightness [100]\nelse\n    if <(level) = [1]> then\n        _tower [-100] [-100] [100] [100] [-100] color [34] brightness [100]\n        add rect [-100] [-100] [200] [100] [-50] [300] color [34] collisions [1] brightness [100] negro [100]\n        add rect [-100] [-450] [200] [100] [-100] [300] color [8] collisions [1] brightness [100] negro [100]\n        add rect [-100] [-50] [400] [100] [0] [500] color [34] collisions [1] brightness [100] negro [100]\n        add rect [-100] [-450] [400] [100] [-50] [500] color [8] collisions [1] brightness [100] negro [100]\n        add rect [-100] [0] [600] [100] [50] [800] color [34] collisions [1] brightness [100] negro [100]\n        add rect [-100] [-450] [600] [100] [0] [800] color [8] collisions [1] brightness [100] negro [100]\n        _bounce pad at [0] [50] [700]\n        add rect [250] [-450] [600] [650] [-25] [800] color [8] collisions [1] brightness [100] negro [100]\n        add rect [250] [-50] [600] [425] [300] [800] color [8] collisions [1] brightness [100] negro [100]\n        add rect [250] [300] [600] [425] [350] [800] color [34] collisions [1] brightness [100] negro [100]\n        add rect [425] [-50] [600] [650] [300] [800] color [8] collisions [1] brightness [100] negro [100]\n        add rect [425] [300] [600] [650] [350] [800] color [34] collisions [1] brightness [100] negro [100]\n        _lava [325] [350] [600] to [350] [375] [800]\n        _lava [425] [350] [600] to [500] [375] [800]\n        _end [625] [350] [600] [650] [475] [800]\n        _sign at [0] [-100] [50] mode [1]\n        _sign at [0] [0] [480] mode [1]\n        _sign at [270] [350] [700] mode [2]\n    else\n        if <(level) = [2]> then\n            _tower [-100] [-100] [100] [100] [-100] color [10] brightness [50]\n            _tower [300] [-100] [400] [100] [-100] color [10] brightness [50]\n            _tower [600] [-100] [700] [100] [-100] color [10] brightness [50]\n            _tower [900] [-100] [1100] [50] [-100] color [10] brightness [50]\n            _tower [900] [50] [1100] [250] [-100] color [10] brightness [50]\n            _lava [900] [-100] [100] to [1100] [-75] [150]\n            _tower [975] [250] [1025] [400] [-100] color [10] brightness [50]\n            _tower [975] [400] [1025] [650] [50] color [10] brightness [50]\n            _lava [975] [50] [475] to [1025] [75] [575]\n            _tower [900] [750] [1100] [950] [150] color [10] brightness [50]\n            _bounce pad at [1000] [150] [850]\n            _tower [900] [1375] [1100] [1450] [150] color [10] brightness [50]\n            _end [900] [150] [1375] [ 1100] [400] [1450]\n            _sign at [0] [-100] [0] mode [2]\n        else\n            if <(level) = [3]> then\n                _tower [-100] [-100] [100] [100] [-100] color [70] brightness [4]\n                _moving tower from [100] [-100] [300] [100] [-100] to [500] [-100] [700] [100] [-100] speed [50] color [70] brightness [4]\n                _tower [700] [-100] [900] [100] [-100] color [70] brightness [4]\n                _bounce pad at [800] [-100] [0]\n                _tower [700] [100] [900] [300] [250] color [70] brightness [4]\n                _lava [700] [250] [175] to [900] [275] [225]\n                _moving tower from [700] [500] [900] [700] [100] to [700] [500] [900] [700] [700] speed [50] color [70] brightness [4]\n                _lava [700] [-450] [700] to [900] [-350] [1000]\n                _tower [650] [1000] [950] [1300] [-300] color [70] brightness [4]\n                _end [700] [-300] [1050] [900] [-275] [1250]\n                _sign at [0] [-100] [0] mode [2]\n            else\n                if <(level) = [4]> then\n                    _sign at [] [-100] [] mode [1]\n                    _add enemy from [-100] [-5] [150] to [100] [-5] [150] difference [0]\n                    _add enemy from [-100] [70] [250] to [100] [70] [250] difference [90]\n                    _tower [-100] [-100] [100] [100] [-100] color [34] brightness [100]\n                    _tower [-150] [100] [150] [200] [-25] color [34] brightness [100]\n                    _tower [-150] [200] [150] [300] [50] color [34] brightness [100]\n                    _moving tower from [-50] [300] [50] [400] [50] to [-50] [600] [50] [700] [50] speed [70] color [34] brightness [100]\n                    _add enemy from [] [70] [350] to [] [70] [650] difference [0]\n                    _tower [-100] [700] [100] [750] [50] color [34] brightness [100]\n                    _end [-75] [50] [725] [75] [200] [750]\n                else\n                    if <(level) = [5]> then\n                        _sign at [] [-100] [] mode [1]\n                        _tower [-100] [-100] [100] [100] [-100] color [34] brightness [100]\n                        _tower [-100] [100] [100] [300] [0] color [34] brightness [100]\n                        _add enemy from [-75] [20] [125] to [75] [20] [125] difference [180]\n                        _add enemy from [-75] [20] [200] to [75] [20] [200] difference [0]\n                        _add enemy from [-75] [20] [275] to [75] [20] [275] difference [180]\n                        _moving tower from [100] [100] [300] [300] [0] to [500] [100] [700] [300] [0] speed [50] color [34] brightness [100]\n                        _moving tower from [1400] [100] [1600] [300] [0] to [700] [100] [900] [300] [0] speed [50] color [70] brightness [3]\n                        _tower [1600] [100] [1800] [300] [0] color [70] brightness [4]\n                        _tower [1600] [300] [1800] [500] [400] color [70] brightness [4]\n                        _bounce pad at [1700] [0] [200]\n                        _lava [1600] [400] [375] to [1800] [425] [425]\n                        _tower [1600] [500] [1800] [700] [400] color [70] brightness [4]\n                        _add enemy from [1650] [420] [525] to [1750] [420] [525] difference []\n                        _add enemy from [1650] [420] [625] to [1750] [420] [625] difference [180]\n                        _tower [1600] [1000] [1800] [1200] [400] color [10] brightness [50]\n                        _moving tower from [1600] [1200] [1800] [1400] [400] to [1600] [1200] [1800] [1400] [0] speed [50] color [10] brightness [50]\n                        _tower [1600] [1600] [1800] [1800] [0] color [10] brightness [50]\n                        _end [1675] [50] [1675] [1725] [100] [1725]\n                    else\n                        _sign at [] [-100] [] mode [1]\n                        _tower [-100] [-100] [100] [100] [-100] color [34] brightness [100]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine add rect (x1) (y1) (z1) (x2) (y2) (z2) color (color) collisions (?) brightness (brightness) negro (negro)\nadd (brightness) to [@brightness v]\nadd (negro) to [@negro v]\nif <(?) = [1]> then\n    add (x1) to [_collisions v]\n    add (y1) to [_collisions v]\n    add (z1) to [_collisions v]\n    add (x2) to [_collisions v]\n    add (y2) to [_collisions v]\n    add (z2) to [_collisions v]\nend\nadd (round (((x1) + (x2)) / (2))) to [@x_sorting v]\nadd (round (((y1) + (y2)) / (2))) to [@y_sorting v]\nadd (round (((z1) + (z2)) / (2))) to [@z_sorting v]\nadd (color) to [@colors v]\nadd (x1) to [@x v]\nadd (x2) to [@x v]\nadd (y1) to [@y v]\nadd (y2) to [@y v]\nadd (z1) to [@z v]\nadd (z2) to [@z v]\n\ndefine sort\nget distances\nset [@lenght v] to (length of [-distances v])\nrepeat until <(@lenght) = [1]>\n    set [@highest v] to [1]\n    set [@i v] to [0]\n    repeat (@lenght)\n        change [@i v] by (1)\n        if <(item (@i) of [-distances v]) > (item (@highest) of [-distances v])> then\n            set [@highest v] to (@i)\n        end\n    end\n    add to sorting\n    change [@lenght v] by (-1)\nend\n\ndefine get distances\ndelete all of [-distances v]\nset [-i v] to [0]\nrepeat (length of [@x_sorting v])\n    change [-i v] by (1)\n    if <<[50] = (item (-i) of [@negro v])> or <[0] = (item (-i) of [@colors v])>> then\n        add ((-15) + (round ([sqrt v] of ((((_CAM Z) - (item (-i) of [@z_sorting v])) * ((_CAM Z) - (item (-i) of [@z_sorting v]))) + ((((_CAM Y) - (item (-i) of [@y_sorting v])) * ((_CAM Y) - (item (-i) of [@y_sorting v]))) + (((_CAM X) - (item (-i) of [@x_sorting v])) * ((_CAM X) - (item (-i) of [@x_sorting v]))))) ))) to [-distances v]\n    else\n        add (round ([sqrt v] of ((((_CAM Z) - (item (-i) of [@z_sorting v])) * ((_CAM Z) - (item (-i) of [@z_sorting v]))) + ((((_CAM Y) - (item (-i) of [@y_sorting v])) * ((_CAM Y) - (item (-i) of [@y_sorting v]))) + (((_CAM X) - (item (-i) of [@x_sorting v])) * ((_CAM X) - (item (-i) of [@x_sorting v]))))) )) to [-distances v]\n    end\nend\nadd rect ((_player x) - (20)) ((_player y) - (20)) ((_player z) - (20)) ((_player x) + (20)) ((_player y) + (20)) ((_player z) + (20)) color [64] collisions [0] brightness [100] negro [100]\nadd ((round ([sqrt v] of ((((_CAM Z) - (_player z)) * ((_CAM Z) - (_player z))) + ((((_CAM Y) - ((_player y) + (pso))) * ((_CAM Y) - ((_player y) + (pso)))) + (((_CAM X) - (_player x)) * ((_CAM X) - (_player x))))) )) - (30)) to [-distances v]\n\ndefine add to sorting\nset [@value v] to (item (@highest) of [-distances v])\nreplace item (@highest) of [-distances v] with (item (@lenght) of [-distances v])\nreplace item (@lenght) of [-distances v] with (@value)\nset [@value v] to (item (@highest) of [@negro v])\nreplace item (@highest) of [@negro v] with (item (@lenght) of [@negro v])\nreplace item (@lenght) of [@negro v] with (@value)\nset [@value v] to (item (@highest) of [@colors v])\nreplace item (@highest) of [@colors v] with (item (@lenght) of [@colors v])\nreplace item (@lenght) of [@colors v] with (@value)\nset [@value v] to (item (@highest) of [@brightness v])\nreplace item (@highest) of [@brightness v] with (item (@lenght) of [@brightness v])\nreplace item (@lenght) of [@brightness v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (1)) of [@x v])\nreplace item (((@highest) * (2)) - (1)) of [@x v] with (item (((@lenght) * (2)) - (1)) of [@x v])\nreplace item (((@lenght) * (2)) - (1)) of [@x v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (0)) of [@x v])\nreplace item (((@highest) * (2)) - (0)) of [@x v] with (item (((@lenght) * (2)) - (0)) of [@x v])\nreplace item (((@lenght) * (2)) - (0)) of [@x v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (1)) of [@y v])\nreplace item (((@highest) * (2)) - (1)) of [@y v] with (item (((@lenght) * (2)) - (1)) of [@y v])\nreplace item (((@lenght) * (2)) - (1)) of [@y v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (0)) of [@y v])\nreplace item (((@highest) * (2)) - (0)) of [@y v] with (item (((@lenght) * (2)) - (0)) of [@y v])\nreplace item (((@lenght) * (2)) - (0)) of [@y v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (1)) of [@z v])\nreplace item (((@highest) * (2)) - (1)) of [@z v] with (item (((@lenght) * (2)) - (1)) of [@z v])\nreplace item (((@lenght) * (2)) - (1)) of [@z v] with (@value)\nset [@value v] to (item (((@highest) * (2)) - (0)) of [@z v])\nreplace item (((@highest) * (2)) - (0)) of [@z v] with (item (((@lenght) * (2)) - (0)) of [@z v])\nreplace item (((@lenght) * (2)) - (0)) of [@z v] with (@value)\n\ndefine render\nsort\ncam\nset [-i v] to (length of [-distances v])\npen up\nrepeat (length of [-distances v])\n    rect (item (((-i) * (2)) - (1)) of [@x v]) (item (((-i) * (2)) - (1)) of [@y v]) (item (((-i) * (2)) - (1)) of [@z v]) (item ((-i) * (2)) of [@x v]) (item ((-i) * (2)) of [@y v]) (item ((-i) * (2)) of [@z v]) color (item (-i) of [@colors v]) brightness (item (-i) of [@brightness v]) negro (item (-i) of [@negro v])\n    change [-i v] by (-1)\nend\npen up\n\ndefine rect (x1) (y1) (z1) (x2) (y2) (z2) color (color) brightness (brightness) negro (negro)\nset pen (color v) to (color)\nset pen (saturation v) to (brightness)\nif <(_CAM X) < (x1)> then\n    fill 3D tri (x1) (y1) (z1) (x1) (y1) (z2) (x1) (y2) (z2) res [2] brillo ((10) + ((100) - (negro)))\n    fill 3D tri (x1) (y1) (z1) (x1) (y2) (z1) (x1) (y2) (z2) res [2] brillo ((10) + ((100) - (negro)))\nelse\n    if <(x2) < (_CAM X)> then\n        fill 3D tri (x2) (y1) (z1) (x2) (y1) (z2) (x2) (y2) (z2) res [2] brillo ((30) + ((100) - (negro)))\n        fill 3D tri (x2) (y1) (z1) (x2) (y2) (z1) (x2) (y2) (z2) res [2] brillo ((30) + ((100) - (negro)))\n    end\nend\nif <(_CAM Z) < (z1)> then\n    fill 3D tri (x1) (y1) (z1) (x2) (y1) (z1) (x2) (y2) (z1) res [2] brillo ((20) + ((100) - (negro)))\n    fill 3D tri (x1) (y1) (z1) (x1) (y2) (z1) (x2) (y2) (z1) res [2] brillo ((20) + ((100) - (negro)))\nelse\n    if <(z2) < (_CAM Z)> then\n        fill 3D tri (x1) (y1) (z2) (x2) (y1) (z2) (x2) (y2) (z2) res [2] brillo ((20) + ((100) - (negro)))\n        fill 3D tri (x1) (y1) (z2) (x1) (y2) (z2) (x2) (y2) (z2) res [2] brillo ((20) + ((100) - (negro)))\n    end\nend\nif <(_CAM Y) < (y1)> then\n    fill 3D tri (x1) (y1) (z1) (x2) (y1) (z1) (x2) (y1) (z2) res [2] brillo ((45) + ((100) - (negro)))\n    fill 3D tri (x1) (y1) (z1) (x1) (y1) (z2) (x2) (y1) (z2) res [2] brillo ((45) + ((100) - (negro)))\nelse\n    if <(y2) < (_CAM Y)> then\n        fill 3D tri (x1) (y2) (z1) (x2) (y2) (z1) (x2) (y2) (z2) res [2] brillo ((0) + ((100) - (negro)))\n        fill 3D tri (x1) (y2) (z1) (x1) (y2) (z2) (x2) (y2) (z2) res [2] brillo ((0) + ((100) - (negro)))\n    end\nend\n\ndefine collision?\nset [-i v] to [0]\nset [collision? v] to [0]\nrepeat ((length of [_collisions v]) / (6))\n    change [-i v] by (6)\n    if <<(item ((-i) - (5)) of [_collisions v]) < ((_player x) + (20))> and <((_player x) + (-20)) < (item ((-i) - (2)) of [_collisions v])>> then\n        if <<(item ((-i) - (4)) of [_collisions v]) < ((_player y) + (20))> and <((_player y) + (-20)) < (item ((-i) - (1)) of [_collisions v])>> then\n            if <<(item ((-i) - (3)) of [_collisions v]) < ((_player z) + (20))> and <((_player z) + (-20)) < (item (-i) of [_collisions v])>> then\n                set [collision? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine physics\nchange [y.vel v] by (-1)\nchange [_player y v] by (Y.vel)\ncollision?\nif <(collision?) = [1]> then\n    repeat until <(collision?) = [0]>\n        if <(Y.vel) > [0]> then\n            change [_player y v] by (-1)\n        else\n            change [_player y v] by (1)\n        end\n        collision?\n    end\n    set [y.vel v] to [0]\n    change [_player y v] by (-3)\n    collision?\n    if <<(collision?) = [1]> and <key (space v) pressed?>> then\n        set [y.vel v] to [20]\n    end\n    change [_player y v] by (3)\nend\nBounce?\nif <(collision?) = [1]> then\n    set [y.vel v] to [30]\nend\nif <key (w v) pressed?> then\n    change [_player x v] by ((-10) * (Sin Y))\n    change [_player z v] by ((10) * (Cos Y))\n    collision?\n    if <(collision?) = [1]> then\n        repeat until <(collision?) = [0]>\n            change [_player x v] by ((1) * (Sin Y))\n            change [_player z v] by ((-1) * (Cos Y))\n            collision?\n        end\n    end\nend\nif <key (s v) pressed?> then\n    change [_player x v] by ((10) * (Sin Y))\n    change [_player z v] by ((-10) * (Cos Y))\n    collision?\n    if <(collision?) = [1]> then\n        repeat until <(collision?) = [0]>\n            change [_player x v] by ((-1) * (Sin Y))\n            change [_player z v] by ((1) * (Cos Y))\n            collision?\n        end\n    end\nend\nif <key (a v) pressed?> then\n    change [_player x v] by ((-10) * (Cos Y))\n    change [_player z v] by ((-10) * (Sin Y))\n    collision?\n    if <(collision?) = [1]> then\n        repeat until <(collision?) = [0]>\n            change [_player x v] by ((1) * (Cos Y))\n            change [_player z v] by ((1) * (Sin Y))\n            collision?\n        end\n    end\nend\nif <key (d v) pressed?> then\n    change [_player x v] by ((10) * (Cos Y))\n    change [_player z v] by ((10) * (Sin Y))\n    collision?\n    if <(collision?) = [1]> then\n        repeat until <(collision?) = [0]>\n            change [_player x v] by ((-1) * (Cos Y))\n            change [_player z v] by ((-1) * (Sin Y))\n            collision?\n        end\n    end\nend\nlava?\nif <<(collision?) = [1]> or <(_player y) < [-450]>> then\n    delete all of [%enemies deleted v]\n    set [y.vel v] to [0]\n    set [_player x v] to [0]\n    set [_player y v] to [0]\n    set [_player z v] to [0]\nend\nenemy collision?\nif <(collision?) = [1]> then\n    set [y.vel v] to [0]\n    set [_player x v] to [0]\n    set [_player y v] to [0]\n    set [_player z v] to [0]\nend\nEnd?\nif <(collision?) = [1]> then\n    change [level v] by (1)\n    set [y.vel v] to [0]\n    set [_player x v] to [0]\n    set [_player y v] to [0]\n    set [_player z v] to [0]\nend\n\ndefine _bounce pad at (x) (y) (z)\nadd rect ((x) - (35)) ((y) + (0)) ((z) - (35)) ((x) + (35)) ((y) + (20)) ((z) + (35)) color [17] collisions [0] brightness [100] negro [100]\nadd ((x) - (35)) to [_bounce v]\nadd ((y) + (0)) to [_bounce v]\nadd ((z) - (35)) to [_bounce v]\nadd ((x) + (35)) to [_bounce v]\nadd ((y) + (20)) to [_bounce v]\nadd ((z) + (35)) to [_bounce v]\n\ndefine Bounce?\nset [-i v] to [0]\nset [collision? v] to [0]\nrepeat ((length of [_bounce v]) / (6))\n    change [-i v] by (6)\n    if <<(item ((-i) - (5)) of [_bounce v]) < ((_player x) + (20))> and <((_player x) + (-20)) < (item ((-i) - (2)) of [_bounce v])>> then\n        if <<(item ((-i) - (4)) of [_bounce v]) < ((_player y) + (20))> and <((_player y) + (-20)) < (item ((-i) - (1)) of [_bounce v])>> then\n            if <<(item ((-i) - (3)) of [_bounce v]) < ((_player z) + (20))> and <((_player z) + (-20)) < (item (-i) of [_bounce v])>> then\n                set [collision? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine _lava (x) (y) (z) to (x1) (y1) (z1)\nadd (x) to [_lava v]\nadd (y) to [_lava v]\nadd (z) to [_lava v]\nadd (x1) to [_lava v]\nadd (y1) to [_lava v]\nadd (z1) to [_lava v]\nadd rect (x) (y) (z) (x1) (y1) (z1) color [0] collisions [0] brightness [100] negro [100]\n\ndefine lava?\nset [-i v] to [0]\nset [collision? v] to [0]\nrepeat ((length of [_lava v]) / (6))\n    change [-i v] by (6)\n    if <<(item ((-i) - (5)) of [_lava v]) < ((_player x) + (17))> and <((_player x) + (-17)) < (item ((-i) - (2)) of [_lava v])>> then\n        if <<(item ((-i) - (4)) of [_lava v]) < ((_player y) + (17))> and <((_player y) + (-17)) < (item ((-i) - (1)) of [_lava v])>> then\n            if <<(item ((-i) - (3)) of [_lava v]) < ((_player z) + (17))> and <((_player z) + (-17)) < (item (-i) of [_lava v])>> then\n                set [collision? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine _end (x1) (y1) (z1) (x2) (y2) (z2)\nadd (x1) to [_end v]\nadd (y1) to [_end v]\nadd (z1) to [_end v]\nadd (x2) to [_end v]\nadd (y2) to [_end v]\nadd (z2) to [_end v]\nadd rect (x1) (y1) (z1) (x2) (y2) (z2) color [90] collisions [0] brightness ((85) + ((15) * ([sin v] of ((200) * (timer)) ))) negro [100]\n\ndefine End?\nset [-i v] to [0]\nset [collision? v] to [0]\nrepeat ((length of [_end v]) / (6))\n    change [-i v] by (6)\n    if <<(item ((-i) - (5)) of [_end v]) < ((_player x) + (17))> and <((_player x) + (-17)) < (item ((-i) - (2)) of [_end v])>> then\n        if <<(item ((-i) - (4)) of [_end v]) < ((_player y) + (17))> and <((_player y) + (-17)) < (item ((-i) - (1)) of [_end v])>> then\n            if <<(item ((-i) - (3)) of [_end v]) < ((_player z) + (17))> and <((_player z) + (-17)) < (item (-i) of [_end v])>> then\n                delete all of [%enemies deleted v]\n                set [collision? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine _tower (x1) (z1) (x2) (z2) (y) color (color) brightness (brightness)\nadd rect (x1) ((y) - (50)) (z1) (x2) (y) (z2) color (color) collisions [0] brightness (brightness) negro [100]\nif <(y) < [0]> then\n    add rect (x1) [-450] (z1) (x2) ((y) - (50)) (z2) color [8] collisions [0] brightness [100] negro [100]\nelse\n    if <(y) < [300]> then\n        add rect (x1) [-100] (z1) (x2) ((y) - (50)) (z2) color [8] collisions [0] brightness [100] negro [100]\n        add rect (x1) [-450] (z1) (x2) [-100] (z2) color [8] collisions [0] brightness [100] negro [100]\n    else\n        add rect (x1) [250] (z1) (x2) ((y) - (50)) (z2) color [8] collisions [0] brightness [100] negro [100]\n        add rect (x1) [-100] (z1) (x2) [250] (z2) color [8] collisions [0] brightness [100] negro [100]\n        add rect (x1) [-450] (z1) (x2) [-100] (z2) color [8] collisions [0] brightness [100] negro [100]\n    end\nend\nadd (x1) to [_collisions v]\nadd [-450] to [_collisions v]\nadd (z1) to [_collisions v]\nadd (x2) to [_collisions v]\nadd (y) to [_collisions v]\nadd (z2) to [_collisions v]\n\ndefine shadow\nset [-shadow.y v] to [-9999]\nset [counter v] to [0]\nrepeat ((length of [_collisions v]) / (6))\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [_collisions v]) < ((_player x) + (20))> and <((_player x) + (-20)) < (item ((counter) - (2)) of [_collisions v])>> then\n        if <<(item ((counter) - (3)) of [_collisions v]) < ((_player z) + (20))> and <((_player z) + (-20)) < (item (counter) of [_collisions v])>> then\n            set [--y v] to (item ((counter) - (1)) of [_collisions v])\n            if <<(--y) > (-shadow.Y)> and <(--y) < (_player y)>> then\n                set [-shadow.y v] to (--y)\n            end\n        end\n    end\nend\nset [counter v] to [0]\nrepeat ((length of [_lava v]) / (6))\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [_lava v]) < ((_player x) + (20))> and <((_player x) + (-20)) < (item ((counter) - (2)) of [_lava v])>> then\n        if <<(item ((counter) - (3)) of [_lava v]) < ((_player z) + (20))> and <((_player z) + (-20)) < (item (counter) of [_lava v])>> then\n            set [--y v] to (item ((counter) - (1)) of [_lava v])\n            if <<(--y) > (-shadow.Y)> and <(--y) < (_player y)>> then\n                set [-shadow.y v] to (--y)\n            end\n        end\n    end\nend\nset [counter v] to [0]\nrepeat ((length of [_bounce v]) / (6))\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [_bounce v]) < ((_player x) + (20))> and <((_player x) + (-20)) < (item ((counter) - (2)) of [_bounce v])>> then\n        if <<(item ((counter) - (3)) of [_bounce v]) < ((_player z) + (20))> and <((_player z) + (-20)) < (item (counter) of [_bounce v])>> then\n            set [--y v] to (item ((counter) - (1)) of [_bounce v])\n            if <<(--y) > (-shadow.Y)> and <(--y) < (_player y)>> then\n                set [-shadow.y v] to (--y)\n            end\n        end\n    end\nend\nif <(-shadow.Y) < [-500]> then\n    set [-shadow.y v] to [99999]\nend\nadd rect ((_player x) - (20)) ((-shadow.Y) - (1)) ((_player z) - (20)) ((_player x) + (20)) ((-shadow.Y) + (1)) ((_player z) + (20)) color [68] collisions [0] brightness [0] negro [50]\n\ndefine _moving tower from (x1) (z1) (x2) (z2) (y) to (x3) (z3) (x4) (z4) (y2) speed (speed) color (color) brightness (brightness)\nchange [--mpc v] by (6)\nset [--speedsin v] to (([sin v] of ((--cronometro_2) * (speed)) ) + (1))\nadd (((((x3) - (x1)) / (2)) * (--speedSin)) + (x1)) to [__move v]\nadd (((((z3) - (z1)) / (2)) * (--speedSin)) + (z1)) to [__move v]\nset [--speedsin v] to (([sin v] of ((timer) * (speed)) ) + (1))\nadd (((((x3) - (x1)) / (2)) * (--speedSin)) + (x1)) to [__move v]\nadd (((((z3) - (z1)) / (2)) * (--speedSin)) + (z1)) to [__move v]\nadd (round ((item ((--mpc) - (3)) of [__move v]) - (item ((--mpc) - (5)) of [__move v]))) to [__move v]\nadd (round ((item ((--mpc) - (2)) of [__move v]) - (item ((--mpc) - (4)) of [__move v]))) to [__move v]\n_tower (((((x3) - (x1)) / (2)) * (--speedSin)) + (x1)) (((((z3) - (z1)) / (2)) * (--speedSin)) + (z1)) (((((x4) - (x2)) / (2)) * (--speedSin)) + (x2)) (((((z4) - (z2)) / (2)) * (--speedSin)) + (z2)) (((((y2) - (y)) / (2)) * (--speedSin)) + (y)) color (color) brightness (brightness)\nadd (round (((((x3) - (x1)) / (2)) * (--speedSin)) + (x1))) to [__moving platforms v]\nadd [-450] to [__moving platforms v]\nadd (round (((((z3) - (z1)) / (2)) * (--speedSin)) + (z1))) to [__moving platforms v]\nadd (round (((((x4) - (x2)) / (2)) * (--speedSin)) + (x2))) to [__moving platforms v]\nadd (round (((((y2) - (y)) / (2)) * (--speedSin)) + (y))) to [__moving platforms v]\nadd (round (((((z4) - (z2)) / (2)) * (--speedSin)) + (z2))) to [__moving platforms v]\n\ndefine -move with platform\n-MPC?\nif <(collision?) = [1]> then\n    change [_player x v] by (item ((counter) - (1)) of [__move v])\n    change [_player z v] by (item (counter) of [__move v])\nend\n\ndefine -MPC?\nchange [_player y v] by (-30)\nset [counter v] to [0]\nset [collision? v] to [0]\nrepeat ((length of [__moving platforms v]) / (6))\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [__moving platforms v]) < ((_player x) - (-20))> and <((_player x) - (20)) < (item ((counter) - (2)) of [__moving platforms v])>> then\n        if <<(item ((counter) - (4)) of [__moving platforms v]) < ((_player y) - (-20))> and <((_player y) - (20)) < (item ((counter) - (1)) of [__moving platforms v])>> then\n            if <<(item ((counter) - (3)) of [__moving platforms v]) < ((_player z) - (-20))> and <((_player z) - (20)) < (item ((counter) - (0)) of [__moving platforms v])>> then\n                set [collision? v] to [1]\n                change [_player y v] by (30)\n                stop [this script v]\n            end\n        end\n    end\nend\nchange [_player y v] by (30)\n\ndefine tic\nphysics\n-move with platform\ncalculate tri.\ndelete from lists\ncreate world\nset [--cronometro_2 v] to (timer)\nshadow\ntouching sign?\nenemy collision?\nrender\n\ndefine _sign at (x) (y) (z) mode (mode)\nadd rect ((x) - (3)) (y) ((z) - (3)) ((x) + (3)) ((y) + (25)) ((z) + (3)) color [9] collisions [0] brightness [100] negro [70]\nif <(mode) = [1]> then\n    add rect ((x) - (45)) ((y) + (25)) ((z) - (7)) ((x) + (45)) ((y) + (60)) ((z) + (7)) color [9] collisions [0] brightness [100] negro [90]\n    add ((x) - (45)) to [_signs v]\n    add ((y) + (25)) to [_signs v]\n    add ((z) - (7)) to [_signs v]\n    add ((x) - (-45)) to [_signs v]\n    add ((y) + (60)) to [_signs v]\n    add ((z) + (7)) to [_signs v]\nelse\n    if <(mode) = [2]> then\n        add rect ((x) - (7)) ((y) + (25)) ((z) - (45)) ((x) + (7)) ((y) + (60)) ((z) + (45)) color [9] collisions [0] brightness [100] negro [90]\n        add ((x) - (7)) to [_signs v]\n        add ((y) + (25)) to [_signs v]\n        add ((z) - (45)) to [_signs v]\n        add ((x) + (7)) to [_signs v]\n        add ((y) + (60)) to [_signs v]\n        add ((z) + (45)) to [_signs v]\n    end\nend\n\ndefine touching sign?\nset [__touching sign? v] to [0]\nset [counter v] to [0]\nrepeat (length of [_signs v])\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [_signs v]) < ((_player x) - (-20))> and <((_player x) - (20)) < (item ((counter) - (2)) of [_signs v])>> then\n        if <<(item ((counter) - (4)) of [_signs v]) < ((_player y) - (-20))> and <((_player y) - (20)) < (item ((counter) - (1)) of [_signs v])>> then\n            if <<(item ((counter) - (3)) of [_signs v]) < ((_player z) - (-20))> and <((_player z) - (20)) < (item (counter) of [_signs v])>> then\n                set [__touching sign? v] to [1]\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine _add enemy from (x) (y) (z) to (x2) (y2) (z2) difference (d)\nset [--speedsin v] to ((([sin v] of (((timer) * (70)) + (d)) ) + (1)) / (2))\nset [-x v] to (round ((((x2) - (x)) * (--speedSin)) + (x)))\nset [-y v] to (round ((((y2) - (y)) * (--speedSin)) + (y)))\nset [-z v] to (round ((((z2) - (z)) * (--speedSin)) + (z)))\nif <[%enemies deleted v] contains (((length of [%enemies v]) + (6)) / (6))?> then\n    add ((-x) - (20)) to [%enemies v]\n    add ((-y) - (20)) to [%enemies v]\n    add ((-z) - (1000)) to [%enemies v]\n    add ((-x) - (-20)) to [%enemies v]\n    add ((-y) - (-20)) to [%enemies v]\n    add ((-z) - (920)) to [%enemies v]\nelse\n    enemy (-x) (-y) (-z)\n    add ((-x) - (20)) to [%enemies v]\n    add ((-y) - (20)) to [%enemies v]\n    add ((-z) - (20)) to [%enemies v]\n    add ((-x) + (20)) to [%enemies v]\n    add ((-y) + (20)) to [%enemies v]\n    add ((-z) + (20)) to [%enemies v]\nend\n\ndefine enemy (x) (y) (z)\nadd rect ((x) - (20)) ((y) - (20)) ((z) - (20)) ((x) + (20)) ((y) + (20)) ((z) + (20)) color [0] collisions [0] brightness [100] negro [85]\n\ndefine enemy collision?\nset [collision? v] to [0]\nset [counter v] to [0]\nrepeat (length of [%enemies v])\n    change [counter v] by (6)\n    if <<(item ((counter) - (5)) of [%enemies v]) < ((_player x) - (-20))> and <((_player x) - (20)) < (item ((counter) - (2)) of [%enemies v])>> then\n        if <<(item ((counter) - (4)) of [%enemies v]) < ((_player y) - (-20))> and <((_player y) - (20)) < (item ((counter) - (1)) of [%enemies v])>> then\n            if <<(item ((counter) - (3)) of [%enemies v]) < ((_player z) - (-20))> and <((_player z) - (20)) < (item (counter) of [%enemies v])>> then\n                if <<(Y.vel) < [0]> and <(_player y) > ((item ((counter) - (1)) of [%enemies v]) - (20))>> then\n                    add ((counter) / (6)) to [%enemies deleted v]\n                    set [y.vel v] to [15]\n                else\n                    set [collision? v] to [1]\n                    delete all of [%enemies deleted v]\n                end\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    set [fps v] to (fps_2)\n    set [fps_2 v] to [0]\nend\n\n@signs\n\nwhen flag clicked\nset size to (100000000) %\ngo to x: (0) y: (-240)\nforever\n    set size to (100000000) %\n    show\n    if <(__touching sign?) = [1]> then\n        costume\n        change y by (round (((-120) - (y position)) / (3)))\n    else\n        change y by (round (((-240) - (y position)) / (3)))\n    end\n    set size to (75) %\nend\n\ndefine costume\nif <(level) = [1]> then\n    if <(_player z) < [200]> then\n        switch costume to (1 v)\n    else\n        if <(_player x) < [100]> then\n            switch costume to (2 v)\n        else\n            switch costume to (3 v)\n        end\n    end\nelse\n    if <(level) = [2]> then\n        switch costume to (4 v)\n    else\n        if <(level) = [3]> then\n            switch costume to (5 v)\n        else\n            if <(level) = [4]> then\n                switch costume to (6 v)\n            else\n                if <(level) = [5]> then\n                    switch costume to (7 v)\n                else\n                    if <(level) = [6]> then\n                        switch costume to (8 v)\n                    end\n                end\n            end\n        end\n    end\nend\n\n@levels\n\nwhen flag clicked\nhide\nwait until <(level) = [1]>\nshow\nswitch costume to (level 1 v)\nslide\nwait until <(level) = [2]>\nswitch costume to (level 2 v)\nslide\nwait until <(level) = [3]>\nswitch costume to (level 3 v)\nslide\nwait until <(level) = [4]>\nswitch costume to (level 4 v)\nslide\nwait until <(level) = [5]>\nswitch costume to (level 5 v)\nslide\n\ndefine go to (x) (y)\nset size to (1000) %\ngo to x: (x) y: (y)\nset size to (100) %\n\ndefine slide\nshow\ngo to [500] [0]\ndelete all of [move v]\nrepeat (25)\n    add (((0) - (x position)) / (5)) to [move v]\n    change x by (((0) - (x position)) / (5))\nend\nwait (0.05) seconds\nrepeat (25)\n    change x by (item (join [la] [st]) of [move v])\n    delete (join [la] [st]) of [move v]\nend\nhide\n\n@buttons\n\nwhen flag clicked\nshow\nset size to (100) %\nswitch costume to (1 v)\nset [level v] to [#]\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nwait until <(level) = [1]>\nhide\n\nwhen I start as a clone\nswitch costume to (2 v)\ngo to x: (0) y: (-100)\nset size to (75) %\nforever\n    change [rot y v] by (1.5)\n    if <touching (mouse-pointer v)?> then\n        change size by (((85) - (size)) / (5))\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            set [level v] to [1]\n            set [rot y v] to [0]\n            delete this clone\n        end\n    else\n        change size by (((75) - (size)) / (5))\n    end\nend\n\n@Objeto1\n\nwhen flag clicked\nset size to (75) %\nset [sound? v] to [1]\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        set [sound? v] to <(sound?) = [0]>\n        if <(sound?) = [0]> then\n            stop all sounds\n        end\n        wait until <<mouse down?> = [0]>\n    end\n    switch costume to ((sound?) + (1))\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nshow\n\n@blank3\n\n@blank4\n\n@blank5\n\n
Arrow / WASD / Mobile\n\n\nSTOP ADVERTISING (You WILL be reported)