Magical Potions - Platformer - SDS
@Stage\n\nwhen flag clicked\nset [pixelate v] effect to (30)\n\nwhen flag clicked\nset volume to (80) %\nforever\n    play sound [Video Game 1 v] until done\nend\n\n@Sprite1\n\n@Sprite14\n\nwhen flag clicked\nshow\nset [pixelate v] effect to (20)\nset size to (50) %\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    go to (player hitbox v)\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>> then\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            switch costume to (costume2 v)\n            wait (0.03) seconds\n            switch costume to (costume3 v)\n            wait (0.03) seconds\n            switch costume to (costume4 v)\n            wait (0.03) seconds\n            switch costume to (costume5 v)\n            wait (0.03) seconds\n            switch costume to (costume6 v)\n            wait (0.03) seconds\n            switch costume to (costume7 v)\n            wait (0.03) seconds\n            switch costume to (costume8 v)\n            wait (0.03) seconds\n            switch costume to (costume9 v)\n            wait (0.03) seconds\n            switch costume to (costume10 v)\n            wait (0.03) seconds\n            switch costume to (costume11 v)\n            wait (0.03) seconds\n            switch costume to (costume12 v)\n            wait (0.05) seconds\n            switch costume to (costume13 v)\n            wait (0.03) seconds\n            switch costume to (costume14 v)\n            wait (0.05) seconds\n            switch costume to (costume15 v)\n            wait (0.03) seconds\n            switch costume to (costume16 v)\n            wait (0.03) seconds\n            switch costume to (costume17 v)\n            wait (0.03) seconds\n            switch costume to (costume18 v)\n            wait (0.03) seconds\n            switch costume to (costume19 v)\n            wait (0.03) seconds\n            switch costume to (costume20 v)\n            wait (0.03) seconds\n            switch costume to (costume21 v)\n            wait (0.03) seconds\n        end\n        if <key (up arrow v) pressed?> then\n            switch costume to (jump-1 v)\n            wait (0.3) seconds\n            switch costume to (jump-2 v)\n            wait until <not <key (up arrow v) pressed?>>\n        end\n    else\n        switch costume to (stand v)\n    end\nend\n\nwhen I receive [restart v]\npoint in direction (90)\nset [brightness v] effect to (100)\nrepeat (10)\n    change [brightness v] effect by (-10)\nend\n\nwhen I receive [shrink down v]\nrepeat until <(size) = [20]>\n    change size by (-10)\nend\n\nwhen I receive [grow v]\nrepeat until <(size) = [80]>\n    change size by (10)\nend\n\nwhen I receive [next level v]\npoint in direction (90)\nset [brightness v] effect to (100)\nrepeat (10)\n    change [brightness v] effect by (-10)\nend\n\nwhen I receive [rainbow v]\nrepeat (200)\n    change [color v] effect by (1)\nend\nset [color v] effect to (0)\n\nwhen I receive [normal size v]\nrepeat until <(size) = [50]>\n    change size by (-10)\nend\n\nwhen I receive [ghost v]\nrepeat (50)\n    change [ghost v] effect by (1)\nend\nwait (pick random (5) to (10)) seconds\nrepeat (50)\n    change [ghost v] effect by (-1)\nend\n\nwhen I receive [??? v]\nstart sound [Magic Spell v]\nstop [other scripts in sprite v]\nrepeat (100)\n    change [color v] effect by (10)\nend\nstart sound [Magic Spell v]\nrepeat (100)\n    change [color v] effect by (10)\n    change [fisheye v] effect by (10)\n    change [whirl v] effect by (10)\nend\nstart sound [Magic Spell v]\nrepeat (100)\n    change [color v] effect by (10)\n    change [pixelate v] effect by (10)\n    change [brightness v] effect by (2)\nend\nset rotation style [all around v]\nrepeat (10)\n    set [pitch v] effect to (pick random (50) to (100))\n    start sound [Magic Spell v]\n    glide (0.5) secs to (random position v)\n    turn right (pick random (15) to (30)) degrees\nend\nset rotation style [left-right v]\npoint in direction (90)\nglide (1) secs to x: (-134) y: (-63)\nclear graphic effects\nwait (2) seconds\nstop [all v]\n\n@Player hitbox\n\nwhen flag clicked\nset [ghost v] effect to (100)\nset size to (100) %\ngo to x: (-206) y: (-57)\nset [x velocity v] to [1]\nset [y velocity v] to [0]\nforever\n    set [x velocity v] to ((X Velocity) * (0.8))\n    change x by (X Velocity)\n    if <key (right arrow v) pressed?> then\n        change [x velocity v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        change [x velocity v] by (-1)\n    end\n    change [y velocity v] by (-0.01)\n    change y by (Y Velocity)\n    if <<key (up arrow v) pressed?> and <touching (platforms v)?>> then\n        change [y velocity v] by (0.5)\n    else\n        change [y velocity v] by (-0.5)\n    end\n    if <touching (platforms v)?> then\n        set [y velocity v] to [0]\n        change y by ((Y Velocity) * ((Y Velocity) * (2)))\n    end\n    if <<touching (platforms v)?> and <key (up arrow v) pressed?>> then\n        set [y velocity v] to [10]\n    end\n    if <touching (platforms v)?> then\n        change y by (1)\n    end\n    if <touching (platforms v)?> then\n        change y by (1)\n    end\n    if <touching (platforms v)?> then\n        change y by (1)\n    end\n    if <touching (platforms v)?> then\n        change y by (1)\n    end\n    if <(y position) < [-175]> then\n        go to x: (-211) y: (-80)\n    end\n    if <<touching (hazard v)?> or <touching (hazard potion v)?>> then\n        broadcast (Restart v)\n        Restart\n    end\n    if <key (r v) pressed?> then\n        broadcast (Restart v)\n        Restart\n        wait until <not <key (r v) pressed?>>\n    end\nend\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    if <touching (portal v)?> then\n        broadcast (Next Level v)\n        change [level v] by (1)\n        go to x: (-206) y: (-57)\n    end\nend\n\nglide (1) secs to x: (-206) y: (y position)\n\ndefine Restart\nstart sound [Oops v]\nif <(Level) = [1]> then\n    go to x: (-206) y: (-57)\nend\nif <(Level) = [2]> then\n    go to x: (-185) y: (47)\nend\nif <(Level) = [3]> then\n    go to x: (-210) y: (-56)\nend\nif <(Level) = [4]> then\n    go to x: (-110) y: (-41)\nend\nif <(Level) = [5]> then\n    go to x: (-211) y: (-80)\nend\nif <(Level) = [6]> then\n    go to x: (-211) y: (-28)\nend\nif <(Level) = [7]> then\n    go to x: (-206) y: (-68)\nend\nif <(Level) = [8]> then\n    go to x: (-203) y: (-12)\nend\nif <(Level) = [9]> then\n    go to x: (-209) y: (-60)\nend\nif <(Level) = [10]> then\n    go to x: (-213) y: (150)\nend\nif <(Level) = [11]> then\n    go to x: (-215) y: (155)\nend\n\nwhen I receive [next level v]\n\nwhen flag clicked\nset [player has key? v] to [0]\nforever\n    if <touching (key v)?> then\n        set [player has key? v] to [1]\n        set [is portal open? v] to [1]\n    end\n    if <touching (potion v)?> then\n        if <([costume name v] of [potion v]) = [shrink]> then\n            broadcast (shrink down v)\n            repeat until <(size) = [50]>\n                change size by (-10)\n            end\n        end\n        if <([costume name v] of [potion v]) = [grow]> then\n            broadcast (grow v)\n            repeat until <(size) = [160]>\n                change size by (10)\n            end\n        end\n        if <([costume name v] of [potion v]) = [rainbow]> then\n            broadcast (rainbow v)\n        end\n        if <([costume name v] of [potion v]) = [normal]> then\n            broadcast (normal size v)\n            repeat until <(size) = [100]>\n                change size by (-10)\n            end\n        end\n        if <([costume name v] of [potion v]) = [ghost]> then\n            broadcast (ghost v)\n        end\n        if <([costume name v] of [potion v]) = [???]> then\n            broadcast (??? v) and wait\n            stop [other scripts in sprite v]\n        end\n    end\nend\n\nrepeat (15)\n    move (2) steps\n    turn left (15) degrees\nend\n\nwhen I receive [next level v]\nstart sound [Teleport3 v]\nif <(Level) = [1]> then\n    go to x: (-206) y: (-57)\nend\nif <(Level) = [2]> then\n    go to x: (-185) y: (47)\nend\nif <(Level) = [3]> then\n    go to x: (-210) y: (-56)\nend\nif <(Level) = [4]> then\n    go to x: (-110) y: (-41)\nend\nif <(Level) = [5]> then\n    go to x: (-211) y: (-80)\nend\nif <(Level) = [6]> then\n    go to x: (-211) y: (-28)\nend\nif <(Level) = [7]> then\n    go to x: (-206) y: (-68)\nend\nif <(Level) = [8]> then\n    go to x: (-203) y: (-12)\nend\nif <(Level) = [9]> then\n    go to x: (-209) y: (-60)\nend\nif <(Level) = [10]> then\n    go to x: (-213) y: (150)\nend\nif <(Level) = [11]> then\n    go to x: (-215) y: (155)\nend\n\nwhen flag clicked\nforever\n    if <key (up arrow v) pressed?> then\n        play sound [Jump v] until done\n        wait until <<not <key (up arrow v) pressed?>> or <touching (platforms v)?>>\n    end\n    if <touching (key v)?> then\n        play sound [Coin v] until done\n        wait until <not <touching (key v)?>>\n    end\n    if <touching (potion v)?> then\n        play sound [Magic Spell v] until done\n        wait until <not <touching (potion v)?>>\n    end\nend\n\n@Platforms\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [pixelate v] effect to (25)\n\nwhen I receive [next level v]\nnext costume\n\n@Key\n\nwhen flag clicked\nforever\n    repeat (20)\n        change y by (0.25)\n    end\n    repeat (20)\n        change y by (-0.25)\n    end\nend\n\nwhen flag clicked\nswitch costume to (key v)\nset [pixelate v] effect to (20)\nforever\n    create clone of (key sparkle v)\nend\n\nwhen flag clicked\ngo to x: (-133) y: (111)\nset rotation style [don't rotate v]\npoint in direction (90)\nset [player has key? v] to [0]\nshow\nforever\n    if <(Player has key?) = [1]> then\n        go to (player hitbox v)\n    end\n    if <(Level) = [10]> then\n        hide\n    end\nend\n\nwhen I receive [next level v]\nset [player has key? v] to [0]\n\nwhen I receive [restart v]\nset [player has key? v] to [0]\nif <(Level) = [1]> then\n    go to x: (-133) y: (111)\nend\nif <(Level) = [2]> then\n    go to x: (184) y: (-85)\nend\nif <(Level) = [3]> then\n    go to x: (211) y: (-63)\nend\nif <(Level) = [4]> then\n    go to x: (131) y: (167)\nend\nif <(Level) = [5]> then\n    go to x: (-136) y: (151)\nend\nif <(Level) = [6]> then\n    go to x: (214) y: (-87)\nend\nif <(Level) = [7]> then\n    go to x: (208) y: (-98)\nend\nif <(Level) = [8]> then\n    go to x: (89) y: (125)\nend\nif <(Level) = [9]> then\n    go to x: (-137) y: (136)\nend\n\ngo to (random position v)\n\nwhen I receive [next level v]\nif <(Level) = [1]> then\n    go to x: (-133) y: (111)\nend\nif <(Level) = [2]> then\n    go to x: (184) y: (-85)\nend\nif <(Level) = [3]> then\n    go to x: (211) y: (-63)\nend\nif <(Level) = [4]> then\n    go to x: (131) y: (167)\nend\nif <(Level) = [5]> then\n    go to x: (-136) y: (151)\nend\nif <(Level) = [6]> then\n    go to x: (214) y: (-87)\nend\nif <(Level) = [7]> then\n    go to x: (208) y: (-98)\nend\nif <(Level) = [8]> then\n    go to x: (89) y: (125)\nend\nif <(Level) = [9]> then\n    go to x: (-137) y: (136)\nend\n\n@key sparkle\n\nwhen I start as a clone\nset [pixelate v] effect to (10)\nshow\nswitch costume to (costume1 v)\nset size to (pick random (50) to (100)) %\ngo to (key v)\nrepeat until <(Level) = [10]>\n    repeat (15)\n        turn right (15) degrees\n        point in direction (pick random (0) to (360))\n        move (5) steps\n    end\n    delete this clone\nend\ndelete this clone\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [10]> then\n        stop [other scripts in sprite v]\n    end\nend\n\n@hazard\n\nwhen flag clicked\nif <(Level) = [1]> then\n    go to x: (108) y: (-177)\nend\nif <(Level) = [2]> then\n    go to x: (108) y: (-177)\nend\nif <(Level) = [3]> then\n    go to x: (108) y: (-177)\nend\n\nwhen flag clicked\nforever\n    repeat (10)\n        change y by (0.5)\n    end\n    repeat (10)\n        change y by (-0.5)\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [pixelate v] effect to (20)\n\nwhen I receive [next level v]\nnext costume\n\n@hazard potion\n\nwhen flag clicked\nforever\n    if <<<(Level) = [6]> or <(Level) = [7]>> or <<(Level) = [8]> or <(Level) = [9]>>> then\n        show\n        if <(Level) = [6]> then\n            switch costume to (potion-a v)\n        end\n        if <(Level) = [7]> then\n            switch costume to (potion-a2 v)\n        end\n        if <(Level) = [8]> then\n            switch costume to (potion-a3 v)\n        end\n        if <(Level) = [9]> then\n            switch costume to (costume2 v)\n        end\n    else\n        hide\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\n\nhide\nforever\n    wait (pick random (5) to (10)) seconds\n    repeat (pick random (50) to (200))\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\n\nshow\nset size to (pick random (50) to (100)) %\ngo to [back v] layer\ngo to (hazard v)\nrepeat (pick random (5) to (10))\n    change y by (pick random (5) to (10))\nend\ndelete this clone\n\nchange x by (pick random (5) to (10))\nturn right (pick random (5) to (10)) degrees\nturn left (pick random (5) to (10)) degrees\n\n@Portal\n\nwhen flag clicked\nset [pixelate v] effect to (30)\nforever\n    change [whirl v] effect by (10)\nend\n\nwhen flag clicked\nhide\nset size to (10) %\nset [is portal open? v] to [0]\nforever\n    if <(Is portal open?) = [1]> then\n        show\n        repeat until <(size) = [100]>\n            change size by (10)\n        end\n    else\n        hide\n        set size to (10) %\n    end\nend\n\nwhen I receive [next level v]\nset [is portal open? v] to [0]\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        go to x: (0) y: (89)\n    end\n    if <(Level) = [2]> then\n        go to x: (-17) y: (132)\n    end\n    if <(Level) = [3]> then\n        go to x: (167) y: (102)\n    end\n    if <(Level) = [4]> then\n        go to x: (182) y: (-22)\n    end\n    if <(Level) = [5]> then\n        go to x: (182) y: (118)\n    end\n    if <(Level) = [6]> then\n        go to x: (-198) y: (-6)\n    end\n    if <(Level) = [7]> then\n        go to x: (-207) y: (143)\n    end\n    if <(Level) = [8]> then\n        go to x: (-96) y: (143)\n    end\n    if <(Level) = [9]> then\n        go to x: (185) y: (18)\n    end\nend\n\nwhen I receive [restart v]\nset [is portal open? v] to [0]\n\n@Potion\n\nwhen flag clicked\nhide\nset size to (85) %\nset [pixelate v] effect to (10)\nforever\n    if <<<(Level) = [3]> or <(Level) = [4]>> or <<<(Level) = [5]> or <(Level) = [6]>> or <<(Level) = [8]> or <(Level) = [10]>>>> then\n        if <(Level) = [3]> then\n            switch costume to (shrink v)\n            show\n            go to x: (-114) y: (108)\n        end\n        if <(Level) = [4]> then\n            switch costume to (grow v)\n            show\n            go to x: (-192) y: (8)\n        end\n        if <(Level) = [5]> then\n            switch costume to (rainbow v)\n            show\n            go to x: (-113) y: (-71)\n        end\n        if <(Level) = [6]> then\n            switch costume to (normal v)\n            show\n            go to x: (-62) y: (24)\n        end\n        if <(Level) = [8]> then\n            switch costume to (ghost v)\n            show\n            go to x: (-49) y: (-22)\n        end\n        if <(Level) = [10]> then\n            switch costume to (??? v)\n            show\n            go to x: (0) y: (-55)\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [name v]) = [rainbow]> then\n        change [color v] effect by (1)\n    else\n        if <(costume [name v]) = [???]> then\n            repeat (20)\n                change [color v] effect by (1)\n                change [brightness v] effect by (5)\n            end\n            repeat (20)\n                change [color v] effect by (1)\n                change [brightness v] effect by (-5)\n            end\n        else\n            set [color v] effect to (0)\n        end\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\nset [pixelate v] effect to (8)\n\n@Sprite4\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nwait (1) seconds\nrepeat (20)\n    change [pixelate v] effect by (10)\n    change [ghost v] effect by (5)\nend\n\n@Secret skip button\n\nwhen this sprite clicked\nbroadcast (Next Level v)\nchange [level v] by (1)\n\n
Use the arrow keys to move. Avoid touching the green hazards. Collect the key to open the portal to the next level. Try touching different potions to see what happens. Reach the end for a surprise....\n\nForum topic:\nhttps://scratch.mit.edu/discuss/topic/577704/