Dreams– A Platformer (More coming soon!)

Instructions: Normal controls!

@Stage\n\n@Scratch Cat\n\nwhen I receive [green flag clicked v]\npoint in direction (90)\nset [level v] to [1]\nset size to (40) %\nset rotation style [left-right v]\ngo to x: (-200) y: (0)\nshow\nset [speed y v] to [0]\nset [falling? v] to [10]\nforever\n    if <(Can Move?) = [1]> then\n        switch costume to (hitbox v)\n        if <<(speed y) < [4]> or <<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>>> then\n            change [speed y v] by (-1)\n        else\n            change [speed y v] by (-2)\n        end\n        change y by (speed y)\n        Touch Ground <(speed y) > [0]>\n        if <(wall jump) > [0]> then\n            change [wall jump v] by (-1)\n        else\n            set [speed x v] to ((speed x) * (0.7))\n            if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>>> then\n                change [speed x v] by (-1.5)\n            end\n            if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n                change [speed x v] by (1.5)\n            end\n        end\n        if <touching (water v)?> then\n            set [speed y v] to ((speed y) * (0.5))\n            if <<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n                change [speed y v] by (3)\n            end\n        end\n        if <(speed x) < [-0.5]> then\n            Walk (-90) (speed x)\n        else\n            if <(speed x) > [0.5]> then\n                Walk (90) (speed x)\n            else\n                set [frame v] to [0]\n            end\n        end\n        if <<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n            if <<(jump key) = [0]> and <(falling?) < [3]>> then\n                if <(Sound Effects?) = [1]> then\n                    start sound [Jump v]\n                end\n                set [speed y v] to [14]\n                set [falling? v] to [6]\n                set [jump key v] to [1]\n            end\n        else\n            set [jump key v] to [0]\n        end\n        if <(y position) < [-180]> then\n            go to x: (-200) y: (0)\n            Reset\n            set [speed y v] to [0]\n        end\n        if <touching (spikes v)?> then\n            switch costume to (die2 v)\n            if <(Sound Effects?) = [1]> then\n                start sound [whoop v]\n            end\n            repeat (20)\n                change [ghost v] effect by (5)\n            end\n            set [ghost v] effect to (0)\n            Reset\n            go to x: (-200) y: (0)\n        end\n        if <touching (bounce v)?> then\n            set [speed y v] to [25]\n        end\n        if <touching (portal v)?> then\n            if <not <(LEVEL) = (Total Levels)>> then\n                if <(Sound Effects?) = [1]> then\n                    start sound [Connect v]\n                end\n                Reset\n                change [level v] by (1)\n            end\n        end\n        Set Costume\n    else\n        Set Costume\n    end\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (w v) pressed?> or <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> and <([abs v] of (speed) ) > [3]>> then\n        if <(wall jump) = [0]> then\n            if <(Sound Effects?) = [1]> then\n                start sound [Jump v]\n            end\n            set [speed x v] to ((-1.2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [15]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\nif <(speed) < [0]> then\n    change [frame v] by ((speed) / (-10))\nelse\n    change [frame v] by ((speed) / (10))\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand2 v)\n    else\n        switch costume to ([floor v] of ((5) + ((frame) mod (17))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (run_j1 v)\n    else\n        switch costume to (run_j2 v)\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine Reset\npoint in direction (90)\nset size to (40) %\nset rotation style [left-right v]\ngo to x: (-200) y: (0)\nshow\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [falling? v] to [10]\n\nwhen I receive [skip v]\nReset\nchange [level v] by (1)\n\nwhen I receive [retry v]\nReset\n\nwhen I receive [start menu v]\n\n@Ground\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen I receive [start menu v]\nforever\n    if <(Music?) = [1]> then\n        play sound [bensound-anewbeginning v] until done\n    end\nend\n\nwhen I receive [start menu v]\nforever\n    switch costume to (LEVEL)\nend\n\nwhen I receive [start menu v]\nforever\n    if <(Music?) = [0]> then\n        set volume to (0) %\n    else\n        set volume to (100) %\n    end\nend\n\n@Intro\n\ndefine Next\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nnext costume\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [skip intro v]\nstop [other scripts in sprite v]\nbroadcast (Green Flag clicked v)\nbroadcast (Green Flag clicked v)\nhide\n\nwhen I receive [setup v]\n\nbroadcast (Fade v)\n\nwhen I receive [start intro v]\nswitch costume to (costume2 v)\nshow\nwait (0) seconds\ngo to [front v] layer\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nNext\nwait (3) seconds\nbroadcast (Fade v)\nrepeat (50)\n    change [ghost v] effect by (2)\n    broadcast (Green Flag clicked v)\nend\nbroadcast (Green Flag clicked v)\nbroadcast (Green Flag clicked v)\n\nNext\nwait (3) seconds\n\n@Sprite1\n\nwhen flag clicked\ngo to [front v] layer\nclear graphic effects\nshow\n\nwhen I receive [fade v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\nwhen I receive [skip intro v]\nhide\n\n@Decor\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag clicked v]\nshow\ngo to [front v] layer\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\n@Spikes\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\n@Water\n\nwhen flag clicked\nclear graphic effects\nhide\ngo to x: (0) y: (0)\nset [me v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change y by (-5)\n    change [brightness v] effect by (-10)\n    change [me v] by (1)\nend\n\nwhen I start as a clone\nshow\nforever\n    set [ghost v] effect to (60)\n    go to [back v] layer\n    switch costume to (LEVEL)\n    set y to ((([sin v] of (((timer) + (me)) * (300)) ) * (8)) - ((me) * (10)))\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@Portal\n\nwhen flag clicked\ncreate clone of (_myself_ v)\nforever\n    broadcast (Position Portal v)\n    turn right (5) degrees\n    set [ghost v] effect to (50)\nend\n\nwhen I start as a clone\nforever\n    set [ghost v] effect to (50)\n    turn left (5) degrees\nend\n\nwhen I receive [position portal v]\nPosition (((LEVEL) mod (Total Levels)) + (0))\n\ndefine Position (level)\nif <(level) = [1]> then\n    go to x: (190) y: (30)\nend\nif <(level) = [2]> then\n    go to x: (130) y: (100)\nend\nif <(level) = [3]> then\n    go to x: (25) y: (100)\nend\nif <(level) = [4]> then\n    go to x: (-180) y: (140)\nend\nif <(level) = [5]> then\n    go to x: (190) y: (-20)\nend\nif <(level) = [6]> then\n    go to x: (130) y: (-20)\nend\nif <(level) = [7]> then\n    go to x: (190) y: (-50)\nend\nif <(level) = [8]> then\n    go to x: (190) y: (-50)\nend\nif <(level) = [9]> then\n    go to x: (150) y: (-140)\nend\nif <(level) = [10]> then\n    go to x: (-200) y: (130)\nend\nif <(level) = [0]> then\n    go to x: (150) y: (-50)\nend\n\nwhen I receive [skip intro v]\n\n@Background Effects\n\nwhen flag clicked\n\nwhen I start as a clone\ngo to (random position v)\nset x to (240)\nif <(Game Started?) = [1]> then\n    set [ghost v] effect to (pick random (80) to (99))\nelse\n    if <(Game Started?) = [2]> then\n        set [ghost v] effect to (pick random (98) to (99))\n    else\n        set [ghost v] effect to (pick random (90) to (99))\n    end\nend\nshow\nset size to (pick random (50) to (120)) %\ngo to [front v] layer\npoint in direction (pick random (-75) to (-105))\nset [speed v] to (pick random (4) to (5))\nrepeat until <(x position) < [-220]>\n    go to [front v] layer\n    move (Speed) steps\nend\ndelete this clone\n\nwhen I receive [start menu v]\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I receive [start menu v]\ndelete this clone\n\nwhen flag clicked\nset [game started? v] to [0]\n\nwhen I receive [green flag clicked v]\nset [game started? v] to [2]\n\nwhen I receive [start intro v]\nset [game started? v] to [1]\n\n@Bounce\n\nwhen flag clicked\nhide\n\nwhen I receive [green flag clicked v]\nhide\nforever\n    set [my level v] to (LEVEL)\n    Spawn Level (My Level)\n    wait until <not <(My Level) = (LEVEL)>>\nend\n\nwhen I start as a clone\nswitch costume to (1 v)\nshow\nset [my level v] to (LEVEL)\nrepeat until <not <(My Level) = (LEVEL)>>\n    if <touching (scratch cat v)?> then\n        if <not < ([costume name v] of [scratch cat v]) contains [Die ]?>> then\n            switch costume to (1 v)\n            repeat (6)\n                next costume\n            end\n        end\n    end\nend\ndelete this clone\n\ndefine Spawn Level (level)\nif <(level) = [6]> then\n    go to x: (-165) y: (-69)\n    create clone of (_myself_ v)\nend\nif <(level) = [7]> then\n    go to x: (-180) y: (-75)\n    create clone of (_myself_ v)\nend\n\nif <(level) = [4]> then\n    go to x: (-140) y: (-80)\n    create clone of (_myself_ v)\nend\n\n@Skip Intro\n\nwhen flag clicked\nrepeat (2)\n    broadcast (Setup v)\nend\nforever\n    go to [front v] layer\nend\n\nwhen I receive [green flag clicked v]\nstop [other scripts in sprite v]\nhide\n\nwhen this sprite clicked\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nhide\nbroadcast (Skip Intro v)\n\nwhen I receive [skip intro v]\nhide\n\nwhen I receive [setup v]\nwait (0.1) seconds\ngo to [front v] layer\n\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [start intro v]\nshow\n\n@Skip\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        go to [front v] layer\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Menu Showing?) = [1]> then\n        Hide/Show\n        show\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nreset timer\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nif <not <(Total Levels) = (LEVEL)>> then\n    broadcast (Skip v)\nend\n\nif <(Sound Effects?) = [1]> then\n\ndefine Hide/Show\nshow\nif <<touching (scratch cat v)?> or <touching (ground v)?>> then\n    hide\nend\n\n@Retry\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        go to [front v] layer\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Menu Showing?) = [1]> then\n        Hide/Show\n        show\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nreset timer\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nbroadcast (Retry v)\n\ndefine Hide/Show\nshow\nif <<touching (scratch cat v)?> or <touching (ground v)?>> then\n    hide\nend\n\n@Gui\n\nwhen flag clicked\nforever\n    go to (mouse-pointer v)\n    Sense\nend\n\ndefine Sense\nswitch costume to (sense v)\nshow\nset [ghost v] effect to (20)\ngo to [front v] layer\nif <touching (skip v)?> then\n    switch costume to (skip v)\nelse\n    if <touching (retry v)?> then\n        switch costume to (retry v)\n    else\n        if <touching (skip intro v)?> then\n            switch costume to (skip intro v)\n        else\n            if <touching (help v)?> then\n                switch costume to (help v)\n            else\n                if <touching (menu v)?> then\n                    switch costume to (menu v)\n                else\n                    hide\n                end\n            end\n        end\n    end\nend\n\nif <touching (play button v)?> then\n\nswitch costume to (play game v)\n\n@Help\n\nwhen flag clicked\nset [can move? v] to [1]\nforever\n    if <touching (mouse-pointer v)?> then\n        go to [front v] layer\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Menu Showing?) = [1]> then\n        Hide/Show\n        show\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nreset timer\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nwait until <not <mouse down?>>\nif <(Can Move?) = [1]> then\n    set [can move? v] to [0]\nelse\n    set [can move? v] to [1]\nend\n\nif  then\nend\n\ndefine Hide/Show\nshow\nif <<touching (scratch cat v)?> or <touching (ground v)?>> then\n    hide\nend\n\n@Help Menu\n\nwhen flag clicked\n\nwhen this sprite clicked\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nset [can move? v] to [1]\nhide\n\nwhen I receive [start menu v]\nforever\n    set [ghost v] effect to (20)\n    if <(Can Move?) = [0]> then\n        show\n        go to [front v] layer\n    else\n        hide\n    end\nend\n\n@Start Screen\n\nwhen flag clicked\n\nwhen I receive [start intro v]\nhide\n\nwait (0.1) seconds\ngo to [front v] layer\n\nwhen I receive [start menu v]\nshow\nwait (0.1) seconds\ngo to [front v] layer\n\n@Play Button\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nhide\nbroadcast (Start Intro v)\n\nwhen flag clicked\n\nwhen I receive [start menu v]\nshow\nforever\n    point in direction ((([sin v] of ((timer) * (300)) ) * (5)) + (90))\n    if <touching (mouse-pointer v)?> then\n        set size to (120) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen I receive [start menu v]\nrepeat (10)\n    go to [front v] layer\n    wait (0.001) seconds\nend\n\n@Settings\n\nwhen flag clicked\ngo to x: (169) y: (-156)\nset [settings showing? v] to [0]\nshow\nrepeat (10)\n    wait (0.1) seconds\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nreset timer\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nif <(Settings Showing?) = [1]> then\n    set [settings showing? v] to [0]\nelse\n    set [settings showing? v] to [1]\nend\n\nwhen I receive [start menu v]\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Settings Showing?) = [1]> then\n        change x by (((110) - (x position)) / (4))\n    else\n        change x by (((210) - (x position)) / (4))\n    end\n    if <(timer) > [3]> then\n        set [settings showing? v] to [0]\n    end\nend\n\n@Music\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [music? v] to [1]\nforever\n    if <(Settings Showing?) = [1]> then\n        show\n    else\n        hide\n    end\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Music?) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen this sprite clicked\nif <(Music?) = [1]> then\n    set [music? v] to [0]\nelse\n    set [music? v] to [1]\nend\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\n\nwhen flag clicked\nrepeat (10)\n    wait (0.1) seconds\n    go to [front v] layer\nend\n\n@SFX\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [music? v] to [1]\nforever\n    if <(Settings Showing?) = [1]> then\n        show\n    else\n        hide\n    end\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Sound Effects?) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen this sprite clicked\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nif <(Sound Effects?) = [1]> then\n    set [sound effects? v] to [0]\nelse\n    set [sound effects? v] to [1]\nend\n\nwhen flag clicked\nrepeat (10)\n    wait (0.1) seconds\n    go to [front v] layer\nend\n\n@Menu\n\nwhen flag clicked\nbroadcast (Start Menu v)\nwait (0.1) seconds\nbroadcast (Start Menu v)\nset [menu showing? v] to [0]\nforever\n    if <touching (mouse-pointer v)?> then\n        go to [front v] layer\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (60)\n    end\n    if <(Menu Showing?) = [1]> then\n        change x by (((-129) - (x position)) / (2))\n    else\n        change x by (((-218) - (x position)) / (2))\n    end\n    if <(timer) > [2]> then\n        set [menu showing? v] to [0]\n    end\nend\n\nwhen this sprite clicked\nreset timer\nif <(Sound Effects?) = [1]> then\n    start sound [Click v]\nend\nif <(Menu Showing?) = [1]> then\n    set [menu showing? v] to [0]\nelse\n    set [menu showing? v] to [1]\nend\n\n@Grunge\n\nwhen flag clicked\n\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset [ghost v] effect to (90)\n\nrepeat until <(timer) > [5]>\nend\n\n@Buttons Assets\n\n