Riddle - a Platformer with mind-twisting riddles
@Stage\n\nwhen I receive [riddle time v]\nif <(currLevel) = [4]> then\n    switch backdrop to (riddle1 v)\nelse\n    if <(currLevel) = [6]> then\n        switch backdrop to (riddle2 v)\n    else\n        if <(currLevel) = [8]> then\n            switch backdrop to (riddle3 v)\n        else\n            if <(currLevel) = [9]> then\n                switch backdrop to (riddle4 v)\n            else\n                if <(currLevel) = [11]> then\n                    switch backdrop to (riddle5 v)\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [2017-04-14_-_Happy_Dreams_-_David_Fesliyan v] until done\nend\n\n@player\n\nwhen flag clicked\nhide\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (y vel)\nif <touching (ground v)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching (ground v)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<key (up arrow v) pressed?> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <key (right arrow v) pressed?> then\n    change [x vel v] by (movement speed)\nend\nif <key (left arrow v) pressed?> then\n    change [x vel v] by ((-1) * (movement speed))\nend\nchange x by (x vel)\nif <touching (ground v)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (ground v)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching (ground v)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        if <key (up arrow v) pressed?> then\n            if <(x vel) < [0]> then\n                set [x vel v] to [0]\n                if <key (left arrow v) pressed?> then\n                    set [x vel v] to (wall jump hm)\n                    set [y vel v] to (wall jump vm)\n                end\n            else\n                set [x vel v] to [0]\n                if <key (right arrow v) pressed?> then\n                    set [x vel v] to ((-1) * (wall jump hm))\n                    set [y vel v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\nwhen I receive [startgame v]\nset [currlevel v] to [1]\ngo to x: (-183) y: (0)\nbroadcast (startPhysics v)\n\nbroadcast (StartGame v)\n\nwhen I receive [startphysics v]\nhide\nshow\nset [y vel v] to [0]\nset [x vel v] to [0]\nforever\n    platform physics (12) (-1) (0.9) (1) (8) (8)\nend\n\nwhen I receive [nextscreen v]\nchange [currlevel v] by (1)\ngo to x: (-183) y: (0)\nbroadcast (startPhysics v)\n\nwhen I receive [startgame v]\nbroadcast (riddlechecking v)\n\nwhen I receive [riddle time v]\nstop [other scripts in sprite v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [startagain v]\nshow\nclear graphic effects\nif <(currLevel) = [4]> then\n    broadcast (startPhysics v)\n    broadcast (riddlechecking v)\n    go to x: (148) y: (78)\nelse\n    if <(currLevel) = [6]> then\n        broadcast (startPhysics v)\n        broadcast (riddlechecking v)\n        go to x: (13) y: (-102)\n    else\n        if <(currLevel) = [8]> then\n            broadcast (startPhysics v)\n            broadcast (riddlechecking v)\n            go to x: (78) y: (115)\n        else\n            if <(currLevel) = [9]> then\n                broadcast (startPhysics v)\n                broadcast (riddlechecking v)\n                go to x: (78) y: (115)\n            else\n                if <(currLevel) = [11]> then\n                    broadcast (startPhysics v)\n                    broadcast (riddlechecking v)\n                    go to x: (171) y: (139)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [riddlechecking v]\nforever\n    if <touching color (#ffbb55)?> then\n        broadcast (riddle time v)\n        wait until <not <touching color (#ffbb55)?>>\n    end\n    if <touching color (#ff3a3a)?> then\n        go to x: (-183) y: (0)\n        broadcast (startPhysics v)\n        wait until <not <touching color (#ff3a3a)?>>\n    end\n    if <key (s v) pressed?> then\n        broadcast (nextScreen v) and wait\n        wait until <not <key (s v) pressed?>>\n    end\nend\n\nwhen I receive [startphysics v]\n\ngo to x: (-183) y: (0)\nbroadcast (startPhysics v)\n\n@nextscreen\n\nwhen I start as a clone\nset size to (50) %\nset [ghost v] effect to (0)\nrepeat (25)\n    change [ghost v] effect by (4)\n    change size by (2)\nend\ndelete this clone\n\nwhen I receive [startgame v]\nbroadcast (cloneSPAM v)\n\nwhen I receive [backscreen v]\nnewpos\n\ndefine newpos\nset [ghost v] effect to (0)\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nif <(currLevel) < [4]> then\n    go to x: (172) y: (-117)\nelse\n    if <(currLevel) = [6]> then\n        go to x: (12) y: (4)\n    else\n        if <(currLevel) = [7]> then\n            go to x: (181) y: (-100)\n        else\n            go to x: (172) y: (34)\n        end\n    end\nend\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nbroadcast (cloneSPAM v)\n\nwhen I receive [nextscreen v]\nnewpos\n\nwhen I receive [startgame v]\nset [currlevel v] to [1]\nnewpos\n\nwhen I receive [clonespam v]\nforever\n    create clone of (_myself_ v)\n    wait (1) seconds\nend\n\nwhen I receive [startgame v]\nforever\n    if <touching (player v)?> then\n        broadcast (nextScreen v)\n        wait until <not <touching (player v)?>>\n    end\nend\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [riddle time v]\nstop [other scripts in sprite v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [startagain v]\nshow\nbroadcast (cloneSPAM v)\n\nwhen I receive [startagain v]\nforever\n    if <touching (player v)?> then\n        broadcast (nextScreen v)\n        wait until <not <touching (player v)?>>\n    end\nend\n\nwhen I receive [startagain v]\nclear graphic effects\nshow\n\n@ground\n\nwhen flag clicked\nhide\n\nwhen I receive [startgame v]\ngo to x: (0) y: (0)\nshow\n\nwhen flag clicked\nbroadcast (StartGame v)\n\nwhen I receive [nextscreen v]\nset [ghost v] effect to (0)\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nnext costume\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\nwhen I receive [backscreen v]\nchange [characterlist v] by (-1)\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [startgame v]\nswitch costume to (costume1 v)\n\nwhen I receive [riddle time v]\nstop [other scripts in sprite v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [startagain v]\nshow\n\n@riddleplatformerthumbnail\n\nwhen flag clicked\nset [currlevel v] to [1]\nforever\n    if <(currLevel) = [13]> then\n        stop [all v]\n    end\nend\n\nwhen [timer v] > (0.2)\ngo to [front v] layer\nshow\nswitch costume to (riddleplatformerthumbnail2 v)\ngo to x: (0) y: (-360)\nrepeat until <(y position) > [-1]>\n    change y by ((y position) / (-4))\nend\ngo to x: (0) y: (0)\n\nwhen flag clicked\nswitch costume to (riddleplatformerthumbnail v)\nshow\ngo to x: (0) y: (0)\nset size to (107) %\nhide\nreset timer\nforever\n    reset timer\nend\n\n@text background\n\nwhen flag clicked\ngo to [back v] layer\n\nwhen I receive [startgame v]\nswitch costume to (costume1 v)\n\nwhen I receive [backscreen v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [nextscreen v]\nnext costume\n\nwhen I receive [riddle time v]\nstop [other scripts in sprite v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [startgame v]\nclear graphic effects\nshow\n\nwhen I receive [startagain v]\nshow\n\n@hint\n\nwhen I receive [riddle time v]\nset [onriddle v] to [true]\ngo to x: (0) y: (-80)\nshow\nif <(currLevel) = [4]> then\n    ask [Be sure to only put a lowercase answer with no spaces] and wait\n    repeat until <<(answer) = [in a dictionary]> or <<(answer) = [dictionary]> or <<(answer) = [a dictionary]> or <(answer) = [on a dictionary]>>>>\n        ask [Incorrect! Try again.] and wait\n    end\n    correct\nelse\n    if <(currLevel) = [6]> then\n        ask [Be sure to only put a lowercase answer with no spaces] and wait\n        repeat until <<(answer) = [sun]> or <<(answer) = [the sun]> or <<(answer) = [our sun]> or <(answer) = [my sun]>>>>\n            ask [Incorrect! Try again.] and wait\n        end\n        correct\n    else\n        if <(currLevel) = [8]> then\n            ask [Be sure to only put a lowercase answer with no spaces] and wait\n            repeat until <<(answer) = [baseball]> or <<(answer) = [the baseball]> or <<(answer) = [rounders]> or <(answer) = [cricket]>>>>\n                ask [Try Again. Incorrect :\(] and wait\n            end\n            correct\n        else\n            if <(currLevel) = [9]> then\n                ask [Be sure to only put a lowercase answer with no spaces] and wait\n                repeat until <<(answer) = [shirt]> or <<(answer) = [the shirt]> or <<(answer) = [a shirt]> or <(answer) = [my shirt]>>>>\n                    ask [Try Again. Incorrect] and wait\n                end\n                correct\n            else\n                if <(currLevel) = [11]> then\n                    ask [Be sure to only put a lowercase answer with no spaces] and wait\n                    repeat until <<(answer) = [temperature]> or <<(answer) = [the temperature]> or <<(answer) = [temp]> or <(answer) = [temparature]>>>>\n                        ask [try again. incorrect] and wait\n                    end\n                    correct\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [startgame v]\nset [onriddle v] to [false]\nhide\n\ndefine correct\nhide\nswitch backdrop to (correct! v)\nwait (1) seconds\nbroadcast (startagain v)\n\nwhen I receive [startagain v]\nset [onriddle v] to [false]\nswitch backdrop to (backdrop1 v)\n\nwhen [h v] key pressed\nif <(onriddle) = [true]> then\n    if <(currLevel) = [4]> then\n        say [HINT: D_CT___A_Y] for (2) seconds\n    else\n        if <(currLevel) = [6]> then\n            say [HINT: S__] for (2) seconds\n        else\n            if <(currLevel) = [8]> then\n                say [HINT: B_S__A_L] for (2) seconds\n            else\n                if <(currLevel) = [9]> then\n                    say [HINT: S__R_T] for (2) seconds\n                else\n                    if <(currLevel) = [11]> then\n                        say [HINT: T__PE____RE] for (2) seconds\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen [a v] key pressed\nif <(onriddle) = [true]> then\n    if <(currLevel) = [4]> then\n        say [ANSWER: DICTIONARY] for (2) seconds\n    else\n        if <(currLevel) = [6]> then\n            say [ANSWER: SUN] for (2) seconds\n        else\n            if <(currLevel) = [8]> then\n                say [ANSWER: BASEBALL] for (2) seconds\n            else\n                if <(currLevel) = [9]> then\n                    say [ANSWER: SHIRT] for (2) seconds\n                else\n                    if <(currLevel) = [11]> then\n                        say [ANSWER: TEMPERATURE] for (2) seconds\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Scratch Analytics\n\nwhen flag clicked\ndelete all of [resultlist v]\nset [#scratchlytics | encode alphabet v] to [abcdefghijklmnopqrstuvwxyz0123456789-_ абвгдеёжзийклмнопрстуфхцчшщьыъэюя.,/]\nwait (1) seconds\ndecode cloud var (☁ @Scratchlytics | Username list) to string\nencode string (#scratchlytics | encode result) to list\nif <not <[resultlist v] contains (username)?>> then\n    insert (username) at (1) of [resultlist v] \n    decode list "resultList" to string\n    encode string (#scratchlytics | encode result) to cloud var\n    set [☁ @scratchlytics | username list v] to (#scratchlytics | encode result)\nend\ndecode cloud var (☁ @Scratchlytics | Username list) to string\nencode string (#scratchlytics | encode result) to list\ndelete all of [users history v]\nset [i1 v] to [1]\nif <(length of [resultlist v]) > [20]> then\n    repeat (20)\n        add (item (i1) of [resultlist v]) to [users history v]\n        change [i1 v] by (1)\n    end\nelse\n    repeat (length of [resultlist v])\n        add (item (i1) of [resultlist v]) to [users history v]\n        change [i1 v] by (1)\n    end\nend\nforever\n    if <(☁ @Scratchlytics | Total time) < [60]> then\n        set [total watch time v] to (join (☁ @Scratchlytics | Total time) [ seconds])\n    else\n        if <(☁ @Scratchlytics | Total time) < [3600]> then\n            set [total watch time v] to (join (round ((☁ @Scratchlytics | Total time) / (60))) [ minutes])\n        else\n            if <(☁ @Scratchlytics | Total time) < [86400]> then\n                set [total watch time v] to (join (round ((☁ @Scratchlytics | Total time) / (3600))) [ hours])\n            else\n                set [total watch time v] to (join (round ((☁ @Scratchlytics | Total time) / (86400))) [ days])\n            end\n        end\n    end\n    if <(☁ @Scratchlytics | Clicks) < [1000]> then\n        set [total clicks v] to (☁ @Scratchlytics | Clicks)\n    else\n        if <(☁ @Scratchlytics | Clicks) < [1000000]> then\n            set [total clicks v] to (join (letter (1) of (☁ @Scratchlytics | Clicks)) [K])\n        else\n            set [total clicks v] to (join (letter (1) of (☁ @Scratchlytics | Clicks)) [M])\n        end\n    end\n    if <(☁ @Scratchlytics | Stops) < [1000]> then\n        set [users who stopped immediately v] to (☁ @Scratchlytics | Stops)\n    else\n        set [users who stopped immediately v] to (join (letter (1) of (☁ @Scratchlytics | Stops)) [K])\n    end\n    wait (1) seconds\nend\n\ndefine encode string (s) to cloud var\nset [#scratchlytics | encode result v] to []\nset [i1 v] to [1]\nrepeat (length of (s))\n    if < (#scratchlytics | encode alphabet) contains (letter (i1) of (s))?> then\n        set [i2 v] to [1]\n        repeat (length of (#scratchlytics | encode alphabet))\n            if <(letter (i2) of (#scratchlytics | encode alphabet)) = (letter (i1) of (s))> then\n                if <(i2) < [10]> then\n                    set [#scratchlytics | encode result v] to (join (#scratchlytics | encode result) (join [0] (i2)))\n                else\n                    set [#scratchlytics | encode result v] to (join (#scratchlytics | encode result) (i2))\n                end\n            end\n            change [i2 v] by (1)\n        end\n    else\n        set [#scratchlytics | encode result v] to (join (#scratchlytics | encode result) [73])\n    end\n    change [i1 v] by (1)\nend\n\ndefine decode cloud var (c) to string\nset [#scratchlytics | encode result v] to []\nset [i1 v] to [1]\nrepeat until <(i1) > ((length of (c)) - (1))>\n    set [#scratchlytics | encode result v] to (join (#scratchlytics | encode result) (letter (join (letter (i1) of (c)) (letter ((i1) + (1)) of (c))) of (#scratchlytics | encode alphabet)))\n    change [i1 v] by (2)\nend\n\ndefine encode string (s) to list\ndelete all of [resultlist v]\nadd [] to [resultlist v]\nset [i1 v] to [1]\nrepeat (length of (s))\n    if <(letter (i1) of (s)) = [/]> then\n        add [] to [resultlist v]\n    else\n        replace item (length of [resultlist v]) of [resultlist v] with (join (item (length of [resultlist v]) of [resultlist v]) (letter (i1) of (s)))\n    end\n    change [i1 v] by (1)\nend\n\ndefine decode list "resultList" to string\nset [#scratchlytics | encode result v] to []\nset [i1 v] to [1]\nrepeat (length of [resultlist v])\n    if <(#scratchlytics | encode result) = []> then\n        set [#scratchlytics | encode result v] to (item (i1) of [resultlist v])\n    else\n        set [#scratchlytics | encode result v] to (join (#scratchlytics | encode result) (join [/] (item (i1) of [resultlist v])))\n    end\n    change [i1 v] by (1)\nend\n\ndefine Clear All Analytics Data\nset [☁ @scratchlytics | username list v] to [0]\nset [☁ @scratchlytics | total time v] to [0]\nset [☁ @scratchlytics | clicks v] to [0]\nset [☁ @scratchlytics | stops v] to [0]\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    change [☁ @scratchlytics | total time v] by (1)\nend\n\nwhen flag clicked\nforever\n    wait until <mouse down?>\n    wait until <not <mouse down?>>\n    change [☁ @scratchlytics | clicks v] by (1)\nend\n\nwhen flag clicked\nif <not <[resultlist v] contains (username)?>> then\n    change [☁ @scratchlytics | stops v] by (1)\n    wait (5) seconds\n    change [☁ @scratchlytics | stops v] by (-1)\nend\n\nwhen flag clicked\ndelete all of [admins list v]\nadd [PackersRuleGoPack] to [admins list v]\n\nadd (username) to [admins list v]\n\nwhen flag clicked\nshow list [users history v]\nhide variable [users who stopped immediately v]\nhide variable [total watch time v]\nhide variable [total clicks v]\nforever\n    wait until <<key (a v) pressed?> and <key (left arrow v) pressed?>>\n    wait until <not <<key (a v) pressed?> and <key (left arrow v) pressed?>>>\n    if <<[admins list v] contains (username)?> or <(username) = [Camera_Plus]>> then\n        hide list [users history v]\n        show variable [users who stopped immediately v]\n        show variable [total watch time v]\n        show variable [total clicks v]\n    end\n    wait until <<key (a v) pressed?> and <key (left arrow v) pressed?>>\n    wait until <not <<key (a v) pressed?> and <key (left arrow v) pressed?>>>\n    show list [users history v]\n    hide variable [users who stopped immediately v]\n    hide variable [total watch time v]\n    hide variable [total clicks v]\nend\n\nwhen flag clicked\ngo to x: (73) y: (-120)\nswitch costume to (intro v)\nshow\ngo to [front v] layer\nrepeat (50)\n    go to [front v] layer\n    wait (0) seconds\nend\nset [xvel v] to [1]\nrepeat (20)\n    go to [front v] layer\n    change x by (xvel)\n    change [xvel v] by ((xvel) * (0.5))\n    change [ghost v] effect by (5)\nend\nhide\nswitch costume to (logo v)\n\nwhen I receive [\[delete this message\] $scratchlytics-off 0746 v]\nwait (1) seconds\nif <([size v] of [slides-ru v]) = [100]> then\n    add (username) to [admins list v]\nend\n\n
-------------------------  RIDDLE  -------------------------\n-------  a Platformer with mind-twisting riddles  -------\n\nRiddle is different from all the other generic platformers. There is an extra door called the riddle door, and you will only be able to get past the level by answering the riddle.\n\nNote: In a riddle, you must click out of the box to see hint/answer (by pressing H or A\n\nHow to play:\n- Arrow keys to move\n- S to skip level\n- H to see hint on riddle\n- A to see the answer on riddle\n\nAll levels are possible. \n\nHave any suggestions? Leave a comment.\n\nWhy did I do this when I have basically no time? I made this a while ago. I just polished it up. I'm still working on Scratch Hub and it is still my main focus. \n\nRemember to love/fave/follow! \n\nLevel design, art, and pretty much everything is by me. Other credits are listed below:\n- Uses ScratchAnalytics by @Camera_Plus :) It's a really cool plugin thing that was made.\n- Riddles from a website. That website has some inappropriate riddles on it as well, so I won't link it here.\n\nLog:\n- 30 on trending\n- 13 on trending\n- top loved\n- 4 on trending\n- 1 on trending!!\n- 2 on trending\n- top remixed\n- 3 on trending\n- 6 on trending\n- 1k loves\n- And it's gone! 12 days of front pages :D more than 5k messages :O\n\n#games #art  