Labyrinth || A Platformer || A WORK IN PROGRESS

Instructions: This is just a platformer that I am working on using @griffpatch's Platforming Resources.\n\nThis is a free platformer. You don't have to always to right unless you want to. You are free to go up and down, left and right. There is no specific way to have to go.\n\nRemember, this is a work in progress, so it is not the full thing.\n\nToo laggy? Play it here: https://turbowarp.org/562204484\n\n@griffpatch commented!

@Stage\n\n@Blank\n\n@Player\n\nwhen flag clicked\nset [resistance v] to [0.8]\nset [acceleration v] to [2]\nset [jump force v] to [15]\nset [gravity v] to [-1.5]\nset [jump duration v] to [6]\nbroadcast (Setup v) and wait\nReset and begin Level\nset size to (50) %\n\ndefine Move In Steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((Speed X) / (steps))\n    Check Touching Solid\n    if <(Touching) > [0]> then\n        Colide X - Slope or Wall?\n    end\n    set [last value v] to (y position)\n    change y by ((Speed Y) / (steps))\n    Check Touching Solid\n    if <(Touching) > [0]> then\n        Colide Y - Ceiling or Floor?\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (level hitbox v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick player v]\nMoved - By Moving Platform\nswitch backdrop to <touching (level hitbox v)?>\nControls - Up and Down\nControls - Left and Right\nMove In Steps (([abs v] of (Speed X) ) + ([abs v] of (Speed Y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <<(Wall slide) > [0]> and <(Jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(Falling) < [3]> and <(Jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<[0] < (Jumping)> and <(Jumping) < (Jump Duration)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (Jump Force)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (Gravity)\n\ndefine Controls - Left and Right\nif <(Long Jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nif <(Key X) = [0]> then\n    if <<(Falling) > [2]> and <(Wall slide) < [1]>> then\n        set [speed x v] to ((Speed X) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (Speed X) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((Key X) * (Acceleration))\n    point in direction ((Key X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((Speed X) * (Resistance))\nif <(Wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(Speed Y) < [0]> then\n        set [speed y v] to ((Speed Y) * (0.6))\n    end\nend\n\ndefine Reset and begin Level\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [wall slide v] to [0]\nset [jumping v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nBegin Scene # [1] Go to X & Y [-150] [50]\n\nwhen I receive [game loop v]\nclear graphic effects\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Platforms v)\n    broadcast (Tick Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((Scene #) + (1)) Go to X & Y [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((Scene #) + (-1)) Go to X & Y [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((Scene #) + (100)) Go to X & Y [] [-140]\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((Scene #) + (-100)) Go to X & Y [] [180]\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) Go to X & Y (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [tempt v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\n    Check Touching Solid\n    if <(Touching) < [1]> then\n        point in direction (Tempt)\n        stop [this script v]\n    end\n    move (Distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(Wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(Falling) > [1]> then\n    if <(Speed Y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(Frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((Frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check Touching Solid\n        if <(Touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Colide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck Touching Solid\nif <(Touching) > [0]> then\n    change y by (1)\n    Check Touching Solid\n    if <(Touching) > [0]> then\n        change y by (-2)\n        set x to (Last Value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((Speed X) * (0.8))\nend\nset [speed x v] to ((Speed X) * (0.95))\nSlip\n\ndefine Colide Y - Ceiling or Floor?\nset y to (Last Value)\nif <[0] < (Speed Y)> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <[0] < (Falling)> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((Speed Y) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck Touching Solid\nif <(Touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck Touching Solid\nif <(Touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(Falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck Touching Solid\nset [wall slide v] to (Touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\nstart sound [Crunch v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.5) seconds\nReset and begin Level\n\ndefine Moved - By Moving Platform\nchange x by (Platform DX)\nchange y by (Platform DY)\nCheck Touching Solid\nif <(Touching) > [0]> then\n    Find Closest Space To (x position) (y position) Max [16]\n    if <(Touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find Closest Space To (x) (y) Max (max)\nset [tempt v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (Distance) steps\n        Check Touching Solid\n        if <(Touching) < [1]> then\n            point in direction (Tempt)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (Tempt)\n\nBegin Scene # [912] Go to X & Y [-150] [50]\n\nBegin Scene # [1] Go to X & Y [-150] [50]\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\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\nBegin Scene # [1] Go to X & Y [-150] [50]\n\nBegin Scene # [1] Go to X & Y [-150] [50]\n\nBegin Scene # [1] Go to X & Y [-150] [50]\n\nBegin Scene # [1] Go to X & Y [-150] [50]\n\n@Level Hitbox\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (Scene #))\n\nset [scene # v] to [0]\n\n@Level Costume\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\ngo [forward v] (1) layers\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (Scene #))\nerase all\nStamp Shadow\nStamp Outline\n\nset [scene # v] to [0]\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-20)\nstamp\nchange y by (20)\nclear graphic effects\n\ndefine Stamp Outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (10)\n    move (3) steps\n    stamp\n    move (-3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (Scene #))\ngo to x: (0) y: (0)\nif <(Scene #) = [3]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (180)) ))\n    end\nend\nif <(Scene #) = [6]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (180)) ))\n    end\nend\nif <(Scene #) = [109]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (180)) ))\n    end\nend\nif <(Scene #) = [912]> then\n    forever\n        set y to ((155) * ([sin v] of ((timer) * (50)) ))\n    end\nend\ngo to x: (0) y: (0)\n\nset [scene # v] to [0]\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nswitch costume to (scratch v)\nshow variable [scene # v]\ngo to x: (0) y: (0)\nset size to (100) %\nclear graphic effects\nhide\n\nwhen [9 v] key pressed\nif <(username) = [sayguy120]> then\n    switch backdrop to (backdrop1 v)\n    go [forward v] (100) layers\n    set [ghost v] effect to (0)\n    switch costume to (scratch v)\n    hide variable [scene # v]\n    go to x: (0) y: (0)\n    go to [front v] layer\n    set size to (100) %\n    clear graphic effects\n    show\n    stop [all v]\nend\n\n@Platform\n\nwhen I receive [change scene v]\nhide\nif <(Scene #) = [1]> then\n    switch costume to (costume1 v)\n    show\n    Animate Platform\nend\nif <(Scene #) = [110]> then\n    switch costume to (costume2 v)\n    show\n    Animate 2\nend\n\ndefine Animate Platform\ngo to x: (-25) y: (-95)\nforever\n    go to x: (-25) y: (-95)\n    glide (2) secs to x: (-5) y: (-5)\n    wait (1) seconds\n    glide (2) secs to x: (120) y: (-5)\n    wait (1) seconds\n    glide (2) secs to x: (-25) y: (-95)\n    wait (1) seconds\nend\n\nwhen I receive [tick - platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(new y) > (Last Y)> then\n    change y by (1)\nelse\n    set y to ((Last Y) + (1))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((new x) - (Last X))\n    set [platform dy v] to ((new y) - (Last Y))\nend\ngo to x: (new x) y: (new y)\n\ndefine Animate 2\ngo to x: (-14) y: (-47)\nforever\n    glide (5) secs to x: (286) y: (-47)\n    wait (1) seconds\n    glide (5) secs to x: (-456) y: (-47)\n    wait (1) seconds\nend\n\n@Level Sign\n\nwhen flag clicked\ngo to x: (0) y: (160)\nshow\nforever\n    go to [front v] layer\nend\n\n@Shadow\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    go to (player v)\n    show\nend\n\nshow\n\nif <(Scene #) = [412]> then\n    hide\nend\n\nhide\n\n@Collectables\n\nwhen I receive [change scene v]\nif <(Scene #) = (My Scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nwait until <touching (player v)?>\nset [my scene v] to []\nstart sound [Wood Tap v]\nhide\n\nwhen I receive [setup v]\n\nset [my scene v] to [1]\nswitch costume to (wood v)\ngo to x: (188) y: (57)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\n