Puzzle Platformer Demo v.0.1B #all #games

Instructions: Puzzle Platformer Demo v.0.1B\n- - - - -\nAll art by me via Scratch Vector. Even though the one off button looks like the mario version, I had to draw it myself!\n\nAll code by me, and some where confusing and difficult but I managed it :)\n\nCredits:\nMe for art, code\nMario for sfx and inspiration\nMusic- SMM2: SMB1 Ghost House Theme\n- - - - -

@Stage\n\nwhen flag clicked\nforever\n    play sound [Ghost House \(Super Mario Bros v] until done\nend\n\n@Player\n\ndefine physics <touch>\nset [x v] to (x position)\nset [y v] to (y position)\ngo to [front v] layer\nclear graphic effects\nchange [yv v] by (-1)\nif <touching (trampoline v)?> then\n    start sound [Boing sound effect v]\n    change [yv v] by (20)\nend\nif <key (r v) pressed?> then\n    broadcast (Reset v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    go to x: (-200) y: (-45)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    point in direction (90)\n    change [xv v] by (0.9)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    point in direction (-90)\n    change [xv v] by (-0.9)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by (1)\nend\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by (1)\nend\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by (1)\nend\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by (1)\nend\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\nend\nchange y by (Yv)\nif <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<<key (up arrow v) pressed?> or <mouse down?>> and <<touching (platforms v)?> or <<touching (key door v)?> or <<<touching (on v)?> and <[on] = (ON/OFF STATUS)>> or <<touching (off v)?> and <[off] = (ON/OFF STATUS)>>>>>> then\n    if <touching (trampoline v)?> then\n        change [yv v] by (20)\n    else\n        change [yv v] by (14)\n    end\nend\nchange y by (1)\nif <(x position) > [235]> then\n    change [level v] by (1)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    reset\n    go to x: (-215) y: (item (Level) of [spawn points v])\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\nif <<<touching (boss 1 v)?> or <<touching (spikes v)?> or <touching (enemies v)?>>> or <(y position) < [-175]>> then\n    start sound [Crunch v]\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    reset\n    go to x: (-215) y: (item (Level) of [spawn points v])\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\nif <[-145] > (y position)> then\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    go to x: (-200) y: (-45)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\nwhen flag clicked\ngo to x: (-215) y: (item (Level) of [spawn points v])\nswitch costume to (costume1 v)\nforever\n    physics <>\nend\n\ndefine reset\nset [xv v] to [0]\nset [yv v] to [0]\n\ndelete all of [spawn points v]\nadd [-40] to [spawn points v]\nadd [-115] to [spawn points v]\nadd [-115] to [spawn points v]\n\nwhen I receive [glide v]\nSmooth Glide x: (_t10) y: (_t11) speed: [3] ghost: [0]\n\ndefine Smooth Glide x: (x) y: (y) speed: (i) ghost: (ghost)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((round (x)) - (round (x position))) / (i))\n    change y by (((round (y)) - (round (y position))) / (i))\n    change [ghost v] effect by (ghost)\nend\ngo to x: (x) y: (y)\n\nwhen I receive [move v]\nstop [other scripts in sprite v]\nbroadcast (glide v)\nwait (.5) seconds\nstop [other scripts in sprite v]\ngo to x: (_t10) y: (_t11)\n\nwhen I receive [free v]\nstop [other scripts in sprite v]\nwait (.1) seconds\nforever\n    physics <>\nend\n\n@Platforms\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    switch costume to (Level)\nend\n\n@Guide\n\ndefine Smooth Glide x: (x) y: (y) speed: (i) ghost: (ghost)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((round (x)) - (round (x position))) / (i))\n    change y by (((round (y)) - (round (y position))) / (i))\n    change [ghost v] effect by (ghost)\nend\ngo to x: (x) y: (y)\n\nwhen flag clicked\nset [level v] to [1]\nCloning until level: [10]\n\nwhen I start as a clone\nif <(costume [name v]) = [Level 1: 1]> then\n    set [ghost v] effect to (100)\n    show\n    go to x: (0) y: (-50)\n    Smooth Glide x: (0) y: (0) speed: (3) ghost: [-10]\n    End system level [1]\nelse\n    if <(costume [name v]) = [Level 1: 2]> then\n        set [ghost v] effect to (100)\n        show\n        go to x: (0) y: (-50)\n        wait (.5) seconds\n        Smooth Glide x: (0) y: (0) speed: (3) ghost: [-10]\n        End system level [1]\n    else\n        if <(costume [name v]) = [Level 2: 1]> then\n            set [ghost v] effect to (100)\n            show\n            go to x: (170) y: (39)\n            Smooth Glide x: (170) y: (89) speed: (3) ghost: [-10]\n            End system level [2]\n        else\n            if <(costume [name v]) = [Level 2: 2]> then\n                set [ghost v] effect to (100)\n                show\n                go to x: (170) y: (39)\n                wait (.5) seconds\n                Smooth Glide x: (170) y: (89) speed: (3) ghost: [-10]\n                End system level [2]\n            else\n                if <(costume [name v]) = [Level 3: 1]> then\n                    set [ghost v] effect to (100)\n                    show\n                    go to x: (170) y: (39)\n                    Smooth Glide x: (170) y: (89) speed: (3) ghost: [-10]\n                    End system level [3]\n                else\n                    if <(costume [name v]) = [Level 3: 2]> then\n                        set [ghost v] effect to (100)\n                        show\n                        go to x: (40) y: (39)\n                        wait (.5) seconds\n                        Smooth Glide x: (40) y: (89) speed: (3) ghost: [-10]\n                        End system level [3]\n                    else\n                        if <(costume [name v]) = [Level 4: 1]> then\n                            set [ghost v] effect to (100)\n                            show\n                            go to x: (170) y: (39)\n                            Smooth Glide x: (170) y: (89) speed: (3) ghost: [-10]\n                            End system level [4]\n                        else\n                            if <(costume [name v]) = [Level 4: 2]> then\n                                set [ghost v] effect to (100)\n                                show\n                                go to x: (40) y: (39)\n                                wait (.5) seconds\n                                Smooth Glide x: (40) y: (89) speed: (3) ghost: [-10]\n                                End system level [4]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine End system level (lvl)\nwait until <not <(Level) = (lvl)>>\nrepeat (5)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\ndefine Cloning until level: (lvl)\nhide\nswitch costume to (level 1: 1 v)\ncreate clone of (_myself_ v)\nrepeat until <(lvl) = (Level)>\n    set [_t1 v] to (Level)\n    repeat until <not <(letter (7) of (costume [name v])) = (_t1)>>\n        create clone of (_myself_ v)\n        next costume\n    end\n    wait until <(Level) = ((_t1) + (1))>\nend\n\n@Key\n\ndefine Smooth Glide x: (x) y: (y) speed: (i) ghost: (ghost)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((round (x)) - (round (x position))) / (i))\n    change y by (((round (y)) - (round (y position))) / (i))\n    change [ghost v] effect by (ghost)\nend\ngo to x: (x) y: (y)\n\nwhen flag clicked\nset [key equipped? v] to [0]\nhide\nCreate a key at level [2] x,y of [-139] [91] And size: [90]\n\ndefine Create a key at level (lvl) x,y of (x) (y) And size: (size)\nswitch costume to (key v)\ngo to x: (x) y: (y)\nset size to (size) %\nset [_t2 v] to (lvl)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nhide\nwait until <(Level) = (_t2)>\nset [_t3 v] to (y position)\nshow\nforever\n    if <touching (player v)?> then\n        change [key equipped? v] by (1)\n        set size to (70) %\n        start sound [recording1 v]\n        Smooth Glide x: [210] y: [-168] speed: [3] ghost: [0]\n        set [_t3 v] to (Key Equipped?)\n        wait until <<(Key Equipped?) = ((_t3) - (1))> or <not <(Level) = (_t2)>>>\n        delete this clone\n    end\n    set y to ((([sin v] of ((timer) * (100)) ) * (2)) + (_t3))\nend\n\n@Key Door\n\ndefine Create a key door at level (lvl) x,y of (x) (y) And size: (size)\nhide\nswitch costume to (door v)\ngo to x: (x) y: (y)\nset size to (size) %\nset [_t4 v] to (lvl)\ncreate clone of (_myself_ v)\nset [_t8 v] to (join (x position) (join [|] (join (y position) (join [|] (join (size) (join [|] (_t4)))))))\nbroadcast (SETUP v) and wait\ncreate clone of (key activation v)\n\nwhen flag clicked\nCreate a key door at level [2] x,y of [2] [-105] And size: [100]\n\nwhen I start as a clone\nhide\nwait until <(Level) = (_t4)>\nshow\nwait until <[1] = (Key Equipped?)>\nwait until <[0] = (Key Equipped?)>\nstart sound [Door v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\n@On\n\ndefine Create on-off Element: [ON/OFF/SWITCH] (element) At x, y: (x) (y) Size: (sz) Level: (lvl)\nset [_t6 v] to (lvl)\nif <(element) = [ON]> then\n    if <(ON/OFF STATUS) = [on]> then\n        switch costume to (on -y v)\n    else\n        switch costume to (on -n v)\n    end\nelse\n    if <(element) = [OFF]> then\n        if <(ON/OFF STATUS) = [on]> then\n            switch costume to (off -n v)\n        else\n            switch costume to (off -y v)\n        end\n    else\n        if <(ON/OFF STATUS) = [on]> then\n            switch costume to (on v)\n        else\n            switch costume to (off v)\n        end\n    end\nend\ngo to x: (x) y: (y)\nset size to (sz) %\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [on/off status v] to [on]\nhide\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-122] [-100] Size: [100] Level: [3]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-122] [-132] Size: [100] Level: [3]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-124] [37] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-92] [37] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-92] [4] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-59] [4] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-59] [37] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [6] [37] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-60] [-29] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-106] [68] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-9] [68] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-27] [38] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [ON] At x, y: [-27] [4] Size: [100] Level: [4]\n\nwhen I start as a clone\nwait until <(_t6) = (Level)>\nshow\nforever\n    go to [front v] layer\n    go [backward v] (2) layers\n    if <(ON/OFF STATUS) = [on]> then\n        switch costume to (on -y v)\n    else\n        switch costume to (on -n v)\n    end\n    if <not <(_t6) = (Level)>> then\n        delete this clone\n    end\nend\n\n@Off\n\ndefine Create on-off Element: [ON/OFF/SWITCH] (element) At x, y: (x) (y) Size: (sz) Level: (lvl)\nset [_t5 v] to (lvl)\nif <(element) = [ON]> then\n    if <(ON/OFF STATUS) = [on]> then\n        switch costume to (on -y v)\n    else\n        switch costume to (on -n v)\n    end\nelse\n    if <(element) = [OFF]> then\n        if <(ON/OFF STATUS) = [on]> then\n            switch costume to (off -n v)\n        else\n            switch costume to (off -y v)\n        end\n    else\n        if <(ON/OFF STATUS) = [on]> then\n            switch costume to (on v)\n        else\n            switch costume to (off v)\n        end\n    end\nend\ngo to x: (x) y: (y)\nset size to (sz) %\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\nset [on/off status v] to [on]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [40] [-132] Size: [100] Level: [3]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [40] [-100] Size: [100] Level: [3]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [59] [65] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [141] [65] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [45] [-9] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [78] [-27] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [110] [-27] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [142] [-27] Size: [100] Level: [4]\nCreate on-off Element: [ON/OFF/SWITCH] [OFF] At x, y: [174] [-9] Size: [100] Level: [4]\n\nwhen I start as a clone\nwait until <(_t5) = (Level)>\nshow\nforever\n    go to [front v] layer\n    go [backward v] (2) layers\n    if <(ON/OFF STATUS) = [on]> then\n        switch costume to (off -n v)\n    else\n        switch costume to (off -y v)\n    end\n    if <not <(_t5) = (Level)>> then\n        delete this clone\n    end\nend\n\n@Switch\n\nwhen flag clicked\nhide\nCreate on-off Element: At x, y: [-163] [133] Size: [100] Level: [3] Dir: [90]\nCreate on-off Element: At x, y: [10] [-17] Size: [100] Level: [3] Dir: [0]\nCreate on-off Element: At x, y: [-164] [-131] Size: [100] Level: [4] Dir: [90]\nCreate on-off Element: At x, y: [164] [-131] Size: [100] Level: [4] Dir: [90]\n\ndefine Create on-off Element: At x, y: (x) (y) Size: (sz) Level: (lvl) Dir: (dir)\npoint in direction (dir)\nset [_t7 v] to (lvl)\ngo to x: (x) y: (y)\nset size to (sz) %\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nwait until <(_t7) = (Level)>\nshow\nif <(ON/OFF STATUS) = [on]> then\n    switch costume to (on v)\nelse\n    switch costume to (off v)\nend\nforever\n    if <(ON/OFF STATUS) = [on]> then\n        switch costume to (off v)\n    else\n        switch costume to (on v)\n    end\n    go to [front v] layer\n    go [backward v] (2) layers\n    if <touching (player v)?> then\n        say [Press A To Activate]\n        if <key (a v) pressed?> then\n            wait until <not <key (a v) pressed?>>\n            if <(ON/OFF STATUS) = [on]> then\n                set [on/off status v] to [off]\n                switch costume to (off v)\n            else\n                set [on/off status v] to [on]\n                switch costume to (on v)\n            end\n        end\n    else\n        say []\n    end\n    if <not <(_t7) = (Level)>> then\n        delete this clone\n    end\nend\n\n@Key Activation\n\nwhen flag clicked\nhide\n\ndefine Gather DATA\ngo to [back v] layer\nset [_c1 v] to [1]\nset [_temp v] to []\nrepeat until <(letter (_c1) of (_t8)) = [|]>\n    set [_temp v] to (join (_temp) (letter (_c1) of (_t8)))\n    change [_c1 v] by (1)\nend\nset x to ((_temp) + (-48))\nchange [_c1 v] by (1)\nset [_temp v] to []\nrepeat until <(letter (_c1) of (_t8)) = [|]>\n    set [_temp v] to (join (_temp) (letter (_c1) of (_t8)))\n    change [_c1 v] by (1)\nend\nchange [_c1 v] by (1)\nset y to (_temp)\nset [_temp v] to []\nrepeat until <(letter (_c1) of (_t8)) = [|]>\n    set [_temp v] to (join (_temp) (letter (_c1) of (_t8)))\n    change [_c1 v] by (1)\nend\nset size to (_temp) %\nchange [_c1 v] by (1)\nset [_temp v] to []\nrepeat until <<(letter (_c1) of (_t8)) = []> or <(letter (_c1) of (_t8)) = [|]>>\n    set [_temp v] to (join (_temp) (letter (_c1) of (_t8)))\n    change [_c1 v] by (1)\nend\nset [_t9 v] to (_temp)\nset [_temp v] to []\n\nwhen I receive [setup v]\nGather DATA\n\nwhen I start as a clone\nswitch costume to (idle v)\nwait until <(_t9) = (Level)>\nshow\nforever\n    if <touching (player v)?> then\n        say [Press Space To Activate]\n        if <key (space v) pressed?> then\n            wait until <not <key (space v) pressed?>>\n            set [_t10 v] to (x position)\n            set [_t11 v] to (y position)\n            broadcast (Move v)\n            start sound [Bump v]\n            repeat (7)\n                next costume\n            end\n            repeat (2)\n                switch costume to (loop1 v)\n                repeat (5)\n                    next costume\n                end\n                if <(Key Equipped?) > [0]> then\n                    set [key equipped? v] to [0]\n                    start sound [BrickShatter v]\n                else\n                end\n                switch costume to (intro7 v)\n                repeat (7)\n                    switch costume to ((costume [number v]) - (1))\n                end\n                broadcast (free v)\n            end\n        end\n    else\n        say []\n    end\n    go to [front v] layer\n    go [backward v] (2) layers\n    if <not <(_t9) = (Level)>> then\n        delete this clone\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\n