Square ◆ scrolling platformer creator  #games

Instructions: Click on the "options button", to see the instructions.\nKlick auf den "Option Knopf", um die Anleitung zu sehen.\nLoved by @ceebee\n\nThere is a game like this. It's called it "above and below"!\nhttps://scratch.mit.edu/projects/229203535/\n\n~~~Updates~~~\n- 14.06.2018 the sprite "hit-box" changed\n- 17.06.2018 W,A,S and D added\n- 10.07.2019\n\nLast changes: 24 Jun 2018.

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nwait until <(Level) = [11]>\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [intro done v]\nswitch backdrop to (backdrop1 v)\nwait until <(Level) = [11]>\nswitch backdrop to (backdrop2 v)\nwait until <(Level) = [13]>\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\n@Blank\n\n@Player\n\nwhen flag clicked\nset volume to (50) %\nset [level v] to [1]\nset [deaths v] to [0]\nhide\n\ndefine Platformer Physics (speed) (friction) (jump height)\nchange [y velocity v] by (-1)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [x velocity v] by (speed)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [x velocity v] by ((0) - (speed))\nend\nset [x velocity v] to ((X Velocity) * (friction))\nchange x by (X Velocity)\nset [slope v] to [0]\nif <touching (level v)?> then\n    repeat until <<not <touching (level v)?>> or <(Slope) = [-8]>>\n        change [slope v] by (-1)\n        change y by (1)\n    end\nend\nif <touching (level v)?> then\n    change y by (Slope)\n    repeat until <not <touching (level v)?>>\n        change x by ((0) - (([abs v] of (X Velocity) ) / (X Velocity)))\n    end\n    set [x velocity v] to [0]\nend\nchange y by (Y Velocity)\nif <touching (level v)?> then\n    repeat until <not <touching (level v)?>>\n        change y by ((([abs v] of (Y Velocity) ) / (Y Velocity)) * (-1))\n    end\n    set [y velocity v] to [0]\nend\nchange y by (-1)\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> and <touching (level v)?>> then\n    set [y velocity v] to (jump height)\nend\nchange y by (1)\nif <touching (water v)?> then\n    set [y velocity v] to [-1]\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        set [y velocity v] to [5]\n    end\n    if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>> then\n        set [y velocity v] to [-5]\n    end\nend\n\ndefine Detection\nif <<(x position) = [240]> and <not <(Level) = [21]>>> then\n    broadcast (Create Clone v)\n    broadcast (Next v)\n    start sound [Ding Sound Effect v]\n    set [level v] to ((Level) + (1))\n    set [x velocity v] to [0]\n    set [y velocity v] to [0]\n    go to x: (-215) y: (-70)\nend\nif <<<<<<touching (danger v)?> or <touching (lava v)?>> or <touching (saws v)?>> or <<<touching (upspikes v)?> or <touching (downspikes v)?>> or <touching (acid v)?>>> or <(y position) = [-179]>> and <not <(CHEAT) = [1]>>> then\n    start sound [Oops v]\n    set [deaths v] to ((DEATHS) + (1))\n    repeat (3)\n        hide\n        wait (0.11) seconds\n        show\n        wait (0.11) seconds\n    end\n    hide\n    wait (0.11) seconds\n    show\n    go to x: (-215) y: (-70)\n    set [x velocity v] to [0]\n    set [y velocity v] to [0]\nend\nif <touching (bouncy v)?> then\n    start sound [Big Boing v]\n    set [y velocity v] to [18]\nend\nif <touching (trampolines v)?> then\n    set [y velocity v] to [16]\nend\n\nwhen I receive [intro done v]\npoint in direction (90)\nset size to (100) %\nset [cheat v] to [0]\nwait (0.1) seconds\nshow\nswitch costume to (player v)\ngo [forward v] (88) layers\ngo to x: (-215) y: (-78)\nset rotation style [left-right v]\nset [level v] to [1]\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nforever\n    Platformer Physics [2] [0.79] [12.5]\n    Detection\nend\n\nwhen flag clicked\nforever\n    Cheats Menu\nend\n\ndefine Cheats Menu\nif <<<key (1 v) pressed?> and <<(username) = [250119code2]> or <(username) = [250119test2]>>> and <not <(CHEAT) = [1]>>> then\n    set [cheat v] to [1]\n    wait (0.3) seconds\nelse\n    if <<key (1 v) pressed?> and <(CHEAT) = [1]>> then\n        set [cheat v] to [0]\n        wait (0.3) seconds\n    end\nend\nif <<key (up arrow v) pressed?> and <(CHEAT) = [1]>> then\n    set [y velocity v] to [8]\nend\nif <<key (down arrow v) pressed?> and <(CHEAT) = [1]>> then\n    set [y velocity v] to [-6]\nend\n\nwhen flag clicked\nforever\n    set [x v] to (round (x position))\n    set [y v] to (round (y position))\nend\n\nwhen I receive [restart v]\nstart sound [Oops v]\nset [deaths v] to ((DEATHS) + (1))\nset [x velocity v] to [0]\nset [y velocity v] to [0]\ngo to x: (-215) y: (-70)\n\nbroadcast (Restart v)\n\nwhen I receive [jump v]\nset [y velocity v] to [8]\n\nwhen I receive [transition v]\ngo to x: (-215) y: (-70)\nset [x velocity v] to [0]\nset [y velocity v] to [0]\n\nwhen flag clicked\nwait until <(Level) = [6]>\nbroadcast (Create Clone v)\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\ngo [backward v] (33) layers\n\n@Danger\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to (Level)\nend\n\nglide (1) secs to x: (0) y: (0)\n\nglide (1) secs to x: (0) y: (10)\n\n@text\n\nwhen flag clicked\nhide\ngo to [front v] layer\nwait (2.4) seconds\ngo to x: (0) y: (-60)\nset size to (100) %\nset [ghost v] effect to (100)\nshow\nset [rotation v] to [-10]\nrepeat (70)\n    change [ghost v] effect by (rotation)\n    change [rotation v] by (-1)\n    wait (0.01) seconds\nend\nset [ghost v] effect to (0)\n\nwhen I receive [message1 v]\nhide\n\nwhen I receive [intro done v]\nhide\n\n@Intro\n\nwhen flag clicked\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\ncreate clone of (_myself_ v)\nset [id v] to [3]\ncreate clone of (_myself_ v)\nset [id v] to [4]\ncreate clone of (_myself_ v)\nstart sound [Never Mind v]\nswitch costume to (1 v)\nshow\ngo to x: (0) y: (0)\npoint in direction (-90)\nset size to (300) %\nset [sine v] to [30]\nrepeat (40)\n    change size by (((100) - (size)) * (1))\n    turn right (((90) - (direction)) * (0.18)) degrees\nend\nset [glide v] to [7]\nrepeat (20)\n    change y by ((glide) - (1))\n    change [glide v] by (-0.34)\nend\nwait (5.8) seconds\nhide\n\nwhen I start as a clone\nif <(id) = [1]> then\n    clear graphic effects\n    show\n    go to x: (0) y: (0)\n    point in direction (90)\n    set size to (100) %\n    switch costume to (bg v)\nelse\n    if <(id) = [2]> then\n        id 2\n    else\n        if <(id) = [3]> then\n            id 3\n        else\n            id 4\n        end\n    end\nend\n\ndefine id 2\ngo to x: (0) y: (0)\nswitch costume to (dot2 v)\nhide\nclear graphic effects\ngo to [front v] layer\nwait (7) seconds\nshow\nset size to (0.5) %\nset [vel v] to [1]\nswitch costume to (dot v)\nrepeat (50)\n    switch costume to (dot2 v)\n    change [vel v] by ((size) / (50))\n    change size by (vel)\n    switch costume to (dot v)\nend\nbroadcast (Intro Done v)\n\nwhen I receive [intro done v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\ndefine id 3\ngo to x: (0) y: (0)\nswitch costume to (dot2 v)\nhide\nclear graphic effects\ngo to [front v] layer\nwait (7.2) seconds\nshow\nset size to (0.5) %\nset [vel v] to [1]\nswitch costume to (dot v)\nrepeat (50)\n    switch costume to (dot2 v)\n    change [vel v] by ((size) / (50))\n    change size by (vel)\n    switch costume to (smaller dot v)\nend\n\ndefine id 4\ngo to x: (0) y: (0)\nswitch costume to (dot2 v)\nhide\nclear graphic effects\ngo to [front v] layer\nwait (7.4) seconds\nshow\nset size to (0.5) %\nset [vel v] to [1]\nswitch costume to (dot v)\nrepeat (50)\n    switch costume to (dot2 v)\n    change [vel v] by ((size) / (50))\n    change size by (vel)\n    switch costume to (crazy dot v)\n    turn left (1) degrees\nend\n\n@Text\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [back v] layer\nforever\n    switch costume to (Level)\nend\n\n@Decoration\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nforever\n    go [backward v] (99) layers\n    switch costume to (Level)\nend\n\n@Lava\n\nwhen I start as a clone\ngo [backward v] (1) layers\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nforever\n    switch costume to (Level)\n    set y to (([sin v] of ((timer) * (100)) ) * (10))\nend\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Saws\n\nwhen flag clicked\nhide\n\ndefine Clone At X: (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [next v]\nif  then\n    delete this clone\nend\nif <(Level) = [4]> then\n    Clone At X: [-41] [-60]\nend\nif <(Level) = [6]> then\n    Clone At X: [106] [-100]\nend\nif <(Level) = [7]> then\n    Clone At X: [220] [-10]\nend\nif <(Level) = [8]> then\n    Clone At X: [210] [-30]\nend\nif <(Level) = [11]> then\n    Clone At X: [-125] [-100]\nend\nif <(Level) = [14]> then\n    Clone At X: [-92] [-100]\nend\nif <(Level) = [15]> then\n    Clone At X: [-130] [-90]\nend\nif <(Level) = [17]> then\n    Clone At X: [-14] [-20]\n    Clone At X: [-125] [36]\nend\nif <(Level) = [18]> then\n    Clone At X: [160] [-110]\n    Clone At X: [-186] [53]\n    Clone At X: [199] [90]\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    change [line v] by (1)\n    point in direction ((90) + (([sin v] of ((line) * (2)) ) * (300)))\nend\n\n@Water\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    go [backward v] (88) layers\n    switch costume to (Level)\n    set [ghost v] effect to (30)\n    set y to (([sin v] of ((timer) * (100)) ) * (5))\nend\n\nset [ghost v] effect to (30)\n\n@Enemies\n\nwhen I receive [restart v]\ndelete this clone\n\ndefine Clone (x) (y)\ngo to x: (x) y: (y)\nset rotation style [all around v]\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nshow\npoint in direction (90)\nrepeat (10)\n    change [ghost v] effect by (-10)\n    turn right (5) degrees\nend\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\nrepeat (10)\n    change [ghost v] effect by (10)\n    turn right (5) degrees\nend\nhide\n\nwhen I receive [create clone v]\nhide\nClone Create\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    set rotation style [left-right v]\n    clear graphic effects\n    set size to (100) %\n    show\n    go [forward v] (11) layers\n    set [enemyx v] to [0]\n    set [enemyy v] to [0]\n    forever\n        change [enemyy v] by (-1)\n        if <([x position v] of [player v]) < ((x position) - (10))> then\n            change [enemyx v] by (-0.4)\n            point in direction (-90)\n        end\n        if <((x position) - (-10)) < ([x position v] of [player v])> then\n            change [enemyx v] by (0.4)\n            point in direction (90)\n        end\n        set [enemyx v] to ((Enemyx) * (0.9))\n        change x by (Enemyx)\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (-4)\n            change x by ((Enemyx) * (-1))\n        end\n        change y by (Enemyy)\n        if <touching (level v)?> then\n            change y by ((Enemyy) - ((Enemyy) * (2)))\n            set [enemyy v] to [0]\n        end\n        change y by (-1)\n        if <<((y position) - (-120)) < ([y position v] of [player v])> and <touching (level v)?>> then\n            set [enemyy v] to [14]\n        end\n        if <<touching (level v)?> and <<touching (player v)?> and <(([y position v] of [player v]) - (10)) > (y position)>>> then\n            set [y2 v] to [15]\n            broadcast (Jump v)\n            repeat (10)\n                change [ghost v] effect by (10)\n                change [enemyy v] by (1)\n            end\n            delete this clone\n        end\n        change y by (1)\n        switch costume to (costume3 v)\n        create clone of (_myself_ v)\n        switch costume to (costume2 v)\n        if <touching (player v)?> then\n            broadcast (Restart v)\n            broadcast (Create Clone v)\n        end\n    end\nelse\n    show\n    clear graphic effects\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen flag clicked\nset [amount v] to [1]\nset [speed v] to [1]\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    if <([y position v] of [player v]) = (y position)> then\n        if <<(Level) = [8]> = <(Level) = [20]>> then\n            set [enemyy v] to [14]\n        end\n    end\n    if <touching (trampolines v)?> then\n        set [enemyy v] to [16]\n    end\nend\n\ndefine Clone Create\nif  then\n    delete this clone\nend\nif <(Level) = [6]> then\n    Clone [214] [-37]\nend\nif <(Level) = [8]> then\n    Clone [33] [7]\nend\nif <(Level) = [10]> then\n    Clone [206] [-83]\nend\nif <(Level) = [11]> then\n    Clone [207] [28]\nend\nif <(Level) = [14]> then\n    Clone [216] [71]\nend\nif <(Level) = [19]> then\n    Clone [210] [23]\n    Clone [38] [-6]\nend\nif <(Level) = [20]> then\n    Clone [33] [17]\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Skip\n\nwhen flag clicked\nwait until <(Level) = [21]>\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [intro done v]\nshow\nswitch costume to (costume1 v)\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [intro done v]\nwait (0.8) seconds\n\nwhen this sprite clicked\nbroadcast (Transition v)\nbroadcast (Next v)\nbroadcast (Create Clone v)\nchange [level v] by (1)\n\nwhen flag clicked\nwait until <(Level) = [11]>\nswitch costume to (costume2 v)\nwait until <(Level) = [14]>\nswitch costume to (costume1 v)\n\nwhen I receive [intro done v]\nwait until <(Level) = [21]>\nhide\n\n@Transition\n\nwhen I receive [transition v]\nshow\ngo to [front v] layer\ngo to [front v] layer\nwait (0.8) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\n@Music Button\n\nwhen flag clicked\nswitch costume to (costume1 v)\nwait until <(Level) = [11]>\nif <(volume) = [0]> then\n    switch costume to (costume4 v)\nelse\n    switch costume to (costume3 v)\nend\nwait until <(Level) = [14]>\nif <(volume) = [0]> then\n    switch costume to (costume2 v)\nelse\n    switch costume to (costume1 v)\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen flag clicked\nhide\n\nwhen I receive [intro done v]\nshow\nswitch costume to (costume1 v)\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [intro done v]\nwait (0.8) seconds\nset volume to (50) %\nforever\n    play sound [Waysons - Eternal Minds \[NCS Release\] v] until done\nend\n\nwhen this sprite clicked\nif <(volume) = [50]> then\n    switch costume to ((costume [number v]) + (1))\n    set volume to (0) %\nelse\n    switch costume to ((costume [number v]) - (1))\n    set volume to (50) %\nend\n\nwhen flag clicked\nwait until <(Level) = [21]>\nhide\n\nwhen flag clicked\nwait until <(Level) = [21]>\nhide\n\n@Trampolines\n\nwhen flag clicked\nhide\n\ndefine Clone at X: (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\ngo to [back v] layer\npoint in direction (90)\n\nwhen I start as a clone\nshow\nif <(Level) = [11]> then\n    switch costume to (costume6 v)\nelse\n    switch costume to (costume1 v)\nend\nclear graphic effects\nforever\n    if <<touching (enemies v)?> or <touching (player v)?>> then\n        set volume to (50) %\n        start sound [Big Boing v]\n        repeat (4)\n            next costume\n        end\n        repeat (4)\n            switch costume to ((costume [number v]) - (1))\n        end\n        wait (0.2) seconds\n    end\nend\n\nwhen I receive [done v]\ndelete this clone\n\nwhen I receive [next v]\nif  then\n    delete this clone\nend\nif <(Level) = [7]> then\n    Clone at X: [-116] [-75]\nend\nif <(Level) = [9]> then\n    Clone at X: [-119] [-22]\n    Clone at X: [57] [-73]\nend\nif <(Level) = [10]> then\n    Clone at X: [30] [-73]\n    Clone at X: [140] [-73]\nend\nif <(Level) = [11]> then\n    Clone at X: [161] [-73]\nend\nif <(Level) = [13]> then\n    Clone at X: [-48] [-73]\nend\nif <(Level) = [14]> then\n    Clone at X: [106] [-73]\nend\n\nif <(Level) = [20]> then\n    Clone at X: [14] [30]\nend\n\nbroadcast (Next v)\n\n@Clouds\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset [side v] to (pick random (1) to (2))\nshow\nset [ghost v] effect to (pick random (20) to (25))\ngo to [back v] layer\nswitch costume to (pick random (1) to (2))\nif <(side) = [1]> then\n    go to x: (300) y: (pick random (150) to (100))\n    repeat until <(x position) < [-290]>\n        change x by (-0.5)\n    end\n    delete this clone\nend\nif <(side) = [2]> then\n    go to x: (-300) y: (pick random (150) to (100))\n    repeat until <(x position) > [270]>\n        change x by (0.5)\n    end\n    delete this clone\nend\n\nwhen I receive [intro done v]\nrepeat until <(Level) = [11]>\n    create clone of (_myself_ v)\n    wait (pick random (30) to (40)) seconds\nend\n\n@UpSpikes\n\nwhen flag clicked\nforever\n    switch costume to (Level)\n    set size to (100) %\n    go to x: (0) y: (-10)\n    glide (0.2) secs to x: (0) y: (-40)\n    wait (0.6) seconds\n    glide (0.4) secs to x: (0) y: (-10)\nend\n\nwhen flag clicked\ngo to [back v] layer\nhide\n\nwhen I receive [intro done v]\nshow\n\n@DownSpikes\n\nwhen flag clicked\nforever\n    switch costume to (Level)\n    set size to (100) %\n    go to x: (0) y: (10)\n    glide (0.2) secs to x: (0) y: (40)\n    wait (0.6) seconds\n    glide (0.4) secs to x: (0) y: (10)\nend\n\nwhen flag clicked\ngo to [back v] layer\nhide\n\nwhen I receive [intro done v]\nshow\n\n@Acid\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to (Level)\n    set [ghost v] effect to (20)\nend\n\n