Doodling Platformer  

Instructions: This is just a little demo of a platformer i will be making in the future!\nYou know i just wanted to try some stuff out!\nThere are 3 hidden check points as you progress\nHave fun though this is very short \nL+C by the one and only griffpatch!\nwow thank you everyone for 1000 views its crazy i had no idea!\nand 80 loves and 50 favourites!

@Stage\n\n@Hitbox\n\ndefine None\nset [lim v] to [1]\nrepeat until <<(lim) > (limit)> or <(touch) < [100]>>\n    change [@player x v] by (dx)\n    change [@player y v] by (dy)\n    change [lim v] by (1)\n    Check Collide\nend\nif <(lim) > (limit)> then\n    change [@player x v] by ((0) - ((dx) * (limit)))\n    change [@player y v] by ((0) - ((dy) * (limit)))\n    if <(@Player SX) = [0]> then\n        set [@player die v] to [1]\n    else\n        Check Collide\n        if <(@Player SX) > [0]> then\n            Move Out Of Collision dir x,y: (-1) (0) limit: (999)\n        else\n            Move Out Of Collision dir x,y: (1) (0) limit: (999)\n        end\n        set [@player sx v] to [0]\n    end\nend\n\nset [@player x v] to [3200]\nset [@scroll x v] to (@Player X)\n\nwhen flag clicked\nset [ghost v] effect to (100)\nset [@level v] to [1]\nset [@totalflags v] to [0]\nset [@timer v] to [0]\nset [@player dir v] to [90]\nset [@spawn x v] to [-180]\nset [@spawn y v] to [32]\nReset Player\nbroadcast (setup level v) and wait\nbroadcast (game loop tick v) and wait\nforever\n    change [@timer v] by (1)\n    if <(@Player Die) = [0]> then\n        Player Tick\n        if <(@Player Y) < [-200]> then\n            set [@player die v] to [25]\n        end\n    else\n        change [@player die v] by (1)\n        if <(@Player Die) > [60]> then\n            Reset Player\n        end\n    end\n    Scroll Level\n    broadcast (game loop tick v) and wait\nend\n\ndefine Scroll Level\nchange [@scroll x v] by (round (((@Player X) - (@Scroll X)) * (0.1)))\nif <(@Scroll X) < [0]> then\n    set [@scroll x v] to [0]\nend\nchange [@scroll y v] by (round (((@Player Y) - (@Scroll Y)) * (0.1)))\nif <(@Scroll Y) < [0]> then\n    set [@scroll y v] to [0]\nend\n\ndefine Player Tick\nset [pushed sx v] to [0]\nif <(on platform) = []> then\n    Check Collide\n    if <(touch) = [102]> then\n        set [pushed sx v] to ((@Platform SX) - (@Player SX))\n        change [@player x v] by (@Platform SX)\n        set [@player sx v] to [0]\n        Check Collide\n        if <<(touch) > [100]> and <not <(touch) = [102]>>> then\n            Move Out Of Collision dir x,y: (0) (1) limit: (([abs v] of (@Platform SX) ) + (2))\n            if <(@Player Die) > [0]> then\n                stop [this script v]\n            end\n            set [@player sy v] to [0]\n            set [@falling v] to [0]\n        end\n    end\nend\nif <<key (up arrow v) pressed?> and <(@Falling) < [3]>> then\n    set [@falling v] to [3]\n    set [@player sy v] to [14]\nend\nif <(@Player SY) > [-20]> then\n    change [@player sy v] by (-1.2)\nend\nchange [@player y v] by (@Player SY)\nif <not <(on platform) = []>> then\n    change [@player y v] by (-5)\n    Check Collide\n    if <not <(touch) = [102]>> then\n        change [@player y v] by (5)\n    end\nend\nset [on platform v] to [0]\nCheck Collide\nif <(touch) = [102]> then\n    set [on platform v] to (@Platform SX)\nelse\n    set [on platform v] to []\nend\nif <(touch) > [100]> then\n    if <(@Player SY) > [0]> then\n        Move Out Of Collision dir x,y: (0) (-1) limit: (999)\n        set [@falling v] to [3]\n        set [@player sy v] to [0]\n    else\n        Move Out Of Collision dir x,y: (0) (1) limit: (999)\n        set [@player sy v] to ((@Player SY) / (2))\n        set [@falling v] to [0]\n    end\nelse\n    change [@falling v] by (1)\nend\nif <key (left arrow v) pressed?> then\n    set [@player dir v] to [-90]\n    change [@player sx v] by ((((-7) + (on platform)) - (@Player SX)) * (0.2))\n    change [@walking v] by (1)\nelse\n    if <key (right arrow v) pressed?> then\n        set [@player dir v] to [90]\n        change [@player sx v] by ((((7) + (on platform)) - (@Player SX)) * (0.2))\n        change [@walking v] by (1)\n    else\n        set [@walking v] to [-1]\n        if <([abs v] of ((@Player SX) - (on platform)) ) > [1]> then\n            change [@player sx v] by (((on platform) - (@Player SX)) * (0.35))\n        else\n            set [@player sx v] to (on platform)\n        end\n    end\nend\nchange [@player x v] by (@Player SX)\nCheck Collide\nif <(touch) > [100]> then\n    Move Out Of Collision dir x,y: (0) (1) limit: (round ((([abs v] of (@Player SX) ) * (2)) + (2)))\n    if <(lim) > [2]> then\n        set [@player sx v] to ((@Player SX) * (0.6))\n    end\nend\nif <not <(pushed sx) = [0]>> then\n    change [@player sx v] by (pushed sx)\nend\n\ndefine Reset Player\nset [@player x v] to (@Spawn X)\nset [@player y v] to (@Spawn Y)\nset [@scroll x v] to (@Player X)\nset [@scroll y v] to (@Player Y)\nset [@player sx v] to [0]\nset [@player sy v] to [0]\nset [@falling v] to [0]\nset [@walking v] to [-1]\nset [@player die v] to [0]\nScroll Level\n\nmove (10) steps\n\npoint in direction (90)\n\ndefine Check Collide\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <touching (level v)?> then\n    set [touch v] to [101]\nelse\n    if <touching (moving platform ahead v)?> then\n        set [touch v] to [102]\n    else\n        set [touch v] to [0]\n    end\nend\n\nmove (10) steps\n\n@Player\n\ndefine None\nif <not <(costume#) = (costume [number v])>> then\n    switch costume to (costume#)\nend\n\nwhen I receive [setup level v]\nshow\ngo to [front v] layer\n\nwhen I receive [game loop tick v]\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <(@Player Die) = [0]> then\n    if <(last Die) > [0]> then\n        set size to (100) %\n        set [ghost v] effect to (0)\n    end\n    if <(@Falling) > [2]> then\n        if <(@Player SY) > [0]> then\n            Set Costume (2)\n        else\n            if <(@Player SY) > [-2]> then\n                Set Costume (3)\n            else\n                Set Costume (4)\n            end\n        end\n    else\n        if <(@walking) < [0]> then\n            Set Costume (1)\n        else\n            if <((@walking) mod (9)) < [3]> then\n                Set Costume (7)\n            else\n                if <((@walking) mod (9)) < [6]> then\n                    Set Costume (8)\n                else\n                    Set Costume (9)\n                end\n            end\n        end\n    end\n    if <not <(@Player Dir) = (direction)>> then\n        point in direction (@Player Dir)\n    end\nelse\n    if <(@Player Die) < [25]> then\n        set size to ((size) + (10)) %\n        change [ghost v] effect by (4)\n        change [@player y v] by (-1)\n    else\n        change [ghost v] effect by (100)\n    end\n    set [last die v] to [1]\nend\n\n@Level\n\nwhen I receive [setup level v]\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (0) (0)\nswitch costume to (l1 x1 y0 v)\nsetup clone at x,y: (1) (0)\nswitch costume to (l1 x1b y0 v)\nsetup clone at x,y: (2) (0)\nswitch costume to (l1 x2 y0 v)\nsetup clone at x,y: (3) (0)\nswitch costume to (l1 x3 y0 v)\nsetup clone at x,y: (3.7) (0.5)\nswitch costume to (l1 x4 y0 v)\nsetup clone at x,y: (4.9) (0.5)\nswitch costume to (l1 x5 y0 v)\nsetup clone at x,y: (5.6) (0)\nswitch costume to (l1 x6 y0 v)\nsetup clone at x,y: (6.6) (0)\nswitch costume to (l1 x6 y0 v)\nsetup clone at x,y: (7.7) (0)\nset [showing v] to [-1]\n\ndefine None\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (round ((x) * (460)))\nset [y v] to (round ((y) * (340)))\ncreate clone of (_myself_ v)\n\ndefine None\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\nforever\nend\n\n@moving platform\n\nwhen I receive [setup level v]\nswitch costume to (l1 x2 y0 lift v)\nsetup clone at x,y: (2) (-0.5)\nswitch costume to (barrier v)\nsetup clone at x,y: (7.9) (-0.45)\nset [showing v] to [-1]\n\ndefine None\nset [x v] to (x)\nset [y v] to (y)\n\ndefine None\ngo to x: (0) y: (0)\nhide\nset [ox v] to (round ((x) * (460)))\nset [oy v] to (round ((y) * (340)))\nset [showing v] to [0]\nmoving platform? (@timer)\ncreate clone of (_myself_ v)\n\ndefine None\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    moving platform? (@timer)\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\ndefine None\nif <(costume [number v]) = [1]> then\n    move to (round ((ox) + ((140) * ([cos v] of ((timer) * (1.4)) )))) (round ((oy) + ((70) * ([sin v] of ((timer) * (2.8)) ))))\nelse\n    if <(costume [number v]) = [2]> then\n        barrier (((timer) / (100)) mod (1)) run length (-700)\n    else\n    end\nend\n\ndefine None\nif <(percent) < [0.15]> then\n    move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((0.15) - (percent)) * (800))))\nelse\n    if <(percent) > [0.85]> then\n        move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((percent) - (0.85)) * (800))))\n    else\n        move to (round ((ox) + ((percent) * (len)))) (round (oy))\n    end\nend\nset [ox v] to (round ((7.9) * (460)))\n\n@moving platform ahead\n\nwhen I receive [setup level v]\nswitch costume to (l1 x2 y0 lift v)\nsetup clone at x,y: (2) (-0.5) width (97)\nswitch costume to (barrier v)\nsetup clone at x,y: (7.9) (-0.45) width (48)\nset [showing v] to [-1]\n\ndefine None\nif <(costume [number v]) = [1]> then\n    move to (round ((ox) + ((140) * ([cos v] of ((timer) * (1.4)) )))) (round ((oy) + ((70) * ([sin v] of ((timer) * (2.8)) ))))\nelse\n    if <(costume [number v]) = [2]> then\n        barrier (((timer) / (100)) mod (1)) run length (-700)\n    else\n    end\nend\n\ndefine None\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I start as a clone\nset [ghost v] effect to (100)\n\ndefine None\nif <([abs v] of ((@Player X) - (x)) ) < (width)> then\n    set [@platform sx v] to ((x) - (x))\nend\nset [x v] to (x)\nset [y v] to (y)\n\ndefine None\ngo to x: (0) y: (0)\nhide\nset [ox v] to (round ((x) * (460)))\nset [oy v] to (round ((y) * (340)))\nset [width v] to (((width) / (2)) + (16))\nset [showing v] to [0]\nmoving platform? (@timer)\ncreate clone of (_myself_ v)\n\ndefine None\nif <(percent) < [0.15]> then\n    move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((0.15) - (percent)) * (800))))\nelse\n    if <(percent) > [0.85]> then\n        move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((percent) - (0.85)) * (800))))\n    else\n        move to (round ((ox) + ((percent) * (len)))) (round (oy))\n    end\nend\nset [ox v] to (round ((7.9) * (460)))\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    moving platform? ((@timer) + (1))\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\n@background\n\nwhen I receive [setup level v]\ngo [backward v] (1000) layers\nset [x v] to [0]\nshow\ncreate clone of (_myself_ v)\nset [x v] to [470]\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (((@Scroll X) * (0.5)) mod (470)))) ((0) - (((@Scroll Y) * (0.5)) mod (480)))\nend\n\ndefine None\ngo to x: (x) y: (y)\n\n@Edge Fade\n\nwhen I receive [setup level v]\ngo to x: (0) y: (0)\ngo to [front v] layer\n\n@Check Points\n\ndefine None\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nchange [@totalflags v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        delete this clone\n    end\nend\n\nwhen I receive [setup level v]\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (457) (-54)\nsetup clone at x,y: (1198) (63)\nsetup clone at x,y: (2483) (62)\nsetup clone at x,y: (3705) (-54)\nset [showing v] to [-1]\n\ndefine on screen\nif <((@timer) mod (5)) = [0]> then\n    next costume\nend\nif <touching (hitbox v)?> then\n    set [showing v] to [2]\n    set [@spawn x v] to (x)\n    set [@spawn y v] to (y)\n    change [@totalflags v] by (-1)\nend\n\ndefine None\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    set size to ((size) + (15)) %\n    change [ghost v] effect by (4)\n    change [y v] by (5)\n    change [showing v] by (1)\nend\n\nwhen flag clicked\nset [ghost v] effect to (0)\nforever\nend\n\nhide\n\n@Sprite1\n\nwhen I receive [setup level v]\nset [show v] to [0]\nhide\n\nwhen I receive [game loop tick v]\nif <<(@TotalFlags) = [0]> and <(show) < [10]>> then\n    if <(show) = [0]> then\n        set [ghost v] effect to (100)\n        go to x: (0) y: (-10)\n        show\n        set [show v] to [1]\n        go to [front v] layer\n    end\n    change [ghost v] effect by (-10)\n    change [show v] by (1)\n    change y by (1)\n    broadcast (aopt timer v)\nend\n\n@Time mode\n\nwhen flag clicked\ngo to x: (222) y: (157)\nset [ghost v] effect to (30)\nshow variable [time v]\nreset timer\nforever\n    set [time v] to (timer)\nend\n\nwhen I receive [aopt timer v]\nstop [other scripts in sprite v]\n\n