VVVVVV - Platformer Game - Demo 4
@Stage\n\nwhen I receive [levelswitchevent v]\nif <not <<(next_track) = (current_track)> or <(muted) = [1]>>> then\n    repeat (25)\n        change volume by (-4)\n        wait (0) seconds\n    end\n    set [play_track v] to (next_track)\n    wait (0.125) seconds\n    stop all sounds\n    repeat (25)\n        change volume by (4)\n        wait (0) seconds\n    end\n    set [current_track v] to (next_track)\nend\n\nwhen flag clicked\nset [gravity v] to [1]\nset [current_track v] to [1]\nset [play_track v] to [1]\nset [level v] to [1]\nset [space_lock v] to [0]\nbroadcast (gameinitevent v) and wait\nbroadcast (gamestartevent v)\n\nwhen I receive [screenleaveevent v]\nif <(side_left) = [0]> then\n    set [level v] to (item (level) of [exits0 v])\nelse\n    if <(side_left) = [1]> then\n        set [level v] to (item (level) of [exits1 v])\n    else\n        if <(side_left) = [2]> then\n            set [level v] to (item (level) of [exits2 v])\n        else\n            set [level v] to (item (level) of [exits3 v])\n        end\n    end\nend\nset [next_track v] to (item (level) of [level_sound v])\nbroadcast (screenleftevent v)\n\nset [lock v] to [0]\n\nwhen I receive [gamestartevent v]\nbroadcast (threadstartkeyhandler v)\nforever\n    if <(muted) = [0]> then\n        play sound (play_track) until done\n    end\n    wait (0) seconds\nend\n\n@lvl\n\nwhen I receive [gameinitevent v]\nswitch costume to (level)\n\nwhen I receive [levelswitchevent v]\nswitch costume to (level)\n\n@player\n\nwhen I receive [gamestartevent v]\nforever\n    if <(lock) = [0]> then\n        movement_loop\n    end\nend\n\ndefine movement_loop\nif <<key (left arrow v) pressed?> and <not <key (right arrow v) pressed?>>> then\n    repeat (5)\n        if <<<key (left arrow v) pressed?> and <not <key (right arrow v) pressed?>>> and <(lock) = [0]>> then\n            set x to ((x position) - (1))\n            if <touching (lvl_col v)?> then\n                set x to ((x position) + (1))\n            end\n            if <touching (lvl_end v)?> then\n                set [side_left v] to [3]\n                set [lock v] to [1]\n                wait (0) seconds\n                broadcast (screenLeaveEvent v)\n            end\n            if <touching (lvl_spike v)?> then\n                broadcast (playerDiedEvent v)\n                set [lock v] to [1]\n            end\n        end\n    end\nend\nif <<key (right arrow v) pressed?> and <not <key (left arrow v) pressed?>>> then\n    repeat (5)\n        if <<<key (right arrow v) pressed?> and <not <key (left arrow v) pressed?>>> and <(lock) = [0]>> then\n            change x by (1)\n            if <touching (lvl_col v)?> then\n                change x by (-1)\n            end\n            if <touching (lvl_end v)?> then\n                set [side_left v] to [1]\n                set [lock v] to [1]\n                wait (0) seconds\n                broadcast (screenLeaveEvent v)\n            end\n            if <touching (lvl_spike v)?> then\n                broadcast (playerDiedEvent v)\n                set [lock v] to [1]\n            end\n        end\n    end\nend\nif <(gravity) = [1]> then\n    change y by (-1)\n    if <not <touching (lvl_col v)?>> then\n        repeat (8)\n            if <(lock) = [0]> then\n                change y by (-1)\n                if <touching (lvl_col v)?> then\n                    change y by (1)\n                end\n                if <touching (lvl_end v)?> then\n                    set [side_left v] to [2]\n                    set [lock v] to [1]\n                    wait (0) seconds\n                    broadcast (screenLeaveEvent v)\n                end\n                if <touching (lvl_spike v)?> then\n                    broadcast (playerDiedEvent v)\n                    set [lock v] to [1]\n                end\n            end\n        end\n    else\n        change y by (1)\n    end\nelse\n    change y by (1)\n    if <not <touching (lvl_col v)?>> then\n        repeat (8)\n            if <(lock) = [0]> then\n                change y by (1)\n                if <touching (lvl_col v)?> then\n                    change y by (-1)\n                end\n                if <touching (lvl_end v)?> then\n                    set [side_left v] to [0]\n                    set [lock v] to [1]\n                    wait (0) seconds\n                    broadcast (screenLeaveEvent v)\n                end\n                if <touching (lvl_spike v)?> then\n                    broadcast (playerDiedEvent v)\n                    set [lock v] to [1]\n                end\n            end\n        end\n    else\n        change y by (-1)\n    end\nend\nif <<<key (space v) pressed?> or <key (v v) pressed?>> and <<(space_lock) = [0]> and <(lock) = [0]>>> then\n    if <(gravity) = [1]> then\n        change y by (-1)\n        if <touching (lvl_col v)?> then\n            if <not <(muted) = [1]>> then\n                start sound [jump v]\n            end\n            set [gravity v] to [-1]\n            set [space_lock v] to [1]\n        end\n        change y by (1)\n    else\n        change y by (1)\n        if <touching (lvl_col v)?> then\n            if <not <(muted) = [1]>> then\n                start sound [jump2 v]\n            end\n            set [gravity v] to [1]\n            set [space_lock v] to [1]\n        end\n        change y by (-1)\n    end\nend\nif <<key (r v) pressed?> and <(lock) = [0]>> then\n    broadcast (playerDiedEvent v)\n    set [lock v] to [1]\nend\nif <not <<key (space v) pressed?> or <key (v v) pressed?>>> then\n    set [space_lock v] to [0]\nend\nif <(current [second v]) = (fps_cur)> then\n    change [fps_cnt v] by (1)\nelse\n    set [fps v] to (join (fps_cnt) [ FPS])\n    set [fps_cnt v] to [1]\n    set [fps_cur v] to (current [second v])\nend\nwait (0) seconds\n\nwhen I receive [gamestartevent v]\nforever\n    if <(lock) = [0]> then\n        visual_loop\n    end\nend\n\ndefine visual_loop\nif <<<key (left arrow v) pressed?> and <not <key (right arrow v) pressed?>>> or <<key (right arrow v) pressed?> and <not <key (left arrow v) pressed?>>>> then\n    change [key_time v] by (1)\n    if <key (left arrow v) pressed?> then\n        set [last_input v] to [-1]\n    else\n        set [last_input v] to [1]\n    end\nelse\n    set [key_time v] to [0]\n    set [last_input v] to [0]\nend\nif <(gravity) = [1]> then\n    if <(round ((round (((key_time) / (6)) - (0.5))) / (2))) = ((round (((key_time) / (6)) - (0.5))) / (2))> then\n        switch costume to (player1 v)\n    else\n        switch costume to (player2 v)\n    end\nelse\n    if <(round ((round (((key_time) / (6)) - (0.5))) / (2))) = ((round (((key_time) / (6)) - (0.5))) / (2))> then\n        switch costume to (player3 v)\n    else\n        switch costume to (player4 v)\n    end\nend\nif <(last_input) = [-1]> then\n    point in direction (-90)\nend\nif <(last_input) = [1]> then\n    point in direction (90)\nend\nwait (0) seconds\n\nwhen I receive [gameinitevent v]\ngo to x: (-128) y: (-58)\nset [lock v] to [0]\nset [check_x v] to [-128]\nset [check_y v] to [-58]\nset [check_lvl v] to [1]\nset [check_grav v] to [1]\nset [color v] effect to (0)\nswitch costume to (player1 v)\n\nwhen I receive [screenleftevent v]\nif <(side_left) = [3]> then\n    set x to (158)\nelse\n    if <(side_left) = [1]> then\n        set x to (-158)\n    else\n        if <(side_left) = [2]> then\n            set y to (103)\n        else\n            set y to (-103)\n        end\n    end\nend\nbroadcast (levelSwitchEvent v)\nset [lock v] to [0]\n\nwhen I receive [playerdiedevent v]\nstart sound [hurt v]\nset [color v] effect to (90)\nswitch costume to ((4) + (round ((costume [number v]) / (2))))\nwait (0.8) seconds\nset x to (check_x)\nset y to (check_y)\nset [level v] to (check_lvl)\nset [next_track v] to (item (check_lvl) of [level_sound v])\nbroadcast (levelSwitchEvent v)\nset [gravity v] to (check_grav)\nset [color v] effect to (0)\nif <(gravity) = [1]> then\n    switch costume to (player1 v)\nelse\n    switch costume to (player3 v)\nend\nset [lock v] to [0]\n\n@lvl_col\n\nwhen I receive [gameinitevent v]\nswitch costume to (level)\n\nwhen I receive [levelswitchevent v]\nswitch costume to (level)\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n@lvl_spike\n\nwhen I receive [gameinitevent v]\nswitch costume to (level)\n\nwhen I receive [levelswitchevent v]\nswitch costume to (level)\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n@lvl_end\n\nwhen I receive [gameinitevent v]\nswitch costume to (level)\n\nwhen I receive [levelswitchevent v]\nswitch costume to (level)\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n@frame\n\n@text\n\nwhen I receive [gamestartevent v]\nrender_level_name\n\nwhen I receive [levelswitchevent v]\nrender_level_name\n\nwhen I receive [refreshtextevent v]\nrender_level_name\n\nwhen I receive [killtextevent v]\ndelete this clone\n\nwhen I receive [showlevelnameevent v]\nif <<(textstyle) = [0]> and <(clone) = [1]>> then\n    show\n    go to [front v] layer\nend\n\ndefine render_level_name\nbroadcast (killtextevent v)\nset x to (round ((((length of (item (level) of [level_names v])) / (2)) * (-4.5)) + (4.5)))\nset y to (-121)\nset [local_0 v] to [1]\nrepeat ((length of (item (level) of [level_names v])) / (2))\n    set [char v] to (join (letter (local_0) of (item (level) of [level_names v])) (letter ((local_0) + (1)) of (item (level) of [level_names v])))\n    create clone of (_myself_ v)\n    change [local_0 v] by (2)\n    change x by (9)\nend\nbroadcast (showlevelnameevent v)\n\nwhen I start as a clone\nswitch costume to (char)\nif <(textstyle) = [1]> then\n    show\n    go to [front v] layer\nend\nset [clone v] to [1]\n\n@bar\n\n@console\n\nwhen I receive [gamestartevent v]\nforever\n    if <<key (c v) pressed?> and <key (x v) pressed?>> then\n        set [lock v] to [1]\n        ask [] and wait\n        set [local_0 v] to [1]\n        set [local_1 v] to []\n        set [local_2 v] to [0]\n        set [local_3 v] to []\n        repeat (length of (answer))\n            if <(local_2) = [0]> then\n                if <not <(letter (local_0) of (answer)) = [ ]>> then\n                    set [local_1 v] to (join (local_1) (letter (local_0) of (answer)))\n                    change [local_0 v] by (1)\n                else\n                    change [local_0 v] by (1)\n                    set [local_2 v] to [1]\n                end\n            end\n        end\n        if <(local_1) = [setlevelname]> then\n            repeat ((length of (answer)) - (13))\n                set [dbg_0 v] to (letter (local_0) of (answer))\n                getCode (letter (local_0) of (answer))\n                set [local_3 v] to (join (local_3) (local_return_0))\n                change [local_0 v] by (1)\n            end\n            replace item (level) of [level_names v] with (local_3)\n            broadcast (refreshTextEvent v)\n        end\n        if <(local_1) = [toggletextstyle]> then\n            if <(textstyle) = [0]> then\n                set [textstyle v] to [1]\n            else\n                set [textstyle v] to [0]\n            end\n        end\n        if <(local_1) = [mute]> then\n            set [muted v] to [1]\n            stop all sounds\n        end\n        if <(local_1) = [unmute]> then\n            set [muted v] to [0]\n            stop all sounds\n        end\n        set [lock v] to [0]\n    end\n    wait (0.1) seconds\nend\n\ndefine getCode []\nswitch costume to (null v)\nswitch costume to (letter)\nset [local_return_0 v] to [-1]\nset [local_4 v] to [1]\nrepeat (68)\n    if <(letter) = (item (local_4) of [chars v])> then\n        if <<<(local_4) < [37]> or <(local_4) > [62]>> or <(costume [number v]) > [1]>> then\n            set [local_return_0 v] to (local_4)\n        end\n    end\n    change [local_4 v] by (1)\nend\nif <<(local_return_0) > [-1]> and <(local_return_0) < [10]>> then\n    set [local_return_0 v] to (join [0] (local_return_0))\nend\n\n
Bla bla bla canceled.\n\nMove with Left/Right keys\nInvert gravity with Space or V key\nKill yourself with the R key\nOpen the console with X and C keys (at the same time)\n\nYep, new demo. Yep, more content. Yep, took longer than usual. Yep, being busy with other stuff.\nI'm currently learning Scala, a coding language which runs on the Java VM. It's a pretty unusual language :P\nI'm also working on my first emulator. Really basic, but it has to start somewhere :)\n\nConsole commands:\nsetlevelname <NAME>          Sets the name of the current level\nmute                                    Mute\nunmute                                 Unmute\ntoggletextstyle                      Changes how the text fades in\n\nChangelog:\n- More levels\n- Moar stuffs\n- Even more stuffs\n- Implemented vertical screen exits\n- Stuffs I forgot because this hasn't been touched in a while