Mario - Scrolling Platformer

Instructions: THIS IS A REMIX\nWASD or Arrow keys to move.\nJump over obstacles and gaps, Break blocks and earn coins. Get to the green flag at the end to pass the level.\npro tip: die to get more coins\n\nCurrently there are 4 levels\n\nWarning: This game might lag but probably wont.

@Stage\n\nwhen flag clicked\nforever\n    set [frametime v] to (timer)\n    reset timer\nend\n\nwhen [timer v] > ((FrameTime) / (0.033))\nbroadcast (Stop v)\n\nwhen flag clicked\nset [completinglevel v] to [0]\nset volume to (75) %\nforever\n    if <(CompletingLevel) = [0]> then\n        if <(LevelSelectScreen) = [1]> then\n            play sound [Backround2 - Kevin MacLeod Wallpaper v] until done\n        else\n            play sound [Super Mario Bros Theme Song \(8 Bit Remix Cover Version\) - 8 Bit Universe v] until done\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    set [click v] to [0]\n    if <<mouse down?> and <(Clicked) = [false]>> then\n        set [click v] to [1]\n    end\n    set [clicked v] to <mouse down?>\nend\n\nwhen I receive [stop v]\nif <(username) = [Coltroc]> then\n    set [levelscompleted v] to [0]\n    set [coins v] to [0]\nend\n\nwhen I receive [levelcomplete v]\nset [completinglevel v] to [1]\nstop all sounds\nplay sound [Level complete v] until done\nbroadcast (LoadLevelSelect v)\nstop all sounds\nset [completinglevel v] to [0]\nif <<((Level) - (1)) = (LevelsCompleted)> and <((LevelsCompleted) + (1)) < (length of [levelselect.x v])>> then\n    change [levelscompleted v] by (1)\nend\n\nwait until <(Intro) = [1]>\nstart sound [Backround3 - Kevin MacLeod Dreamy Flashback v]\nwait until <(Intro) = [0]>\nrepeat (50)\n    change volume by (-1.5)\nend\nset volume to (0) %\nstop all sounds\nbroadcast (fade v)\n\nset [intro v] to [0]\n\nwhen I receive [fade v]\nrepeat (50)\n    change volume by (1.5)\nend\nset volume to (75) %\n\n@Visualiser\n\ndefine Visuals\nerase all\nif <<<(Editing) = [0]> or <not <(username) = [Coltroc]>>> and <(LevelSelectScreen) = [1]>> then\n    DrawLine x: [] y: [] x2: [] y2: [] width: [1000] color: [35] brightness: [100] saturation: [85] transparency: [0]\n    DrawLevels\n    CalculatePlayerPos\n    DrawLevelSelectWorld\n    if <((Level) - (LevelSelect.PreviousLevel)) < [0]> then\n        DrawCostume x: ((PlayerLevelSelect.x) - (cam.x)) y: (((PlayerLevelSelect.y) + (20)) - (cam.y)) direction: [90] size: [600] costume: [player.l] ghost: [0] brightness: [0] color: [0]\n    else\n        DrawCostume x: ((PlayerLevelSelect.x) - (cam.x)) y: (((PlayerLevelSelect.y) + (20)) - (cam.y)) direction: [90] size: [600] costume: [player.r] ghost: [0] brightness: [0] color: [0]\n    end\n    DrawLevelSelectUI\nelse\n    DrawBlocks\n    DrawObjects\n    if <<(Editing) = [1]> and <(username) = [Coltroc]>> then\n        set [build.x v] to ((([floor v] of (((mouse x) + (cam.x)) / (Block.Size)) ) + (0.5)) * (Block.Size))\n        set [build.y v] to ((([floor v] of (((mouse y) + (cam.y)) / (Block.Size)) ) + (0.5)) * (Block.Size))\n        DrawCostume x: (((([floor v] of (((mouse x) + (cam.x)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.x)) y: (((([floor v] of (((mouse y) + (cam.y)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.y)) direction: [90] size: [600] costume: [pointer] ghost: [0] brightness: [0] color: [0]\n        if <(Block/Object) = [1]> then\n            DrawCostume x: ((20) + (((([floor v] of (((mouse x) + (cam.x)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.x))) y: ((20) + (((([floor v] of (((mouse y) + (cam.y)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.y))) direction: [90] size: [200] costume: (item (selectedObjectType) of [object.type.costume v]) ghost: [] brightness: [] color: []\n        else\n            DrawCostume x: ((20) + (((([floor v] of (((mouse x) + (cam.x)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.x))) y: ((20) + (((([floor v] of (((mouse y) + (cam.y)) / (Block.Size)) ) + (0.5)) * (Block.Size)) - (cam.y))) direction: [90] size: [200] costume: (join [block] (selectedBlockPlaceType)) ghost: [] brightness: [] color: []\n        end\n    end\nend\nDrawLine x: [0] y: [0] x2: [0] y2: [0] width: [1000] color: [0] brightness: [100] saturation: [0] transparency: (FadeTing.Ghost)\nDrawCoins\n\nwhen flag clicked\nset [cam.x v] to [0]\nset [cam.y v] to [0]\nset [block.size v] to [60]\nset [screen.size v] to [8]\nset [world.height v] to [12]\nforever\n    Visuals\nend\n\ndefine DrawBlocks\nset [i v] to ((1) + ((([ceiling v] of ((cam.x) / (Block.Size)) ) - (1)) * (World.height)))\nchange [i v] by ([floor v] of ((cam.y) / (Block.Size)) )\nrepeat (((Screen.size) + (1)) * (((World.height) + (2)) / (2)))\n    if <not <(i) > (length of [blocks.type v])>> then\n        if <([ceiling v] of ((cam.y) / (Block.Size)) ) > [5]> then\n            if <((i) - (([floor v] of (((i) - (1)) / (World.height)) ) * (World.height))) = [1]> then\n                change [i v] by (5)\n            end\n        else\n            if <((i) - (([floor v] of (((i) - (1)) / (World.height)) ) * (World.height))) > ((6) + ([ceiling v] of ((cam.y) / (Block.Size)) ))> then\n                change [i v] by (5)\n            end\n        end\n        set [x v] to (([floor v] of (((i) - (1)) / (World.height)) ) - (((Screen.size) / (2)) - (0.5)))\n        set [y v] to (((i) - (([floor v] of (((i) - (1)) / (World.height)) ) * (World.height))) - ((((Screen.size) * (0.75)) / (2)) + (0.5)))\n        DrawCostume x: (((x) * (Block.Size)) - (cam.x)) y: (((y) * (Block.Size)) - (cam.y)) direction: [90] size: [600] costume: (join [block] (item (i) of [blocks.type v])) ghost: [0] brightness: [0] color: [0]\n    end\n    change [i v] by (1)\nend\n\ndefine DrawCostume x: (x) y: (y) direction: (direction) size: (size) costume: (costume) ghost: (ghost) brightness: (brightness) color: (color)\nset size to (100) %\nswitch costume to (poscheck v)\ngo to x: ([floor v] of (x) ) y: ([floor v] of (y) )\nswitch costume to (costume)\nif <<<(x position) = ([floor v] of (x) )> and <(y position) = ([floor v] of (y) )>> and <not <(costume [name v]) = [PosCheck]>>> then\n    set size to (size) %\n    set [ghost v] effect to (ghost)\n    set [brightness v] effect to (brightness)\n    set [color v] effect to (color)\n    point in direction (direction)\n    stamp\nend\n\ndefine DrawObjects\nset [i v] to [1]\nrepeat (length of [object.type v])\n    if <<([abs v] of ((item (i) of [object.x v]) - (cam.x)) ) < [480]> and <([abs v] of ((item (i) of [object.y v]) - (cam.y)) ) < [360]>> then\n        DrawCostume x: ((item (i) of [object.x v]) - (cam.x)) y: ((item (i) of [object.y v]) - (cam.y)) direction: [90] size: [600] costume: (item (i) of [objects.costume v]) ghost: [0] brightness: [0] color: [0]\n    end\n    change [i v] by (1)\nend\n\ndefine new block\ndelete all of [levels.blocks.type v]\nrepeat (20)\n    repeat ((Screen.size) * (20))\n        add [2] to [levels.blocks.type v]\n        add [1] to [levels.blocks.type v]\n        repeat (10)\n            add [0] to [levels.blocks.type v]\n        end\n    end\nend\n\ndefine DrawLevels\nset [i v] to [1]\nrepeat ((length of [levelselect.x v]) - (1))\n    if <(i) > (LevelsCompleted)> then\n        DrawLine x: ((item ((i) + (1)) of [levelselect.x v]) - (cam.x)) y: ((item ((i) + (1)) of [levelselect.y v]) - (cam.y)) x2: ((item (i) of [levelselect.x v]) - (cam.x)) y2: ((item (i) of [levelselect.y v]) - (cam.y)) width: [40] color: [12] brightness: [25] saturation: [75] transparency: [0]\n    else\n        DrawLine x: ((item ((i) + (1)) of [levelselect.x v]) - (cam.x)) y: ((item ((i) + (1)) of [levelselect.y v]) - (cam.y)) x2: ((item (i) of [levelselect.x v]) - (cam.x)) y2: ((item (i) of [levelselect.y v]) - (cam.y)) width: [40] color: [12] brightness: [75] saturation: [75] transparency: [0]\n    end\n    change [i v] by (1)\nend\nset [i v] to [1]\nrepeat ((length of [levelselect.x v]) - (1))\n    if <(i) > (LevelsCompleted)> then\n        DrawLine x: ((item ((i) + (1)) of [levelselect.x v]) - (cam.x)) y: ((item ((i) + (1)) of [levelselect.y v]) - (cam.y)) x2: ((item (i) of [levelselect.x v]) - (cam.x)) y2: ((item (i) of [levelselect.y v]) - (cam.y)) width: [30] color: [12] brightness: [50] saturation: [50] transparency: [0]\n    else\n        DrawLine x: ((item ((i) + (1)) of [levelselect.x v]) - (cam.x)) y: ((item ((i) + (1)) of [levelselect.y v]) - (cam.y)) x2: ((item (i) of [levelselect.x v]) - (cam.x)) y2: ((item (i) of [levelselect.y v]) - (cam.y)) width: [30] color: [12] brightness: [100] saturation: [50] transparency: [0]\n    end\n    change [i v] by (1)\nend\nset [i v] to [1]\nrepeat (length of [levelselect.x v])\n    if <(i) > ((LevelsCompleted) + (1))> then\n        DrawCostume x: ((item (i) of [levelselect.x v]) - (cam.x)) y: ((item (i) of [levelselect.y v]) - (cam.y)) direction: [90] size: [600] costume: [LevelSelect] ghost: [0] brightness: [-75] color: []\n    else\n        DrawCostume x: ((item (i) of [levelselect.x v]) - (cam.x)) y: ((item (i) of [levelselect.y v]) - (cam.y)) direction: [90] size: [600] costume: [LevelSelect] ghost: [0] brightness: [0] color: [0]\n    end\n    change [i v] by (1)\nend\n\ndefine DrawLine x: (x) y: (y) x2: (x2) y2: (y2) width: (width) color: (color) brightness: (brightness) saturation: (saturation) transparency: (transparency)\nswitch costume to (poscheck v)\nset size to (200000) %\nset pen size to (width)\nset pen (color v) to (color)\nset pen (brightness v) to (brightness)\nset pen (saturation v) to (saturation)\nset pen (transparency v) to (100)\ngo to x: (x) y: (y)\npen down\nset pen (transparency v) to (transparency)\nif <(y2) = []> then\n    go to x: (x2) y: (y)\nelse\n    go to x: (x2) y: (y2)\nend\npen up\n\nwhen flag clicked\nset [levelselect.previouslevel v] to [1]\nset [levelselectscreen v] to [1]\nset [levelselect.timer v] to [1]\nset [level v] to [1]\nset [fadeting.ghost v] to [0]\nrepeat until <[99] < (FadeTing.Ghost)>\n    change [fadeting.ghost v] by (25)\n    if <[100] < (FadeTing.Ghost)> then\n        set [fadeting.ghost v] to [100]\n    end\nend\n\nwhen I receive [levelselect.changelevel v]\nrepeat until <(LevelSelect.Timer) > [1]>\n    change [levelselect.timer v] by (FrameTime)\n    if <(LevelSelect.Timer) > [1]> then\n        set [levelselect.timer v] to [1]\n    end\nend\nset [levelselect.timer v] to [1]\n\ndefine DrawLevelSelectUI\nDrawLine x: [-210] y: [-135] x2: [-50] y2: [] width: [50] color: [0] brightness: [0] saturation: [0] transparency: [15]\nDrawLine x: [60] y: [-135] x2: [210] y2: [] width: [50] color: [0] brightness: [0] saturation: [0] transparency: [15]\nDrawCostume x: [-140] y: [-135] direction: [90] size: [100] costume: [Level] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: [140] y: [-135] direction: [90] size: [100] costume: [Play] ghost: [0] brightness: [0] color: [0]\nif <<([abs v] of ((x position) - (mouse x)) ) < [100]> and <[25] > ([abs v] of ((y position) - (mouse y)) )>> then\n    DrawLine x: [60] y: [-135] x2: [210] y2: [] width: [50] color: [0] brightness: [0] saturation: [0] transparency: [50]\n    DrawCostume x: [140] y: [-135] direction: [90] size: [100] costume: [Play] ghost: [0] brightness: [-30] color: [0]\n    if <(Click) = [1]> then\n        broadcast (StartLevel v)\n    end\nend\nDrawCostume x: [-90] y: [-135] direction: [90] size: [100] costume: (join [number] (Level)) ghost: [0] brightness: [0] color: [0]\nif <<(Level) > [1]> and <(LevelSelect.Timer) = [1]>> then\n    DrawCostume x: [-210] y: [-135] direction: [-90] size: [400] costume: [arrow] ghost: [0] brightness: [0] color: [0]\n    if <(distance to [mouse-pointer v]) < [20]> then\n        DrawLine x: [-210] y: [-135] x2: [-210] y2: [] width: [40] color: [0] brightness: [0] saturation: [0] transparency: [50]\n        DrawCostume x: [-210] y: [-135] direction: [-90] size: [400] costume: [arrow] ghost: [0] brightness: [-30] color: [0]\n        if <(Click) = [1]> then\n            set [levelselect.previouslevel v] to (Level)\n            change [level v] by (-1)\n            set [levelselect.timer v] to [0]\n            broadcast (LevelSelect.ChangeLevel v)\n        end\n    end\nend\nif <<((LevelsCompleted) + (1)) > (Level)> and <(LevelSelect.Timer) = [1]>> then\n    DrawCostume x: [-50] y: [-135] direction: [90] size: [400] costume: [arrow] ghost: [0] brightness: [0] color: [0]\n    if <(distance to [mouse-pointer v]) < [30]> then\n        DrawLine x: [-50] y: [-135] x2: [-50] y2: [] width: [40] color: [0] brightness: [0] saturation: [0] transparency: [50]\n        DrawCostume x: [-50] y: [-135] direction: [90] size: [400] costume: [arrow] ghost: [0] brightness: [-35] color: [0]\n        if <(Click) = [1]> then\n            set [levelselect.previouslevel v] to (Level)\n            change [level v] by (1)\n            set [levelselect.timer v] to [0]\n            broadcast (LevelSelect.ChangeLevel v)\n        end\n    end\nend\n\ndefine CalculatePlayerPos\nset [playerlevelselect.x v] to ((item (LevelSelect.PreviousLevel) of [levelselect.x v]) + (((item (Level) of [levelselect.x v]) - (item (LevelSelect.PreviousLevel) of [levelselect.x v])) * (LevelSelect.Timer)))\nset [playerlevelselect.y v] to ((item (LevelSelect.PreviousLevel) of [levelselect.y v]) + (((item (Level) of [levelselect.y v]) - (item (LevelSelect.PreviousLevel) of [levelselect.y v])) * (LevelSelect.Timer)))\nUpdateCamPos x: (PlayerLevelSelect.x) y: (PlayerLevelSelect.y) time: [5]\n\ndefine UpdateCamPos x: (x) y: (y) time: (time)\nchange [cam.x v] by (((x) - (cam.x)) / (time))\nchange [cam.y v] by (((y) - (cam.y)) / (time))\nif <(cam.x) < [0]> then\n    set [cam.x v] to [0]\nend\nif <(cam.y) < [0]> then\n    set [cam.y v] to [0]\nend\nif <[9120] < (cam.x)> then\n    set [cam.x v] to [9120]\nend\nif <[0] < (cam.y)> then\n    set [cam.y v] to [0]\nend\n\nwhen I receive [startlevel v]\nset [fadeting.ghost v] to [100]\nrepeat until <(FadeTing.Ghost) < [1]>\n    change [fadeting.ghost v] by (-10)\n    set [cam.x v] to (PlayerLevelSelect.x)\n    set [cam.y v] to (PlayerLevelSelect.y)\n    if <(FadeTing.Ghost) < [0]> then\n        set [fadeting.ghost v] to [0]\n    end\nend\nset [levelselectscreen v] to [0]\nstop all sounds\nset [fadeting.ghost v] to [0]\nrepeat until <[99] < (FadeTing.Ghost)>\n    change [fadeting.ghost v] by (10)\n    if <[100] < (FadeTing.Ghost)> then\n        set [fadeting.ghost v] to [100]\n    end\nend\n\nwhen I receive [loadlevelselect v]\nset [fadeting.ghost v] to [100]\nrepeat until <(FadeTing.Ghost) < [1]>\n    change [fadeting.ghost v] by (-10)\n    if <(FadeTing.Ghost) < [0]> then\n        set [fadeting.ghost v] to [0]\n    end\nend\nset [levelselectscreen v] to [1]\nstop all sounds\nset [cam.y v] to [0]\nset [cam.x v] to (item (Level) of [levelselect.x v])\nset [fadeting.ghost v] to [0]\nrepeat until <[99] < (FadeTing.Ghost)>\n    change [fadeting.ghost v] by (25)\n    if <[100] < (FadeTing.Ghost)> then\n        set [fadeting.ghost v] to [100]\n    end\nend\n\ndefine DrawCoins\nchange [coins v] by (0)\nset [coins.ui v] to (coins)\nrepeat ((8) - (length of (coins)))\n    set [coins.ui v] to (join [0] (Coins.UI))\nend\nDrawLine x: [110] y: [155] x2: [220] y2: [] width: [35] color: [] brightness: [] saturation: [] transparency: [20]\nDrawNumber size: [100] number: (Coins.UI) x: [110] y: [155]\n\ndefine DrawNumber size: (size) number: (number) x: (x) y: (y)\nset [i2 v] to [1]\nrepeat (length of (number))\n    DrawCostume x: ((x) + (((i2) - (1)) * ((15) * ((size) / (100))))) y: (y) direction: [90] size: (size) costume: (join [number] (letter (i2) of (number))) ghost: [0] brightness: [100] color: [0]\n    change [i2 v] by (1)\nend\n\ndefine DrawLevelSelectWorld\nDrawCostume x: ((-150) - (cam.x)) y: [50] direction: [90] size: [600] costume: [tree] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((-150) - (cam.x)) y: [45] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((-45) - (cam.x)) y: [85] direction: [90] size: [600] costume: [tree] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((-100) - (cam.x)) y: [-70] direction: [90] size: [600] costume: [rock] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((-110) - (cam.x)) y: [-80] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((75) - (cam.x)) y: [40] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [] color: [0]\nDrawCostume x: ((200) - (cam.x)) y: [-40] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((250) - (cam.x)) y: [-80] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [0] color: [0]\nDrawCostume x: ((350) - (cam.x)) y: [40] direction: [90] size: [600] costume: [tree] ghost: [0] brightness: [] color: [0]\nDrawCostume x: ((350) - (cam.x)) y: [40] direction: [90] size: [600] costume: [grass] ghost: [0] brightness: [] color: [0]\nDrawCostume x: ((485) - (cam.x)) y: [-70] direction: [90] size: [600] costume: [castle] ghost: [0] brightness: [] color: [0]\n\nset [intro v] to [1]\nwait until <(Intro) = [0]>\n\n@Objects\n\nwhen flag clicked\nset [editing v] to [0]\n\ndefine CreateObject x: (x) y: (y) type: (type) costume: (costume) direction: (direction)\nadd (type) to [object.type v]\nadd (x) to [object.x v]\nadd [0] to [object.xv v]\nadd (y) to [object.y v]\nadd [0] to [object.yv v]\nadd (costume) to [objects.costume v]\nadd (direction) to [object.direction v]\nif <(type) = [5]> then\n    replace item (length of [object.xv v]) of [object.xv v] with (pick random (-5) to (5.0))\n    replace item (length of [object.yv v]) of [object.yv v] with (pick random (5) to (15.0))\nend\n\ndefine Delete id: (id)\ndelete (id) of [object.type v]\ndelete (id) of [object.x v]\ndelete (id) of [object.xv v]\ndelete (id) of [object.y v]\ndelete (id) of [object.yv v]\ndelete (id) of [objects.costume v]\ndelete (id) of [object.direction v]\n\ndefine DeleteAll\nrepeat (length of [object.type v])\n    Delete id: [1]\nend\n\ndefine ObjectVelocityUpdate\nset [i4 v] to [1]\nrepeat (length of [object.type v])\n    if <<not <(item (i4) of [object.type v]) = [1]>> and <not <(item (i4) of [object.type v]) = [5]>>> then\n        replace item (i4) of [object.x v] with ((item (i4) of [object.x v]) + (item (i4) of [object.xv v]))\n        replace item (i4) of [object.y v] with ((item (i4) of [object.y v]) + (item (i4) of [object.yv v]))\n        if <(item (i4) of [object.type v]) = [2]> then\n            if <<(item (i4) of [object.xv v]) = [0]> or <(item (i4) of [object.yv v]) = [0]>> then\n                replace item (i4) of [object.xv v] with (pick random (-5) to (5.0))\n                replace item (i4) of [object.yv v] with (pick random (5) to (15.0))\n            end\n            replace item (i4) of [object.yv v] with ((item (i4) of [object.yv v]) + (-1))\n            if <(item (i4) of [object.y v]) < [-220]> then\n                Delete id: (i4)\n            end\n        end\n    end\n    if <(item (i4) of [object.type v]) = [5]> then\n        replace item (i4) of [object.x v] with ((item (i4) of [object.x v]) + (item (i4) of [object.xv v]))\n        CheckBlockCollision x: (item (i4) of [object.x v]) y: (item (i4) of [object.y v]) width: [8] heigth: [10] type: [5] id: (i4)\n        if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n            replace item (i4) of [object.x v] with ((item (i4) of [object.x v]) + (() - (item (i4) of [object.xv v])))\n            replace item (i4) of [object.xv v] with [0.0]\n        end\n        replace item (i4) of [object.yv v] with ((item (i4) of [object.yv v]) + (-1))\n        replace item (i4) of [object.y v] with ((item (i4) of [object.y v]) + (item (i4) of [object.yv v]))\n        CheckBlockCollision x: (item (i4) of [object.x v]) y: (item (i4) of [object.y v]) width: [8] heigth: [10] type: [5] id: (i4)\n        if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n            replace item (i4) of [object.y v] with ((item (i4) of [object.y v]) + (() - (item (i4) of [object.yv v])))\n            if <(item (i4) of [object.yv v]) < [0]> then\n                replace item (i4) of [object.xv v] with [0.0]\n            end\n            replace item (i4) of [object.yv v] with [0.0]\n        end\n        if <[collidingblocks v] contains [2]?> then\n            Delete id: (i4)\n        end\n        if <(item (i4) of [object.y v]) < [-220]> then\n            Delete id: (i4)\n        end\n        if <<(Editing) = [0]> and <<([abs v] of ((item (i4) of [object.x v]) - (item (player.i) of [object.x v])) ) < ((20) * (3))> and <([abs v] of ((item (player.i) of [object.y v]) - (item (i4) of [object.y v])) ) < ((20) * (3))>>> then\n            broadcast (Coin v)\n            change [coins v] by (1)\n            Delete id: (i4)\n        end\n    end\n    change [i4 v] by (1)\nend\n\ndefine PlayerUpdate\nif <(CompletingLevel) = [0]> then\n    set [player.i v] to (item # of [1] in [object.type v])\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        replace item (player.i) of [object.xv v] with ((item (player.i) of [object.xv v]) + (1))\n        replace item (player.i) of [objects.costume v] with [player.r]\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        replace item (player.i) of [object.xv v] with ((item (player.i) of [object.xv v]) + (-1))\n        replace item (player.i) of [objects.costume v] with [player.l]\n    end\n    UpdateCamPos x: ((item (player.i) of [object.x v]) + (0)) y: ((item (player.i) of [object.y v]) + (0)) time: [4]\n    replace item (player.i) of [object.xv v] with ((item (player.i) of [object.xv v]) * (0.9))\n    replace item (player.i) of [object.x v] with ((item (player.i) of [object.x v]) + (item (player.i) of [object.xv v]))\n    replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (1))\n    CheckBlockCollision x: (item (player.i) of [object.x v]) y: (item (player.i) of [object.y v]) width: [16] heigth: [16] type: [1] id: []\n    if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n        replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (5))\n        CheckBlockCollision x: (item (player.i) of [object.x v]) y: (item (player.i) of [object.y v]) width: [16] heigth: [16] type: [1] id: []\n        if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n            replace item (player.i) of [object.x v] with ((item (player.i) of [object.x v]) + (() - (item (player.i) of [object.xv v])))\n            replace item (player.i) of [object.xv v] with [0]\n        end\n        replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (-5))\n    end\n    replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (-1))\n    replace item (player.i) of [object.yv v] with ((item (player.i) of [object.yv v]) + (-1.25))\n    replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (item (player.i) of [object.yv v]))\n    CheckBlockCollision x: (item (player.i) of [object.x v]) y: (item (player.i) of [object.y v]) width: [16] heigth: [16] type: [1] id: []\n    if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n        replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (() - (item (player.i) of [object.yv v])))\n        if <(item (player.i) of [object.yv v]) > [0]> then\n            replace item (player.i) of [object.yv v] with [-3]\n            if <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>> then\n                broadcast (BreakBrick v)\n            end\n            repeat (2)\n                if <[collidingblocks v] contains [3]?> then\n                    repeat (2)\n                        set [i3 v] to (item (item # of [3] in [collidingblocks v]) of [collidingblocks.id v])\n                        set [x v] to (([floor v] of (((i3) - (1)) / (World.height)) ) - (((Screen.size) / (2)) - (0.5)))\n                        set [y v] to (((i3) - (([floor v] of (((i3) - (1)) / (World.height)) ) * (World.height))) - ((((Screen.size) * (0.75)) / (2)) + (0.5)))\n                        CreateObject x: (((x) * (Block.Size)) + (pick random (-20) to (20))) y: (((y) * (Block.Size)) + (pick random (-20) to (20))) type: [2] costume: [block4.Particle] direction: [90]\n                    end\n                    repeat (1)\n                        CreateObject x: ((x) * (Block.Size)) y: ((y) * (Block.Size)) type: [5] costume: [coin] direction: [90]\n                    end\n                    set [i3 v] to (item # of [3] in [collidingblocks v])\n                    replace item (item (i3) of [collidingblocks.id v]) of [blocks.type v] with [-1]\n                    delete (i3) of [collidingblocks v]\n                    delete (i3) of [collidingblocks.id v]\n                end\n            end\n            repeat (2)\n                if <[collidingblocks v] contains [4]?> then\n                    repeat (2)\n                        set [i3 v] to (item (item # of [4] in [collidingblocks v]) of [collidingblocks.id v])\n                        set [x v] to (([floor v] of (((i3) - (1)) / (World.height)) ) - (((Screen.size) / (2)) - (0.5)))\n                        set [y v] to (((i3) - (([floor v] of (((i3) - (1)) / (World.height)) ) * (World.height))) - ((((Screen.size) * (0.75)) / (2)) + (0.5)))\n                        CreateObject x: (((x) * (Block.Size)) + (pick random (-20) to (20))) y: (((y) * (Block.Size)) + (pick random (-20) to (20))) type: [2] costume: [block5.Particle] direction: [90]\n                    end\n                    repeat (pick random (0) to (0))\n                        CreateObject x: ((x) * (Block.Size)) y: ((y) * (Block.Size)) type: [5] costume: [coin] direction: [90]\n                    end\n                    set [i3 v] to (item # of [4] in [collidingblocks v])\n                    replace item (item (i3) of [collidingblocks.id v]) of [blocks.type v] with [-2]\n                    delete (i3) of [collidingblocks v]\n                    delete (i3) of [collidingblocks.id v]\n                end\n            end\n        else\n            replace item (player.i) of [object.yv v] with [0]\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n                replace item (player.i) of [object.yv v] with [20]\n                broadcast (Jump v)\n            end\n        end\n    end\n    delete all of [collidingblocks v]\n    delete all of [collidingblocks.id v]\nend\n\ndefine UpdateCamPos x: (x) y: (y) time: (time)\nchange [cam.x v] by (((x) - (cam.x)) / (time))\nchange [cam.y v] by (((y) - (cam.y)) / (time))\nif <(cam.x) < [0]> then\n    set [cam.x v] to [0]\nend\nif <(cam.y) < [0]> then\n    set [cam.y v] to [0]\nend\nif <[9120] < (cam.x)> then\n    set [cam.x v] to [9120]\nend\nif <[360] < (cam.y)> then\n    set [cam.y v] to [360]\nend\n\ndefine CheckBlockCollision x: (x) y: (y) width: (width) heigth: (heigth) type: (type) id: (id)\ndelete all of [collidingblocks v]\ndelete all of [collidingblocks.id v]\nset [hitbox.heigth v] to (([ceiling v] of (((heigth) * (3)) / (Block.Size)) ) + (2))\nset [hitbox.width v] to (([ceiling v] of (((width) * (3)) / (Block.Size)) ) + (2))\nset [i2 v] to ((1) + (((([ceiling v] of ((x) / (Block.Size)) ) - ([floor v] of ((hitbox.width) / (2)) )) + (3)) * (World.height)))\nif <((hitbox.heigth) + (((1) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) ))) < ((2) + ([floor v] of ((hitbox.heigth) / (2)) ))> then\nelse\n    if <((((1) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) )) + (1)) = [11]> then\n        change [i2 v] by (((0) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) ))\n    else\n        change [i2 v] by (((1) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) ))\n    end\nend\nrepeat ((hitbox.width) * (hitbox.heigth))\n    set [y v] to ((i2) - (([floor v] of (((i2) - (1)) / (World.height)) ) * (World.height)))\n    if <((((1) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) )) + (1)) > ((World.height) - (hitbox.heigth))> then\n        if <(y) = [1]> then\n            change [i2 v] by ((World.height) - (hitbox.heigth))\n        end\n    else\n        if <(y) > ((hitbox.heigth) + (((1) + ([floor v] of ((hitbox.heigth) / (2)) )) + ([floor v] of ((y) / (Block.Size)) )))> then\n            change [i2 v] by ((World.height) - (hitbox.heigth))\n        end\n    end\n    set [x v] to (([floor v] of (((i2) - (1)) / (World.height)) ) - (((Screen.size) / (2)) - (0.5)))\n    set [y v] to (((i2) - (([floor v] of (((i2) - (1)) / (World.height)) ) * (World.height))) - ((((Screen.size) * (0.75)) / (2)) + (0.5)))\n    set [dx v] to ([abs v] of ((x) - ((x) * (Block.Size))) )\n    set [dy v] to ([abs v] of ((y) - ((y) * (Block.Size))) )\n    if <<(dx) < (((Block.Size) + ((width) * (3))) / (2))> and <(dy) < (((Block.Size) + ((heigth) * (3))) / (2))>> then\n        if <(item (item (i2) of [blocks.type v]) of [block.type.hitboxtype v]) = [6]> then\n            if <(type) = [1]> then\n                if <<((y) - ((y) * (Block.Size))) > [30]> and <[0] > (item (player.i) of [object.yv v])>> then\n                    add [1] to [collidingblocks v]\n                    add (i2) to [collidingblocks.id v]\n                end\n            else\n                if <<((y) - ((y) * (Block.Size))) > [30]> and <[0] > (item (id) of [object.yv v])>> then\n                    add [1] to [collidingblocks v]\n                    add (i2) to [collidingblocks.id v]\n                end\n            end\n        else\n            if <(item (item (i2) of [blocks.type v]) of [block.type.hitboxtype v]) = [5]> then\n                if <<<(dx) < ((((Block.Size) - (20)) + ((width) * (3))) / (2))> and <(dy) < ((((Block.Size) - (20)) + ((heigth) * (3))) / (2))>> and <(type) = [1]>> then\n                    replace item (i2) of [blocks.type v] with [-3]\n                    change [coins v] by (1)\n                    broadcast (Coin v)\n                end\n            else\n                if <(item (item (i2) of [blocks.type v]) of [block.type.hitboxtype v]) = [2]> then\n                    if <<(dx) < (((Block.Size) + ((width) * (3))) / (2))> and <(dy) < ((((Block.Size) - (4)) + ((heigth) * (3))) / (2))>> then\n                        add (item (item (i2) of [blocks.type v]) of [block.type.hitboxtype v]) to [collidingblocks v]\n                        add (i2) to [collidingblocks.id v]\n                    end\n                else\n                    add (item (item (i2) of [blocks.type v]) of [block.type.hitboxtype v]) to [collidingblocks v]\n                    add (i2) to [collidingblocks.id v]\n                end\n            end\n        end\n    end\n    change [i2 v] by (1)\nend\nif <(CompletingLevel) = [0]> then\n    if <(x) < ((-240) + (((width) * (3)) / (2)))> then\n        add [1] to [collidingblocks v]\n    end\n    if <(type) = [1]> then\n        if <<[collidingblocks v] contains [2]?> or <(y) < [-200]>> then\n            Delete id: (item # of [1] in [object.type v])\n            broadcast (Death v)\n        end\n        if <<(x) > ((item (item # of [3] in [object.type v]) of [object.x v]) - (30))> and <(item # of [3] in [object.type v]) > [0]>> then\n            stop [other scripts in sprite v]\n            broadcast (LevelComplete v)\n        end\n    end\nend\n\nwhen I receive [restartplayer v]\nLoadLevel (Level)\nDelete id: (item # of [1] in [object.type v])\nCreateObject x: [0] y: [0] type: [1] costume: [player.r] direction: [90]\nrepeat until <(item # of [1] in [object.type v]) = [0]>\n    PlayerUpdate\nend\n\ndefine LoadLevel (level)\nset [i v] to ((1) + ((((Screen.size) * (World.height)) * (20)) * ((level) - (1))))\nrepeat (((Screen.size) * (World.height)) * (20))\n    replace item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [blocks.type v] with (item (i) of [levels.blocks.type v])\n    change [i v] by (1)\nend\nset [i v] to [1]\nrepeat (((Screen.size) * (World.height)) * (20))\n    if <(item (i) of [blocks.type v]) = [-1]> then\n        replace item (i) of [blocks.type v] with [4]\n    end\n    if <(item (i) of [blocks.type v]) = [-2]> then\n        replace item (i) of [blocks.type v] with [5]\n    end\n    if <(item (1) of [blocks.type v]) = [-3]> then\n        replace item (i) of [blocks.type v] with [9]\n    end\n    change [i v] by (1)\nend\nset [i v] to ((1) + ((((Screen.size) * (World.height)) * (20)) * ((level) - (1))))\nDeleteAll\nrepeat (((Screen.size) * (World.height)) * (20))\n    if <(item (i) of [level.object.type v]) > [2]> then\n        CreateObject x: (item (i) of [level.object.x v]) y: (item (i) of [level.object.y v]) type: (item (i) of [level.object.type v]) costume: (item (item (i) of [level.object.type v]) of [object.type.costume v]) direction: (item (i) of [level.object.direction v])\n    end\n    change [i v] by (1)\nend\nset [i v] to [1]\n\nwhen I receive [death v]\nLoadLevel (Level)\nrepeat until <<(round ((cam.x) / (20))) = [0]> and <(round ((cam.y) / (20))) = [0]>>\n    UpdateCamPos x: [0] y: [0] time: [8]\nend\nbroadcast (RestartPlayer v)\n\ndefine SaveLevel (level)\nset [i v] to ((1) + ((((Screen.size) * (World.height)) * (20)) * ((level) - (1))))\nrepeat (((Screen.size) * (World.height)) * (20))\n    replace item (i) of [levels.blocks.type v] with (item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [blocks.type v])\n    change [i v] by (1)\nend\nset [i v] to ((1) + ((((Screen.size) * (World.height)) * (20)) * ((level) - (1))))\nrepeat (((Screen.size) * (World.height)) * (20))\n    replace item (i) of [level.object.type v] with (item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [object.type v])\n    replace item (i) of [level.object.direction v] with (item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [object.direction v])\n    replace item (i) of [level.object.x v] with (item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [object.x v])\n    replace item (i) of [level.object.y v] with (item ((i) - ((((Screen.size) * (World.height)) * (20)) * ((level) - (1)))) of [object.y v])\n    change [i v] by (1)\nend\n\nwhen [space v] key pressed\nif <(username) = [Coltroc]> then\n    if <(Editing) = [1]> then\n        ask [Save level? y/n] and wait\n        if <(answer) = [y]> then\n            set [editing v] to [0]\n            SaveLevel (Level)\n        end\n    else\n        ask [Edit level? y/n] and wait\n        if <(answer) = [y]> then\n            ask [Which level? 1-20] and wait\n            if <<(answer) > [0]> and <(answer) < [21]>> then\n                set [level v] to (answer)\n                set [editing v] to [1]\n                DeleteAll\n                LoadLevel (Level)\n            end\n        end\n    end\nend\n\nwhen I receive [startlevel v]\nDeleteAll\nbroadcast (RestartPlayer v)\n\nwhen I receive [loadlevelselect v]\nstop [other scripts in sprite v]\n\nwhen I receive [createobject v]\nif <(selectedObjectType) = [2]> then\n    Delete id: (length of [object.type v])\nelse\n    CreateObject x: (Build.x) y: (Build.y) type: (selectedObjectType) costume: (item (selectedObjectType) of [object.type.costume v]) direction: [90]\nend\n\nwhen I receive [startlevel v]\nforever\n    ObjectVelocityUpdate\n    if <<(Editing) = [1]> and <(username) = [Coltroc]>> then\n        if <key (right arrow v) pressed?> then\n            UpdateCamPos x: ((cam.x) + (10)) y: (cam.y) time: [1]\n        end\n        if <key (left arrow v) pressed?> then\n            UpdateCamPos x: ((cam.x) + (-10)) y: (cam.y) time: [1]\n        end\n        if <key (up arrow v) pressed?> then\n            UpdateCamPos x: (cam.x) y: ((cam.y) + (10)) time: [1]\n        end\n        if <key (down arrow v) pressed?> then\n            UpdateCamPos x: (cam.x) y: ((cam.y) + (-10)) time: [1]\n        end\n    end\nend\n\nwhen I receive [levelcomplete v]\nwait until <(CompletingLevel) = [1]>\nrepeat until <[collidingblocks v] contains [1]?>\n    replace item (player.i) of [object.yv v] with ((item (player.i) of [object.yv v]) + (-1))\n    if <(item (player.i) of [object.yv v]) < [-3]> then\n        replace item (player.i) of [object.yv v] with [-3]\n    end\n    replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (item (player.i) of [object.yv v]))\n    CheckBlockCollision x: (item (player.i) of [object.x v]) y: (item (player.i) of [object.y v]) width: [16] heigth: [16] type: [1] id: []\n    if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n        replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (() - (item (player.i) of [object.yv v])))\n        replace item (player.i) of [object.yv v] with [0]\n    end\n    UpdateCamPos x: (item (item # of [3] in [object.type v]) of [object.x v]) y: (item (player.i) of [object.y v]) time: [5]\nend\nwait (1) seconds\nrepeat until <(CompletingLevel) = [0]>\n    replace item (player.i) of [object.x v] with ((item (player.i) of [object.x v]) + (5))\n    replace item (player.i) of [object.yv v] with ((item (player.i) of [object.yv v]) + (-1))\n    replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (item (player.i) of [object.yv v]))\n    CheckBlockCollision x: (item (player.i) of [object.x v]) y: (item (player.i) of [object.y v]) width: [16] heigth: [16] type: [1] id: []\n    if <<[collidingblocks v] contains [1]?> or <<[collidingblocks v] contains [3]?> or <[collidingblocks v] contains [4]?>>> then\n        replace item (player.i) of [object.y v] with ((item (player.i) of [object.y v]) + (() - (item (player.i) of [object.yv v])))\n        replace item (player.i) of [object.yv v] with [0]\n    end\nend\n\n@Blocks\n\nwhen flag clicked\nforever\n    hide variable [selectedblockplacetype v]\n    hide variable [selectedobjecttype v]\n    hide variable [block/object v]\n    if <<(Editing) = [1]> and <(username) = [Coltroc]>> then\n        set [selectedblock.id v] to (((((([floor v] of (((mouse y) + (cam.y)) / (Block.Size)) ) + (0.5)) * (Block.Size)) / (Block.Size)) + (3.5)) + (((((([floor v] of (((mouse x) + (cam.x)) / (Block.Size)) ) + (0.5)) * (Block.Size)) / (Block.Size)) + (3.5)) * (World.height)))\n        set [selectedblock.id v] to (selectedBlock.Id)\n        if <(Block/Object) = [0]> then\n            if <mouse down?> then\n                replace item (selectedBlock.Id) of [blocks.type v] with (selectedBlockPlaceType)\n            end\n        else\n            if <(Click) = [1]> then\n                broadcast (CreateObject v)\n            end\n        end\n        show variable [selectedblockplacetype v]\n        show variable [selectedobjecttype v]\n        show variable [block/object v]\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nwait (0.1) seconds\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [stop v]\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@Sounds\n\nwhen I receive [coin v]\nstart sound [coin v]\n\nwhen I receive [death v]\nstart sound [Hurt v]\n\nwhen I receive [jump v]\nstart sound [Jump v]\n\nwhen I receive [breakbrick v]\nstart sound [Break Brick v]\n\n@Story\n\nwhen flag clicked\nwait until <(Intro) = [1]>\nwait (0.1) seconds\nset [intro v] to [0]\n\nwhen flag clicked\n\nshow\n\n