Bubuś - A Scrolling Platformer
@Stage\n\nwhen flag clicked\nforever\n    set [frametime v] to (timer)\n    reset timer\n    Set Camera\n    broadcast (frameTick v)\nend\n\nwhen flag clicked\nset [secondframe? v] to [0]\nforever\n    if <(secondFrame?) = [0]> then\n        broadcast (worldTick v)\n        set [secondframe? v] to [1]\n    else\n        set [secondframe? v] to [0]\n    end\nend\n\nwait () seconds\n\ndefine Set Camera\nchange [camx v] by (((PlayerX) - (CamX)) / (4))\nchange [camy v] by (((PlayerY) - (CamY)) / (4))\n\nwhen flag clicked\nclear graphic effects\nset [brightness v] effect to (0)\nset [smoothtransition v] to [0]\nset [gravityforce v] to [-10.04]\n\nwhen I receive [frametick v]\nif <[2500] < (PlayerY)> then\n    change [smoothtransition v] by (((-80) - (smoothTransition)) / (15))\nelse\n    change [smoothtransition v] by (((0) - (smoothTransition)) / (5))\nend\nif <[3000] < (PlayerY)> then\n    change [gravityforce v] by (((-6) - (GravityForce)) / (8))\nelse\n    change [gravityforce v] by (((-10.04) - (GravityForce)) / (5))\nend\nset [brightness v] effect to (smoothTransition)\n\n@Character\n\nwhen flag clicked\nset volume to (100) %\ngo to x: (0) y: (0)\nswitch costume to (idle1 v)\nset [jetpackequipped? v] to [false]\n\nwhen I receive [frametick v]\nif <(screenCovered?) = [0]> then\n    Physics (costume [name v]) (direction)\n    Apply Physics\nend\n\ndefine Physics (costume) (rotation)\npoint in direction (90)\nswitch costume to (hitbox2 v)\nchange x by ((XVNR) * (-2))\nif <touching (map v)?> then\n    set [grounded? v] to [true]\nelse\n    set [grounded? v] to [false]\nend\nchange x by (XVNR)\nif <(jetpackEquipped?) = [true]> then\n    if <<key (space v) pressed?> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        broadcast (StartJetpack v)\n        change [jetpackthrottle v] by (((1) - (jetpackThrottle)) / (5))\n        set [velocityy v] to ((4.5) * (jetpackThrottle))\n    else\n        if <(jumpDebounce) = [1]> then\n            start sound [jetpackShutdown v]\n        end\n        set [jumpdebounce v] to [0]\n        set [jetpackthrottle v] to [0]\n    end\nelse\n    if <<<<key (space v) pressed?> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> and <(Grounded?) = [true]>> and <(jumpDebounce) = [0]>> then\n        set [jumpdebounce v] to [1]\n        broadcast (Jump v)\n        start sound [thud1 v]\n        start sound [hm1 v]\n        Jump\n    end\nend\nswitch costume to (hitbox v)\nWalk <<key (a v) pressed?> or <key (left arrow v) pressed?>> <<key (d v) pressed?> or <key (right arrow v) pressed?>>\ngo to x: (((PlayerX) + (VelocityX)) - (CamX)) y: (((PlayerY) + (VelocityY)) - (CamY))\nif <not <touching (map v)?>> then\n    change [velocityy v] by ((GravityForce) * (Frametime))\nend\nif <touching (map v)?> then\n    set [slope v] to [0]\n    if <(VelocityY) < [0.1]> then\n        Calculate Y Touch Up\n    else\n        repeat until <<not <touching (map v)?>> or <(Slope) < [-8]>>\n            change y by (-0.5)\n            change [slope v] by (-0.5)\n        end\n        if <(Slope) < [-50]> then\n            change y by ((Slope) * (-1))\n            Calculate Y Touch Up\n        else\n            if <(Slope) < [-8]> then\n                change x by ((XVNR) * (-3))\n                change y by ((Slope) * (-1))\n                if <(Grounded?) = [false]> then\n                    if <touching (map v)?> then\n                        change [playery v] by ((Slope) - (3))\n                        set [velocityy v] to [0]\n                    else\n                        change [velocityy v] by ((GravityForce) * (Frametime))\n                    end\n                    change x by (XVNR)\n                end\n                change y by (Slope)\n                set [velocityx v] to [0]\n            else\n                change [playery v] by ((Slope) - (3))\n                set [velocityy v] to [0]\n            end\n        end\n    end\nend\nif <<<(Grounded?) = [true]> and <(lastGroundValue) = [false]>> and <(dropDebounce) = [0]>> then\n    set [dropdebounce v] to [1]\n    broadcast (Drop v)\n    if <(surface) = [grass]> then\n        start sound [drop1 v]\n    else\n        if <(surface) = [rock]> then\n            start sound [drop2 v]\n        else\n            if <(surface) = [metal]> then\n                start sound [drop3 v]\n            end\n        end\n    end\nend\nset [lastgroundvalue v] to (Grounded?)\ngo to x: ((PlayerX) - (CamX)) y: ((PlayerY) - (CamY))\npoint in direction (rotation)\nswitch costume to (costume)\n\nset [grounded? v] to [false]\n\ndefine Apply Physics\nchange [playery v] by (VelocityY)\nchange [playerx v] by (VelocityX)\n\ndefine Walk <left> <right>\nset [velocityx v] to [0]\nif <<left> or <right>> then\n    set [walkstatus v] to [1]\n    if <right> then\n        change [velocityx v] by ((Walkspeed) * (Frametime))\n        set [xvnr v] to ((Walkspeed) * (Frametime))\n    end\n    if <left> then\n        change [velocityx v] by (((Walkspeed) * (Frametime)) * (-1))\n        set [xvnr v] to (((Walkspeed) * (Frametime)) * (-1))\n    end\n    if <<left> and <right>> then\n        set [xvnr v] to (lastXVNR)\n    end\n    set [lastxvnr v] to (XVNR)\nelse\n    set [walkstatus v] to [0]\nend\n\nwhen I receive [worldtick v]\nif <(Grounded?) = [true]> then\n    point in direction (90)\n    if <<(WalkStatus) = [1]> and <not <(VelocityX) = [0]>>> then\n        if <(WalkSwitch) = [1]> then\n            set [walkswitch v] to [2]\n            set [pitch v] effect to (pick random (20) to (50))\n            if <(surface) = [grass]> then\n                start sound [step2 v]\n            else\n                if <(surface) = [rock]> then\n                    start sound [step1 v]\n                else\n                    if <(surface) = [metal]> then\n                        start sound [step3 v]\n                    end\n                end\n            end\n        else\n            set [walkswitch v] to [1]\n            wait (0) seconds\n        end\n        if <(jetpackEquipped?) = [true]> then\n            switch costume to (join (join [move] (WalkSwitch)) [jetpack])\n        else\n            switch costume to (join [move] (WalkSwitch))\n        end\n    else\n        if <(jetpackEquipped?) = [true]> then\n            switch costume to (idle1jetpack v)\n        else\n            switch costume to (idle1 v)\n        end\n    end\nelse\n    set [walkswitch v] to [1]\n    if <<(jetpackEquipped?) = [true]> and <[0.3] < (jetpackThrottle)>> then\n        if <<(WalkStatus) = [1]> and <not <(VelocityX) = [0]>>> then\n            if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n                point in direction (80)\n            else\n                point in direction (100)\n            end\n        else\n            point in direction (90)\n        end\n        switch costume to (idle1jetpack2 v)\n    else\n        if <[-2] < (VelocityY)> then\n            if <(jetpackEquipped?) = [true]> then\n                switch costume to (jump1jetpack v)\n            else\n                switch costume to (jump1 v)\n            end\n        else\n            if <(jetpackEquipped?) = [true]> then\n                switch costume to (fall1jetpack v)\n            else\n                switch costume to (fall1 v)\n            end\n        end\n        if <<(WalkStatus) = [1]> and <not <(VelocityX) = [0]>>> then\n            if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n                point in direction (80)\n            else\n                point in direction (100)\n            end\n        else\n            point in direction (90)\n        end\n    end\nend\nif <<(PlayerY) < [-400]> and <(dbDeath) = [0]>> then\n    broadcast (Death v)\nend\n\ndefine Jump\nset [velocityy v] to [7.3]\n\ndefine Calculate Y Touch Up\nrepeat until <<not <touching (map v)?>> or <[8] < (Slope)>>\n    change y by (0.5)\n    change [slope v] by (0.5)\nend\nchange y by ((Slope) * (-1))\nif <[8] < (Slope)> then\n    set [walkstatus v] to [0]\n    change x by ((XVNR) * (-2))\n    if <touching (map v)?> then\n        set [velocityy v] to [0]\n    else\n        change [velocityy v] by ((GravityForce) * (Frametime))\n    end\n    change x by (XVNR)\n    set [velocityx v] to [0]\nelse\n    change [playery v] by ((Slope) - (3))\n    set [velocityy v] to [0]\nend\n\nwhen I receive [jump v]\nwait (0.2) seconds\nset [jumpdebounce v] to [0]\n\nwhen I receive [drop v]\nwait (0.4) seconds\nset [dropdebounce v] to [0]\n\nwhen I receive [activateloadingscreen v]\nrepeat (20)\n    change volume by (-5)\nend\n\nwhen I receive [endloadingscreen v]\nrepeat (20)\n    change volume by (5)\nend\n\nwhen I receive [death v]\nset [dbdeath v] to [1]\nbroadcast (activateLoadingScreen v)\nstart sound [death1 v]\n\nwhen I receive [preloadassets v]\nif <(checkpoint) = [0]> then\n    set [playerx v] to [0]\n    set [playery v] to [70]\nend\nif <(checkpoint) = [1]> then\n    set [playerx v] to [3870]\n    set [playery v] to [700]\nend\nif <(checkpoint) = [2]> then\n    set [playerx v] to [4138]\n    set [playery v] to [3100]\nend\nset [camx v] to (PlayerX)\nset [camy v] to (PlayerY)\nset [velocityx v] to [0]\nset [velocityy v] to [0]\nset [jumpdebounce v] to [0]\nset [dropdebounce v] to [0]\nset [dbdeath v] to [0]\nset [xvnr v] to [1]\n\nwhen I receive [enemykill v]\nset [velocityy v] to [5]\n\nset [playerx v] to [0]\nset [playery v] to [0]\nset [camx v] to [0]\nset [camy v] to [0]\nset [velocityx v] to [0]\nset [velocityy v] to [0]\nset [jumpdebounce v] to [0]\nset [dropdebounce v] to [0]\nset [xvnr v] to [1]\nset [dbdeath v] to [0]\nset [walkspeed v] to [138]\n\nset [jetpackequipped? v] to [true]\n\nwhen I receive [startjetpack v]\nif <(jumpDebounce) = [0]> then\n    start sound [jetpackStartup v]\nend\nset [jumpdebounce v] to [1]\n\nstart sound [jetpackIdle v]\n\nset [jetpackequipped? v] to [false]\n\nset [velocityx v] to [0]\n\nset [walkstatus v] to [0]\nchange [velocityy v] by ((GravityForce) * (Frametime))\n\nset [velocityx v] to ((VelocityX) * (-1))\n\nset [jetpackequipped? v] to [true]\n\nset [checkpoint v] to [2]\n\nchange [velocityy v] by ((GravityForce) * (Frametime))\n\nchange [velocityy v] by ((GravityForce) * (Frametime))\nset [velocityy v] to [0]\n\n\n\nset [velocityx v] to ((VelocityX) * (-1))\nset [velocityy v] to [0]\nchange [playery v] by ((Slope) - (3))\n\nchange [debug v] by (1)\n\nset [xvnr v] to [0]\n\nchange [debug v] by (1)\n\nchange [playery v] by (20)\n\n@Map\n\nwhen I receive [frametick v]\nif <(pClone?) = [1]> then\n    go to x: ((pCloneX) - (CamX)) y: (((pCloneY) + (mapVar)) - (CamY))\nend\n\ndefine Spawn (costume) at: (x) (y)\nSpawn (costume) (x) (y)\nwait until <(length of [launchdata v]) = [0]>\n\nwhen flag clicked\nset [pclone? v] to [0]\nhide\n\nwhen I start as a clone\nset [pclone? v] to [1]\nset [pclonex v] to (item (2) of [launchdata v])\nset [pcloney v] to (item (3) of [launchdata v])\nset [mapvar v] to [0]\nset [ghost v] effect to (100)\nswitch costume to (item (1) of [launchdata v])\ngo to x: ((pCloneX) - (CamX)) y: ((pCloneY) - (CamY))\ndelete all of [launchdata v]\nshow\nrepeat (6)\n    change [ghost v] effect by (-17)\nend\nif <(costume [name v]) = [platform4]> then\n    forever\n        if <(touch?) = [true]> then\n            start sound [bouldersFalling v]\n            repeat (60)\n                change [mapvar v] by (((-20) - (mapVar)) / (20))\n                point in direction ((pick random ((mapVar) / (-10)) to ((mapVar) / (10))) + (90))\n            end\n            point in direction (90)\n            repeat (30)\n                change [mapvar v] by (((-600) - (mapVar)) / (20))\n            end\n            hide\n            wait (3) seconds\n            show\n        else\n            repeat until <[-0.2] < (mapVar)>\n                change [mapvar v] by (((0) - (mapVar)) / (5))\n            end\n            set [mapvar v] to [0]\n            point in direction (90)\n        end\n    end\nend\nif <(costume [name v]) = [doors1]> then\n    forever\n        if <<[3020] < (PlayerY)> and <(costume [name v]) = [doors1]>> then\n            broadcast (nextLayer v)\n            if <[0] < (VelocityY)> then\n                start sound [doorClosing v]\n            end\n            wait () seconds\n            switch costume to (doors1a1 v)\n            wait () seconds\n            switch costume to (doors1a2 v)\n            wait () seconds\n            switch costume to (doors1a3 v)\n        end\n    end\nend\n\ndefine Spawn (c) (x) (y)\ndelete all of [launchdata v]\nadd (c) to [launchdata v]\nadd (x) to [launchdata v]\nadd (y) to [launchdata v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    if <(DespawnAllClones) = [1]> then\n        delete this clone\n    end\nend\n\nwhen I receive [preloadassets v]\nSpawn [platform1] at: [0] [-70]\nSpawn [platform2] at: [-272] [-30]\nSpawn [platform3] at: [350] [-20]\nSpawn [platform3] at: [560] [40]\nSpawn [platform1] at: [1000] [100]\nSpawn [platform3] at: [1200] [-300]\nSpawn [platform3] at: [1350] [160]\nSpawn [platform4] at: [1570] [200]\nSpawn [platform1] at: [1950] [260]\nSpawn [platform4] at: [2300] [300]\nSpawn [platform4] at: [2500] [350]\nSpawn [platform1] at: [2900] [400]\nSpawn [platform2] at: [3170] [400]\nSpawn [platform4] at: [3280] [567]\nSpawn [platform4] at: [3390] [567]\nSpawn [platform4] at: [3390] [567]\nSpawn [platform4] at: [3500] [567]\nSpawn [platform4] at: [3610] [567]\nSpawn [platform4] at: [3720] [567]\nSpawn [platform3] at: [3870] [600]\nSpawn [platform3] at: [4140] [650]\nSpawn [platform3] at: [2750] [650]\nSpawn [platform3] at: [2500] [700]\nSpawn [platform3] at: [2250] [750]\nSpawn [platform3] at: [2000] [820]\nSpawn [platform3] at: [1885] [820]\nSpawn [platform4] at: [-500] [200]\nSpawn [platform1] at: [-940] [250]\nSpawn [doors1] at: [4130] [3000]\nSpawn [platform6] at: [3980] [3000]\nSpawn [platform6b] at: [4380] [3000]\nSpawn [wall1] at: [3900] [3246]\nSpawn [wall1] at: [4435] [3246]\nSpawn [platform6b] at: [4400] [3130]\nSpawn [platform6] at: [3970] [3240]\nSpawn [platform6b] at: [4400] [3350]\nSpawn [platform6] at: [3980] [3520]\nSpawn [platform6b] at: [4380] [3520]\nSpawn [wall2] at: [4030] [3620]\nSpawn [platform6] at: [4200] [3720]\nSpawn [wall2] at: [4415] [3620]\nSpawn [wall2] at: [4415] [3810]\nSpawn [platform6b] at: [4350] [3920]\nSpawn [platform6b] at: [3980] [3720]\nSpawn [wall2] at: [4415] [3810]\nSpawn [wall2] at: [4030] [3830]\nSpawn [wall2] at: [4030] [4020]\nSpawn [wall2] at: [4200] [4020]\nSpawn [platform6b] at: [3976] [4130]\nSpawn [platform6] at: [4354] [4130]\n\nbroadcast (activateLoadingScreen v)\n\nwhen I receive [worldtick v]\nMoveTest\nif <(touch?) = [true]> then\n    if <(costume [name v]) = [platform1]> then\n        set [surface v] to [grass]\n    else\n        if <(costume [name v]) = [platform2]> then\n            set [surface v] to [grass]\n        else\n            if <(costume [name v]) = [platform3]> then\n                set [surface v] to [grass]\n            else\n                if <(costume [name v]) = [platform4]> then\n                    set [surface v] to [rock]\n                else\n                    if <(costume [name v]) = [platform4]> then\n                        set [surface v] to [rock]\n                    else\n                        if < (costume [name v]) contains [doors1]?> then\n                            set [surface v] to [metal]\n                        else\n                            set [surface v] to [metal]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(costume [name v]) = [platform4]> then\n    set volume to (((12000) / (([abs v] of ((pCloneX) - (CamX)) ) + ([abs v] of ((pCloneY) - (CamY)) ))) - (20)) %\n    set [pan left/right v] effect to (((pCloneX) - (CamX)) / (2))\nend\n\ndefine MoveTest\nchange y by (20)\nif <touching (character v)?> then\n    set [touch? v] to [true]\nelse\n    set [touch? v] to [false]\nend\nchange y by (-20)\n\nset [checkpoint v] to [2]\n\nbroadcast (activateLoadingScreen v)\n\n@Entities\n\ndefine Spawn (costume) at (x) (y) with tag (tag) with parameter (param)\nCreate (costume) (x) (y) (tag) (param)\nwait until <(length of [launchentity v]) = [0]>\n\ndefine Create (c) (x) (y) (tag) (p)\ndelete all of [launchentity v]\nadd (c) to [launchentity v]\nadd (x) to [launchentity v]\nadd (y) to [launchentity v]\nadd (tag) to [launchentity v]\nadd (p) to [launchentity v]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [despawnallclones v] to [0]\nset size to (100) %\nclear sound effects\nhide\nset [type v] to [0]\nset [isentity? v] to [0]\n\nwhen I start as a clone\npoint in direction (90)\nclear graphic effects\nset [soundvolume v] to [1]\nset [isentity? v] to [1]\nset [entityx v] to (item (2) of [launchentity v])\nset [entityy v] to (item (3) of [launchentity v])\nset [type v] to (item (4) of [launchentity v])\nset [entityparameter v] to (item (5) of [launchentity v])\nswitch costume to (item (1) of [launchentity v])\ndelete all of [launchentity v]\nset [entityvariable v] to [0]\nset [ghost v] effect to (100)\nshow\nif <<(type) = [tut]> or <(type) = [tut2]>> then\n    go to [back v] layer\nend\nif <<<(type) = [sus]> or <(type) = [lau]>> or <(type) = [ps5]>> then\n    go to [back v] layer\nend\nif <(type) = [tel]> then\n    go to [back v] layer\nend\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nif <(type) = [ene]> then\n    repeat until <(entityParameter) = [-1]>\n        wait (1) seconds\n        repeat until <(entityParameter) < (entityVariable)>\n            if <[98] < (size)> then\n                change [entityvariable v] by ((50) * (Frametime))\n            end\n        end\n        if <[98] < (size)> then\n            set [entityvariable v] to (entityParameter)\n        end\n        wait (1) seconds\n        repeat until <(entityVariable) < [0]>\n            if <[98] < (size)> then\n                change [entityvariable v] by ((-50) * (Frametime))\n            end\n        end\n        if <[98] < (size)> then\n            set [entityvariable v] to [0]\n        end\n    end\n    set [entityvariable v] to [0]\nend\nif <(type) = [sus]> then\n    forever\n        play sound [loop1 v] until done\n    end\nend\nif <(type) = [tel]> then\n    forever\n        start sound [static v]\n        switch costume to (tv1 v)\n        wait (1) seconds\n        switch costume to (tv2 v)\n        wait (1) seconds\n        switch costume to (tv3 v)\n        wait (1) seconds\n    end\nend\nif <(type) = [lau]> then\n    forever\n        if <(entityVariable) = [1]> then\n            repeat (3)\n                switch costume to (join [launcher2a] (entityVariable))\n                change [entityvariable v] by (2)\n            end\n            wait (1) seconds\n            set [entityvariable v] to [6]\n            repeat (5)\n                switch costume to (join [launcher2a] (entityVariable))\n                change [entityvariable v] by (-1)\n            end\n            switch costume to (launcher1 v)\n            set [entityvariable v] to [0]\n        end\n    end\nend\nif <(type) = [spo]> then\n    forever\n        if <(entityVariable) = [3]> then\n            set [walkspeed v] to (entityParameter)\n            start sound [powerup v]\n            wait (1) seconds\n            set [entityvariable v] to [-1]\n            wait (5) seconds\n            set [walkspeed v] to [138]\n            wait (10) seconds\n            set [entityvariable v] to [0]\n        end\n    end\nend\n\nwhen I receive [frametick v]\nif <(isEntity?) = [1]> then\n    go to x: (((entityX) + (entityVariable)) - (CamX)) y: ((entityY) - (CamY))\n    if <(type) = [ene]> then\n        if <<touching (character v)?> and <[99] < (size)>> then\n            if <<((entityY) + (10)) < (PlayerY)> and <(VelocityY) < [0]>> then\n                change size by (-2)\n                start sound [buttonClick1 v]\n                start sound [death1 v]\n                start sound [whoosh1 v]\n                broadcast (enemyKill v)\n            else\n                change size by (-1)\n                broadcast (Death v)\n            end\n        end\n    end\n    if <(type) = [sus]> then\n        change [color v] effect by (7)\n    end\n    if <(type) = [lau]> then\n        go to x: ((entityX) - (CamX)) y: ((entityY) - (CamY))\n        if <<touching (character v)?> and <(entityVariable) = [0]>> then\n            start sound [spring1 v]\n            set [entityvariable v] to [1]\n            set [velocityy v] to (entityParameter)\n        end\n    end\n    if <(type) = [spo]> then\n        go to x: ((entityX) - (CamX)) y: ((entityY) - (CamY))\n        if <(entityVariable) = [0]> then\n            set [ghost v] effect to (0)\n            change size by (((110) - (size)) / (4))\n            if <[105] < (size)> then\n                set [entityvariable v] to [1]\n            end\n        else\n            if <(entityVariable) = [-1]> then\n                change size by (((pick random (40) to (60)) - (size)) / (4))\n                set [ghost v] effect to (20)\n            else\n                set [ghost v] effect to (0)\n                if <(entityVariable) = [3]> then\n                    change size by (((pick random (110) to (130)) - (size)) / (4))\n                else\n                    change size by (((60) - (size)) / (4))\n                    if <(size) < [65]> then\n                        set [entityvariable v] to [0]\n                    end\n                end\n            end\n        end\n    end\n    if <(type) = [chk]> then\n        go to x: ((entityX) - (CamX)) y: ((entityY) - (CamY))\n        if <(entityVariable) = [3]> then\n            change size by (((130) - (size)) / (4))\n        else\n            if <(entityVariable) = [0]> then\n                change size by (((110) - (size)) / (4))\n                if <[105] < (size)> then\n                    set [entityvariable v] to [1]\n                end\n            else\n                change size by (((60) - (size)) / (4))\n                if <(size) < [65]> then\n                    set [entityvariable v] to [0]\n                end\n            end\n        end\n    end\n    if <(type) = [jtp]> then\n        go to x: ((entityX) - (CamX)) y: ((entityY) - (CamY))\n        if <(entityVariable) = [3]> then\n            change size by (((110) - (size)) / (4))\n        else\n            if <(entityVariable) = [0]> then\n                change size by (((100) - (size)) / (4))\n                if <[95] < (size)> then\n                    set [entityvariable v] to [1]\n                end\n            else\n                change size by (((60) - (size)) / (4))\n                if <(size) < [65]> then\n                    set [entityvariable v] to [0]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [activateloadingscreen v]\nrepeat (20)\n    change [soundvolume v] by (-0.05)\nend\n\nwhen I receive [endloadingscreen v]\nrepeat (20)\n    change [soundvolume v] by (0.05)\nend\n\nwhen I receive [worldtick v]\nif <(type) = [ene]> then\n    if <<<(entityVariable) = [0]> or <(entityVariable) = (entityParameter)>> or <(size) < [99]>> then\n        if <(size) < [99]> then\n            switch costume to (enemy1dead v)\n            change [ghost v] effect by (20)\n            change size by (-4)\n            change [entityy v] by (-3)\n            if <(size) < [50]> then\n                set [entityparameter v] to [-1]\n            end\n        else\n            switch costume to (enemy1 v)\n        end\n    else\n        if <(costume [name v]) = [enemy1move1]> then\n            switch costume to (enemy1move2 v)\n            set [pitch v] effect to (pick random (10) to (40))\n            start sound [step2 v]\n        else\n            switch costume to (enemy1move1 v)\n        end\n    end\nend\nif <(type) = [tut]> then\n    if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<key (a v) pressed?> or <key (left arrow v) pressed?>>> then\n        if <key (d v) pressed?> then\n            switch costume to (tutorial1d v)\n            set [pitch v] effect to (-20)\n        end\n        if <key (left arrow v) pressed?> then\n            switch costume to (tutorial1< v)\n            set [pitch v] effect to (20)\n        end\n        if <key (a v) pressed?> then\n            switch costume to (tutorial1a v)\n            set [pitch v] effect to (-10)\n        end\n        if <key (right arrow v) pressed?> then\n            switch costume to (tutorial1> v)\n            set [pitch v] effect to (30)\n        end\n        start sound [beacon v]\n    else\n        switch costume to (tutorial1 v)\n    end\nend\nif <(type) = [tut2]> then\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <key (space v) pressed?>> then\n        if <key (w v) pressed?> then\n            switch costume to (tutorial2w v)\n        end\n        if <<key (up arrow v) pressed?> or <key (space v) pressed?>> then\n            switch costume to (tutorial2> v)\n        end\n    else\n        switch costume to (tutorial2 v)\n    end\nend\nif <(type) = [chk]> then\n    if <not <(entityVariable) = [3]>> then\n        if <(checkpoint) < (entityParameter)> then\n            if <touching (character v)?> then\n                start sound [powerup v]\n                set [checkpoint v] to (entityParameter)\n                set [entityvariable v] to [3]\n                switch costume to (checkpoint1set v)\n                set [ghost v] effect to (40)\n            end\n        else\n            set [entityvariable v] to [3]\n            switch costume to (checkpoint1set v)\n            set [ghost v] effect to (40)\n        end\n    else\n        set [ghost v] effect to (40)\n    end\nend\nif <(type) = [spo]> then\n    if <<touching (character v)?> and <not <<(entityVariable) = [-1]> or <(entityVariable) = [3]>>>> then\n        set [entityvariable v] to [3]\n    end\nend\nif <(type) = [jtp]> then\n    if <<touching (character v)?> and <not <<(entityVariable) = [-1]> or <(entityVariable) = [3]>>>> then\n        set [entityvariable v] to [3]\n        set [jetpackequipped? v] to [true]\n        start sound [powerup v]\n    end\nend\nif <<(type) = [sus]> or <(type) = [tel]>> then\n    set volume to ((((7500) / (([abs v] of ((entityX) - (CamX)) ) + ([abs v] of ((entityY) - (CamY)) ))) - (20)) * (soundVolume)) %\nelse\n    set volume to ((((15000) / (([abs v] of ((entityX) - (CamX)) ) + ([abs v] of ((entityY) - (CamY)) ))) - (8)) * (soundVolume)) %\nend\nset [pan left/right v] effect to (((entityX) - (CamX)) / (2))\n\nwhen I start as a clone\nforever\n    if <(DespawnAllClones) = [1]> then\n        delete this clone\n    end\n    if <(entityParameter) = [-1]> then\n        delete this clone\n    end\nend\n\nwhen I receive [preloadassets v]\nSpawn [susak] at [1200] [-200] with tag [sus] with parameter [0]\nSpawn [tv1] at [1945] [930] with tag [tel] with parameter [0]\nSpawn [ps5] at [-947] [347] with tag [ps5] with parameter [0]\nif <(checkpoint) < [1]> then\n    Spawn [tutorial1] at [0] [40] with tag [tut] with parameter [0]\n    Spawn [tutorial2] at [1000] [147] with tag [tut2] with parameter [0]\n    Spawn [enemy1] at [1050] [147] with tag [ene] with parameter [0]\n    Spawn [enemy1] at [1844] [307] with tag [ene] with parameter [150]\n    Spawn [enemy1] at [2785] [448] with tag [ene] with parameter [100]\nend\nif <[0] < (checkpoint)> then\n    Spawn [launcher1] at [-146] [-50] with tag [lau] with parameter [12]\nend\nSpawn [launcher1] at [3030] [420] with tag [lau] with parameter [12]\nSpawn [orb1] at [3164] [631] with tag [spo] with parameter [300]\nSpawn [launcher1] at [4138] [688] with tag [lau] with parameter [40]\nSpawn [checkpoint1] at [3870] [670] with tag [chk] with parameter [1]\nSpawn [checkpoint1] at [4138] [3035] with tag [chk] with parameter [2]\nSpawn [jetpackUpgrade] at [4297] [3397] with tag [jtp] with parameter [0]\n\n\n\nchange [entityvariable v] by (6)\n\n@Particles\n\nwhen I receive [jump v]\nif <(clone?) = [0]> then\n    Generate Jump Effect\nend\n\nwhen I receive [frametick v]\nif <(clone?) = [1]> then\n    go to x: ((cloneX) - (CamX)) y: ((cloneY) - (CamY))\n    change [clonex v] by (([sin v] of (direction) ) * (2))\n    change [cloney v] by (([cos v] of (direction) ) * (2))\n    change [clonetimer v] by (1)\n    change [ghost v] effect by (1)\n    change size by (((200) - (size)) / (20))\n    if <(cloneTimer) = [2]> then\n        show\n    end\n    if <[30] < (cloneTimer)> then\n        delete this clone\n    end\nend\n\ndefine Generate Jump Effect\ngo to x: ((PlayerX) - (CamX)) y: (((PlayerY) - (CamY)) - (60))\nrepeat (6)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\nset [clone? v] to [0]\n\nwhen I start as a clone\ngo to [front v] layer\nset [clone? v] to [1]\nset [clonex v] to (PlayerX)\nset [cloney v] to ((PlayerY) - (30))\nset [clonetimer v] to [0]\nset size to (pick random (20) to (40)) %\nset [ghost v] effect to (75)\nif <(pick random (1) to (0)) = [1]> then\n    point in direction (pick random (60) to (120))\nelse\n    point in direction (pick random (-60) to (-120))\nend\n\nchange x by (10)\n\n@Background\n\nwhen flag clicked\nset volume to (0) %\nrepeat (20)\n    change volume by (2)\nend\n\nwhen flag clicked\nforever\n    if <(checkpoint) < [2]> then\n        play sound [forestAmbient v] until done\n    end\nend\n\nwhen I receive [activateloadingscreen v]\nrepeat (20)\n    change volume by (-5)\nend\n\nwhen I receive [endloadingscreen v]\nrepeat (20)\n    change volume by (5)\nend\n\nwhen flag clicked\nset [checkpoint v] to [0]\nhide\nset [cloudlayeroffset v] to [0]\ngo to [back v] layer\nswitch costume to (cloudlayer1 v)\ncreate clone of (_myself_ v)\nswitch costume to (cloudlayer2 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nif <(costume [number v]) = [1]> then\n    set [cloudlayeroffset v] to [560]\n    forever\n        go to x: (((CamX) / (-10)) + (CloudLayerOffset)) y: (((CamY) / (-10)) + (2))\n        if <(CloudLayerOffset) < [-550]> then\n            set [cloudlayeroffset v] to [560]\n        end\n    end\nend\nif <(costume [number v]) = [2]> then\n    set [cloudlayeroffset v] to [0]\n    forever\n        go to x: (((CamX) / (-10)) + (CloudLayerOffset)) y: (((CamY) / (-10)) + (2))\n        if <(CloudLayerOffset) < [-550]> then\n            set [cloudlayeroffset v] to [560]\n        end\n    end\nend\n\nforever\n\nwhen I receive [frametick v]\nchange [cloudlayeroffset v] by (-0.1)\ngo to [back v] layer\n\nwhen flag clicked\nset [camx v] to [0]\nwait until <[450] < (CamX)>\nforever\n    if <(checkpoint) < [2]> then\n        play sound [sound1alpha v] until done\n    end\n    if <[1] < (checkpoint)> then\n        wait (1) seconds\n        play sound [sound2alpha v] until done\n    end\nend\n\nwhen I start as a clone\nforever\n    set [brightness v] effect to (smoothTransition)\nend\n\nwhen I receive [nextlayer v]\nrepeat (10)\n    change volume by (-10)\nend\nstop all sounds\nrepeat (30)\n    change volume by (4)\nend\n\n@LoadingScreen\n\nwhen I receive [activateloadingscreen v]\nswitch costume to (background v)\ngo to [front v] layer\nset [smoothbackgr v] to [100]\nset [screencovered? v] to [0]\nset [ghost v] effect to (100)\ncreate clone of (_myself_ v)\nshow\nset size to (100) %\nrepeat (20)\n    change [smoothbackgr v] by (((0) - (smoothBackgr)) / (3))\n    set [ghost v] effect to (smoothBackgr)\nend\nset [ghost v] effect to (0)\nset [screencovered? v] to [1]\nset [despawnallclones v] to [1]\nwait (1) seconds\nset [despawnallclones v] to [0]\nbroadcast (preloadAssets v)\nwait (1.5) seconds\nbroadcast (EndLoadingScreen v)\nset [screencovered? v] to [0]\n\nwhen flag clicked\nhide\nclear graphic effects\ngo to x: (0) y: (0)\nset [screencovered? v] to [0]\nset [checkpoint v] to [0]\nbroadcast (preloadAssets v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (loader v)\nset [ghost v] effect to (100)\nset size to (70) %\nshow\nwait (0.4) seconds\nrepeat (20)\n    go to [front v] layer\n    change [ghost v] effect by (-5)\n    change size by (((120) - (size)) / (5))\nend\n\nwait (1) seconds\n\nset [ghost v] effect to (smoothBackgr)\n\nset size to (100) %\n\nwhen I receive [endloadingscreen v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\ndelete this clone\n\n@JetpackSound\n\nwhen flag clicked\nset volume to (((jetpackThrottle) * (200)) - (150)) %\nforever\n    play sound [jetpackIdle v] until done\nend\n\nwhen I receive [frametick v]\nset volume to (((jetpackThrottle) * (100)) - (5)) %\n\n@EndScreen\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\nset [ghost v] effect to (100)\nshow\nforever\n    if <[4180] < (PlayerY)> then\n        repeat (100)\n            change [ghost v] effect by (-4)\n        end\n        wait (2) seconds\n        hide\n    end\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