【PART3】[2D]MINECRAFT PLATFORMER

Instructions: ------------ 》| Stranded 3 |《 ------------\n~ Use WASD, ARROW, or TOUCH controls to move around. Platform to the checkpoints. Space to skip cutscenes and press P to pause the game.\n\n------------ 》Update Notes《 ------------\n[Mar. 18] ~ Game released!\n[Mar. 19] ~ Bug fixes\n[Mar. 21] ~ Crashes and level bug fixes\n[Mar. 23] ~ New level art for some stages\n\n------------ 》Future Plans《 ------------\n~ Extra levels\n~ Bug fixes\n~ more features

@Stage\n\nwhen flag clicked\nset [level v] to [1]\nbroadcast (LoadLevel v)\nforever\n    reset timer\nend\n\nwhen [timer v] > (1)\nbroadcast (Show.Thumbnail v)\n\nwhen I receive [loadlevel v]\nbroadcast (ResetPlayer v)\n\nwhen flag clicked\nset volume to (40) %\nforever\n    play sound [Backround2 - Kevin MacLeod Wallpaper v] until done\n    play sound [Backround6 - Kevin MacLeod Off to Osaka v] until done\nend\n\n@PlatformerHitbox\n\nwhen I receive [resetplayer v]\ngo to x: (-200) y: (-75)\nset [ghost v] effect to (0)\nset size to (125) %\nshow\nset [player.xv v] to [0]\nset [player.yv v] to [0]\nset [player.jumpforce v] to [12]\nset [player.walljumpxforce v] to [10]\nset [player.walljumpyforce v] to [12]\nforever\n    set [player.ycoll v] to [0]\n    set [player.wall v] to [0]\n    show\n    switch costume to (r v)\n    if <touching (goal v)?> then\n        change [level v] by (1)\n        broadcast (LoadLevel v)\n        stop [this script v]\n    end\n    ChangeXv\n    change x by (player.xv)\n    CheckForCollosion\n    if <(collision) = [1]> then\n        if <(player.xv) > [0]> then\n            set [player.wall v] to [right]\n        else\n            set [player.wall v] to [left]\n        end\n        CheckForWall [5]\n    end\n    ChangYv\n    change y by (player.yv)\n    CheckForCollosion\n    if <(collision) = [1]> then\n        ChangeY ((player.yv) / ([abs v] of (player.yv) ))\n    end\n    if <<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <mouse down?>> and <not <(player.ycoll) = [ceiling]>>> then\n        JumpCheck\n    end\n    set [player.x v] to (x position)\n    set [player.y v] to (y position)\n    if <(y position) < [-170]> then\n        broadcast (ResetPlayer v)\n        broadcast (Sound.Death v)\n    end\n    hide\nend\n\ndefine CheckForWall (length)\nrepeat (length)\n    CheckForCollosion\n    if <(collision) = [1]> then\n        change y by (1)\n    end\nend\nCheckForCollosion\nif <(collision) = [1]> then\n    change y by (() - (length))\n    if <(player.xv) > [0]> then\n        ChangeX ([ceiling v] of ((player.xv) / ([abs v] of (player.xv) )) )\n    else\n        ChangeX ([floor v] of ((player.xv) / ([abs v] of (player.xv) )) )\n    end\nend\n\ndefine ChangeY (power)\nif <(power) > [0]> then\n    set [player.ycoll v] to [ceiling]\nelse\n    set [player.ycoll v] to [ground]\nend\nrepeat ([abs v] of (player.yv) )\n    CheckForCollosion\n    if <(collision) = [1]> then\n        change y by (() - (power))\n    end\nend\nset [player.yv v] to [0]\n\ndefine ChangeX (power)\nrepeat ([abs v] of (player.xv) )\n    CheckForCollosion\n    if <(collision) = [1]> then\n        change x by (() - (power))\n    end\nend\nset [player.xv v] to [0]\n\ndefine ChangeXv\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(Player.X) > (mouse x)> and <mouse down?>>> then\n    change [player.xv v] by (-1)\n    set [player.direction v] to [L]\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > (Player.X)> and <mouse down?>>> then\n    change [player.xv v] by (1)\n    set [player.direction v] to [R]\nend\nset [player.xv v] to ((player.xv) * (0.85))\n\ndefine ChangYv\nchange [player.yv v] by (-1)\n\ndefine JumpCheck\nif <(player.ycoll) = [ground]> then\n    change [player.yv v] by (player.jumpforce)\nelse\n    if <(player.wall) = [right]> then\n        change [player.xv v] by (() - (player.WallJumpXForce))\n        set [player.yv v] to (player.WallJumpYForce)\n    end\n    if <(player.wall) = [left]> then\n        change [player.xv v] by (player.WallJumpXForce)\n        set [player.yv v] to (player.WallJumpYForce)\n    end\nend\n\ndefine CheckForCollosion\nset [collision v] to [0]\nif <<color (#605aff) is touching (#5af300)?> or <color (#605aff) is touching (#ad8200)?>> then\n    set [collision v] to [1]\nend\nif <color (#605aff) is touching (#ff4444)?> then\n    broadcast (ResetPlayer v)\n    broadcast (Sound.Death v)\nend\nif <color (#605aff) is touching (#c157ff)?> then\n    change [player.y v] by (() - (player.yv))\n    set [player.yv v] to ((player.jumpforce) * (1.5))\n    if <<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <mouse down?>> and <not <(player.ycoll) = [ceiling]>>> then\n        change [player.yv v] by ((player.jumpforce) / (4))\n    end\nend\n\nwhen I receive [show.thumbnail v]\nhide\n\n@Level\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    go to [back v] layer\nend\n\nwhen I receive [loadlevel v]\nwait until <(Player.X) < [0]>\nswitch costume to (Level)\n\n@Goal\n\nwhen flag clicked\nforever\n    go to x: (194) y: ((-70) + ((y) * (0.25)))\n    switch costume to (Level)\nend\n\nwhen flag clicked\nset [y v] to [0]\nset [vel v] to [7.5]\nforever\n    repeat (30)\n        change [vel v] by (-0.5)\n        change [y v] by (vel)\n    end\n    repeat (30)\n        change [vel v] by (0.5)\n        change [y v] by (vel)\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nset [ghost v] effect to (0)\nrepeat (20)\n    go to x: (0) y: (0)\n    go to [front v] layer\n    change [ghost v] effect by (5)\nend\n\nwhen I receive [show.thumbnail v]\nrepeat (50)\n    set [ghost v] effect to (0)\n    go to [front v] layer\n    go to x: (0) y: (0)\nend\n\n@Objects\n\ndefine CreateObject x: (x) y: (y) type: (type) dir: (dir) level: (level) size: (size)\nadd (x) to [objects.x v]\nadd (y) to [objects.y v]\nadd (type) to [objects.type v]\nadd (dir) to [objects.dir v]\nadd (level) to [objects.level v]\nadd (size) to [objects.size v]\n\ndefine DeleteObject (id)\ndelete (id) of [objects.x v]\ndelete (id) of [objects.y v]\ndelete (id) of [objects.type v]\ndelete (id) of [objects.dir v]\ndelete (id) of [objects.level v]\ndelete (id) of [objects.size v]\n\nwhen flag clicked\nforever\n    VisualUpdate\n    hide\nend\n\nif <(username) = [Coltroc]> then\n    show\n    go to [front v] layer\n    set size to ((125) * ((Placing.Size) / (100))) %\n    set [ghost v] effect to (50)\n    switch costume to (Placing.type)\n    point in direction (Placing.Direction)\n    go to x: (mouse x) y: (mouse y)\nend\n\ndefine VisualUpdate\nerase all\nDrawPlayer\nDrawObjects\n\ndefine DrawEntity (x) (y) (dir) (costume) (size)\ngo to x: (x) y: (y)\npoint in direction (dir)\nset size to (size) %\nswitch costume to (costume)\nset [ghost v] effect to (0)\nstamp\n\ndefine DrawObjects\nset [i v] to [1]\nrepeat (length of [objects.dir v])\n    if <(Level) = (item (i) of [objects.level v])> then\n        DrawEntity (item (i) of [objects.x v]) (item (i) of [objects.y v]) (item (i) of [objects.dir v]) (item (i) of [objects.type v]) ((125) * ((item (i) of [objects.size v]) / (100)))\n    end\n    change [i v] by (1)\nend\n\ndefine DrawPlayer\nDrawEntity (Player.X) (Player.Y) [90] [Player] [125]\n\nwhen [space v] key pressed\n\nif <(username) = [Coltroc]> then\n    ask [Type?] and wait\n    if <(length of (answer)) > [0]> then\n        set [placing.type v] to (answer)\n    end\n    ask [Direction?] and wait\n    if <(length of (answer)) > [0]> then\n        set [placing.direction v] to (answer)\n    end\n    ask [Size?] and wait\n    if <(length of (answer)) > [0]> then\n        set [placing.size v] to (answer)\n    end\nend\n\nwhen [z v] key pressed\n\nif <(username) = [Coltroc]> then\n    CreateObject x: (mouse x) y: (mouse y) type: (Placing.type) dir: (Placing.Direction) level: (Level) size: (Placing.Size)\nend\n\nwhen [x v] key pressed\n\nchange [placing.size v] by (-5)\n\nwhen [c v] key pressed\n\nchange [placing.size v] by (5)\n\nwhen [v v] key pressed\n\nif <(username) = [Coltroc]> then\n    CollisionCheck.Delete\nend\n\ndefine CollisionCheck.Delete\nset [i v] to [1]\nrepeat (length of [objects.dir v])\n    if <(Level) = (item (i) of [objects.level v])> then\n        set [dx v] to ((mouse x) - (item (i) of [objects.x v]))\n        set [dy v] to ((mouse y) - (item (i) of [objects.y v]))\n        set [d v] to ([sqrt v] of (((dx) * (dx)) + ((dy) * (dy))) )\n        if <(d) < [10]> then\n            DeleteObject (i)\n        end\n    end\n    change [i v] by (1)\nend\n\nchange [level v] by (1)\nbroadcast (LoadLevel v)\n\n