Stickman Adventures 3 || Platformer

Instructions: PART 2 IS OUT!: https://scratch.mit.edu/projects/596517364/\nINSTRUCTIONS:\nuse arrow keys, down arrow to duck. avoid spikes, saws, lava and the evil king's minions. when you see the big red guy that you can't jump over go to the door to go inside. at the end when you find your buddies go to them to continue.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint: Konami code.

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop3 v)\nforever\n    play sound [floodwaters music v] until done\nend\n\nwhen I receive [start game v]\nswitch backdrop to (backdrop2 v)\n\nwhen [r v] key pressed\nbroadcast (reset level v)\n\nwhen [p v] key pressed\n\nchange [game level v] by (1)\nbroadcast (reset level v)\n\nwhen [o v] key pressed\n\nchange [game level v] by (-1)\nbroadcast (reset level v)\n\n@Player\n\ndefine rise\nif <(water) = [1]> then\n    change [yv v] by (-0.5)\nelse\n    change [yv v] by (-1)\nend\nchange [in air? v] by (1)\nchange y by (yv)\nrepeat until <not <<touching (levelhitbox v)?> or <touching (block v)?>>>\n    if <(yv) > [0]> then\n        change y by ((-1) * (yv))\n    else\n        set [in air? v] to [0]\n        if <(water) = [1]> then\n            change y by (0.1)\n        else\n            change y by (1)\n        end\n    end\n    set [yv v] to [0]\nend\n\ndefine change x by (x)\nset [x change v] to (x)\nchange x by (x)\nrepeat (3)\n    if <<touching (levelhitbox v)?> or <touching (block v)?>> then\n        change y by (1)\n    end\nend\nif <<touching (levelhitbox v)?> or <touching (block v)?>> then\n    set [xv v] to [0]\n    change y by (-3)\n    change x by ((-1) * (x))\nend\n\ndefine check for water\nset [water v] to [0]\nset [speed v] to [3.5]\nset [jump height v] to [9]\nif <touching (water v)?> then\n    go to [back v] layer\n    if <(time since bounce?) > [20]> then\n        set [jump height v] to [1.2]\n        set [speed v] to [2]\n        set [water v] to [1]\n    end\nend\n\ndefine begin\nset [game level v] to [1]\ngo to x: (-200) y: (-96)\nset size to (40) %\nset rotation style [left-right v]\npoint in direction (90)\nset [yv v] to [0]\nset [in air? v] to [0]\nset [water v] to [0]\nbroadcast (reset level v)\nshow\n\ndefine set animations\nchange [frame v] by (0.3)\nif <(frame) > [2.5]> then\n    set [frame v] to [0.5]\nend\n\ndefine set correct costume\nswitch costume to (player v)\nif <([abs v] of (x change) ) > [0]> then\n    switch costume to (round (frame))\nend\nif <(in air?) > [1]> then\n    if <(yv) > [0]> then\n        switch costume to (jump v)\n    else\n        switch costume to (fall v)\n    end\nend\nif <(water) = [1]> then\n    if <([abs v] of (x change) ) > [0]> then\n        switch costume to ((round (frame)) + (4))\n    end\nend\n\nswitch costume to (swim v)\n\nwhen I receive [reset level v]\nset [xv v] to [0]\nset [yv v] to [0]\nset x to (-224)\nif <(GAME LEVEL) = [1]> then\n    go to x: (-200) y: (-96)\nend\nif <(GAME LEVEL) = [2]> then\n    go to x: (-224) y: (-72)\nend\nif <(GAME LEVEL) = [3]> then\n    go to x: (-224) y: (-6)\nend\nif <(GAME LEVEL) = [4]> then\n    go to x: (-224) y: (-39)\nend\nif <(GAME LEVEL) = [5]> then\n    go to x: (-224) y: (-45)\nend\nif <(GAME LEVEL) = [6]> then\n    go to x: (-224) y: (-165)\nend\nif <(GAME LEVEL) = [7]> then\n    go to x: (-224) y: (24)\nend\nif <(GAME LEVEL) = [8]> then\n    go to x: (-224) y: (-160)\nend\nif <(GAME LEVEL) = [9]> then\n    go to x: (-224) y: (-147)\nend\nif <(GAME LEVEL) = [10]> then\n    go to x: (-224) y: (38)\nend\nif <(GAME LEVEL) = [11]> then\n    go to x: (-224) y: (-9)\nend\nif <(GAME LEVEL) = [12]> then\n    go to x: (-224) y: (-54)\nend\nif <(GAME LEVEL) = [13]> then\n    go to x: (-224) y: (-73)\nend\nif <(GAME LEVEL) = [14]> then\n    go to x: (-224) y: (-128)\nend\nif <(GAME LEVEL) = [15]> then\n    go to x: (-224) y: (-80)\nend\nif <(GAME LEVEL) = [16]> then\n    go to x: (-224) y: (-161)\nend\nif <(GAME LEVEL) = [17]> then\n    go to x: (-224) y: (102)\nend\nif <(GAME LEVEL) = [18]> then\n    go to x: (-224) y: (-168)\nend\nif <(GAME LEVEL) = [19]> then\n    go to x: (-224) y: (133)\nend\nif <(GAME LEVEL) = [20]> then\n    go to x: (-224) y: (-157)\nend\n\nwhen I receive [start game v]\nbegin\nforever\n    change [time since bounce? v] by (1)\n    switch costume to (hitbox v)\n    go to [front v] layer\n    go [backward v] (2) layers\n    set [x change v] to [0]\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change x by (speed)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        change x by ((-1) * (speed))\n    end\n    set [xv v] to ((xv) * (0.93))\n    if <(in air?) = [0]> then\n        set [xv v] to ((xv) * (0.4))\n    end\n    determine x velocity (xv)\n    rise\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<(in air?) < [3]> or <(water) = [1]>>> then\n        if <(water) = [0]> then\n            set [yv v] to (jump height)\n        else\n            change [yv v] by (jump height)\n        end\n    end\n    if <(water) = [1]> then\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            change [yv v] by ((-6) * (jump height))\n        end\n        if <(yv) < [0]> then\n            set [yv v] to ((yv) * (0.2))\n        else\n            set [yv v] to ((yv) * (0.9))\n        end\n    end\n    check for water\n    if <<touching (spikes v)?> or <(y position) < [-208]>> then\n        broadcast (reset level v)\n    end\n    if <(x position) > [240]> then\n        change [game level v] by (1)\n        broadcast (reset level v)\n    end\n    if <(x position) < [-235]> then\n        set x to (-235)\n    end\n    set animations\n    set correct costume\n    broadcast (TICK v) and wait\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [bounce player v]\nset [time since bounce? v] to [0]\nset [yv v] to [20]\n\nwhen I receive [bounce player right v]\nset [yv v] to [15]\nset [xv v] to [22]\nset [time since bounce? v] to [0]\n\ndefine determine x velocity (x)\nchange x by (x)\nrepeat (6)\n    if <<touching (levelhitbox v)?> or <touching (block v)?>> then\n        change y by (1)\n    end\nend\nif <<touching (levelhitbox v)?> or <touching (block v)?>> then\n    change y by (-6)\n    change x by ((-1) * (x))\nend\n\nwhen I receive [bounce player left v]\nset [time since bounce? v] to [0]\nset [yv v] to [15]\nset [xv v] to [-22]\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\nwhen [o v] key pressed\nif <(GAME LEVEL) > [1]> then\n    broadcast (reset level v)\n    change [game level v] by (-1)\n    broadcast (reset level v)\n    broadcast (TICK v)\nend\n\nwhen [p v] key pressed\nif <(GAME LEVEL) < [20]> then\n    change [game level v] by (1)\n    broadcast (reset level v)\n    broadcast (TICK v)\nend\n\n@level\n\nwhen I receive [tick v]\nshow\ngo to (levelhitbox v)\ngo to [front v] layer\ngo [backward v] (9) layers\nset [ghost v] effect to (0)\nswitch costume to ([costume # v] of [levelhitbox v])\n\nwhen flag clicked\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@levelhitbox\n\nwhen I receive [tick v]\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (GAME LEVEL)\ngo to [back v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@water\n\nwhen flag clicked\nhide\nset y to (4)\n\nwhen I receive [tick v]\nset x to (0)\nshow\nif <(y position) > [3]> then\n    set [change y v] to [-0.2]\nend\nif <(y position) < [-3]> then\n    set [change y v] to [0.2]\nend\nchange y by (change y)\nswitch costume to ([costume # v] of [levelhitbox v])\nset [ghost v] effect to (60)\ngo to [front v] layer\ngo [backward v] (11) layers\nset size to (101) %\n\nif <(y position) > [3]> then\n    set [change y v] to [-0.2]\nend\nif <(y position) < [-3]> then\n    set [change y v] to [0.2]\nend\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@rain\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset x to (42)\nset size to (120) %\nshow\n\nwhen I receive [tick v]\nswitch costume to (rain type)\nset [brightness v] effect to (100)\nif <(rain type) = [1]> then\n    go to [front v] layer\n    go [backward v] (14) layers\n    set [ghost v] effect to (95)\n    change [y v] by (-3)\n    set y to (y)\n    change x by (-0.5)\n    if <(y) < [-420]> then\n        set x to (42)\n        set [y v] to [432]\n        set y to (y)\n    end\nend\nif <(rain type) = [2]> then\n    go to [back v] layer\n    set [ghost v] effect to (97)\n    change [y v] by (-2)\n    set y to (y)\n    change x by (-0.3)\n    if <(y) < [-420]> then\n        set x to (42)\n        set [y v] to [432]\n        set y to (y)\n    end\nend\n\ndefine create rain (#)\nset [rain type v] to (#)\nset [y v] to [432]\ncreate clone of (_myself_ v)\nset [y v] to [0]\ncreate clone of (_myself_ v)\n\nwhen I receive [start game v]\ncreate rain [1]\ncreate rain [2]\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@top thing\n\nwhen I receive [tick v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [backward v] (12) layers\n\nwhen flag clicked\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@Enemy\n\nwhen I receive [tick v]\nset size to (40) %\nif <(clone?) = [1]> then\n    switch costume to (hitbox v)\n    set rotation style [left-right v]\n    change [var changer v] by (1)\n    if <(var changer) > (pick random (100) to (150))> then\n        set [movement type v] to (pick random (1) to (4))\n        set [var changer v] to [0]\n        if <(movement type) = [4]> then\n            set [frame2 v] to [7]\n        end\n    end\n    if <(x position) > [230]> then\n        set [movement type v] to [2]\n    end\n    if <(x position) < [-230]> then\n        set [movement type v] to [1]\n    end\n    set [x change v] to [0]\n    set [speed v] to [1]\n    if <(movement type) = [1]> then\n        point in direction (90)\n        change x by (speed)\n    end\n    if <(movement type) = [2]> then\n        point in direction (-90)\n        change x by ((-1) * (speed))\n    end\n    rise\n    if <touching (player v)?> then\n        broadcast (reset level v)\n    end\n    if <(y position) < [-180]> then\n        delete this clone\n    end\n    set animations\n    set correct costume\nend\n\ndefine change x by (x)\nset [x change v] to (x)\nchange x by (x)\nrepeat (3)\n    if <touching (levelhitbox v)?> then\n        change y by (1)\n    end\nend\nif <touching (levelhitbox v)?> then\n    change y by (-3)\n    change x by ((-1) * (x))\nend\n\ndefine rise\nchange [yv v] by (-1)\nchange [in air? v] by (1)\nchange y by (yv)\nrepeat until <not <touching (levelhitbox v)?>>\n    if <(yv) > [0]> then\n        change y by ((-1) * (yv))\n    else\n        set [in air? v] to [0]\n        change y by (1)\n    end\n    set [yv v] to [0]\nend\n\ndefine set correct costume\nswitch costume to (slime2 v)\nif <([abs v] of (x change) ) > [0]> then\n    switch costume to (frame)\nend\nif <(movement type) = [4]> then\n    switch costume to (frame2)\nend\n\ndefine set animations\nchange [frame v] by (0.5)\nif <(frame) > [6.5]> then\n    set [frame v] to [1.5]\nend\nchange [frame2 v] by (0.3)\nif <(frame2) > [15.5]> then\n    set [frame2 v] to [7]\n    if <(movement type) = [4]> then\n        set [movement type v] to (pick random (1) to (3))\n    end\nend\n\nwhen flag clicked\nset [clone? v] to [0]\nhide\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nset [clone? v] to [1]\n\nwhen I receive [reset level v]\nrepeat (1)\n    delete this clone\nend\nset [yv v] to [0]\nif <(GAME LEVEL) = [8]> then\n    goo beast at X [40] Y [-135]\nend\nif <(GAME LEVEL) = [14]> then\n    goo beast at X [188] Y [-70]\nend\nif <(GAME LEVEL) = [16]> then\n    goo beast at X [-180] Y [16]\nend\n\nif <(GAME LEVEL) = [10]> then\n    goo beast at X [43] Y [-153]\n    goo beast at X [142] Y [-142]\nend\n\ndefine goo beast at X (x) Y (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@Spikes\n\nwhen I receive [tick v]\nshow\ngo to (levelhitbox v)\ngo to [front v] layer\ngo [backward v] (11) layers\nset [ghost v] effect to (0)\nswitch costume to ([costume # v] of [levelhitbox v])\nset size to (101) %\n\nwhen flag clicked\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@light\n\nwhen I receive [tick v]\nreset timer\nif <([ended? v] of [ending v]) = [0]> then\n    switch costume to (superzoom v)\n    set size to (200) %\n    switch costume to (light v)\n    go to (player v)\n    hide\n    go to [front v] layer\n    if <[darkness levels v] contains (GAME LEVEL)?> then\n        show\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen I receive [end v]\nset [ghost v] effect to (100)\nswitch costume to (light2 v)\nshow\ngo to [front v] layer\nrepeat (80)\n    change [ghost v] effect by (-1.25)\nend\nbroadcast (END GAME v)\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.2)\nswitch costume to (thumbnail v)\ngo to [front v] layer\ngo to x: (0) y: (0)\nset size to (100) %\nshow\n\nwhen I receive [start game v]\nstop [other scripts in sprite v]\n\n@story\n\nwhen flag clicked\ngo to x: (0) y: (-380)\nswitch costume to (costume1 v)\nshow\nrepeat (900)\n    change y by (1)\n    if <mouse down?> then\n        broadcast (START GAME v)\n        repeat (40)\n            change [ghost v] effect by (2.5)\n            change y by (1)\n        end\n        stop [this script v]\n    end\nend\nbroadcast (START GAME v)\nrepeat (40)\n    change [ghost v] effect by (2.5)\n    change y by (1)\nend\nhide\n\nwhen I receive [start game v]\nwait (5) seconds\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@bouncy\n\nwhen I receive [reset level v]\nhide\nrepeat (1)\n    delete this clone\nend\nif <(GAME LEVEL) = [10]> then\n    bounce at X [79] Y [-162] type? [1]\nend\nif <(GAME LEVEL) = [15]> then\n    bounce at X [50] Y [-90] type? [1]\nend\nif <(GAME LEVEL) = [16]> then\n    bounce at X [167] Y [-147] type? [1]\nend\nif <(GAME LEVEL) = [17]> then\n    bounce at X [-200] Y [-80] type? [2]\n    bounce at X [75] Y [-111] type? [1]\nend\nif <(GAME LEVEL) = [18]> then\n    bounce at X [-28] Y [-80] type? [3]\n    bounce at X [-232] Y [30] type? [2]\n    bounce at X [119] Y [-107] type? [1]\n    bounce at X [5] Y [34] type? [2]\nend\n\ndefine bounce at X (x) Y (y) type? (#)\ngo to x: (x) y: (y)\nset [type? v] to (#)\nset [clone? v] to [false]\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nset [clone? v] to [true]\nshow\n\nwhen I receive [tick v]\nif <(clone?) = [true]> then\n    go to [front v] layer\n    go [backward v] (14) layers\n    if <(bounced?) > [2]> then\n        switch costume to (1 v)\n    end\n    change [bounced? v] by (1)\n    if <(type?) = [1]> then\n        point in direction (90)\n        if <<touching (player v)?> and <<([y position v] of [player v]) > ((y position) + (6))> and <([yv v] of [player v]) < [0]>>> then\n            set [bounced? v] to [0]\n            switch costume to (2 v)\n            broadcast (bounce player v)\n        end\n    end\n    if <(type?) = [2]> then\n        point in direction (180)\n        if <<touching (player v)?> and <([x position v] of [player v]) > ((x position) + (15))>> then\n            set [bounced? v] to [0]\n            switch costume to (2 v)\n            broadcast (bounce player right v)\n        end\n    end\n    if <(type?) = [3]> then\n        point in direction (0)\n        if <<touching (player v)?> and <([x position v] of [player v]) < ((x position) - (15))>> then\n            set [bounced? v] to [0]\n            switch costume to (2 v)\n            broadcast (bounce player left v)\n        end\n    end\nend\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@KEY\n\ndefine key at X (x) Y (y)\ngo to x: (x) y: (y)\nset [cloner? v] to [1]\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [reset level v]\nset [key collected v] to [true]\nrepeat (1)\n    delete this clone\nend\nif <(GAME LEVEL) = [19]> then\n    key at X [-53] Y [-27]\nend\n\nwhen I start as a clone\nset [cloner? v] to [0]\nset [touched player? v] to [0]\nset [ghost effect v] to [0]\nset [key collected v] to [false]\nclear graphic effects\nset size to (40) %\nshow\n\nwhen I receive [tick v]\nif <(cloner?) = [0]> then\n    if <(distance to [player v]) < [35]> then\n        set [touched player? v] to [true]\n    end\n    if <(touched player?) = [true]> then\n        change [ghost effect v] by (5)\n        change y by (2)\n        turn right (2) degrees\n        set [ghost v] effect to (ghost effect)\n        change size by (-1)\n        if <(ghost effect) > [95]> then\n            set [key collected v] to [true]\n            delete this clone\n        end\n    else\n        set [ghost effect v] to [0]\n        if <(size) > [48]> then\n            set [size changer? v] to [-0.2]\n        end\n        if <(size) < [40]> then\n            set [size changer? v] to [0.2]\n        end\n        change size by (size changer?)\n        turn right (1) degrees\n    end\nend\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n@block\n\nwhen I receive [tick v]\nshow\ngo to (levelhitbox v)\ngo to [front v] layer\ngo [backward v] (10) layers\nset [ghost v] effect to (0)\nswitch costume to ([costume # v] of [levelhitbox v])\nif <(KEY COLLECTED) = [true]> then\n    change [ghost effect v] by (5)\n    if <(ghost effect) > [95]> then\n        hide\n    end\nelse\n    set [ghost effect v] to [0]\nend\nset [ghost v] effect to (ghost effect)\n\nwhen I receive [reset level v]\nset [ghost effect v] to [0]\n\n@ending\n\nwhen I receive [tick v]\nhide\nif <(ended?) = [0]> then\n    if <(GAME LEVEL) = [20]> then\n        delete this clone\n    end\n    if <(GAME LEVEL) = [20]> then\n        switch costume to (costume1 v)\n        show\n        go to x: (0) y: (0)\n        go to [front v] layer\n        go [backward v] (12) layers\n        if <touching (player v)?> then\n            create clone of (_myself_ v)\n            if <key (e v) pressed?> then\n                set [tick counter v] to [0]\n                set [ghost v] effect to (100)\n                set [ended? v] to [1]\n            end\n        end\n    end\nelse\n    change [tick counter v] by (1)\n    change [ghost v] effect by (-3)\n    switch costume to (costume4 v)\n    go to [front v] layer\n    go [backward v] (1) layers\n    show\n    if <<key (any v) pressed?> and <(tick counter) > [20]>> then\n        broadcast (end v)\n    end\nend\n\nwhen I receive [reset level v]\n\nwhen I start as a clone\nswitch costume to (costume3 v)\ngo to [front v] layer\ngo to (player v)\nchange y by (55)\n\nwhen flag clicked\nset [ended? v] to [0]\nhide\n\nwhen I receive [end game v]\nstop [other scripts in sprite v]\nhide\n\n