SHOOT PLATFORMER!

Instructions:  ⁕https://online-lessen.com⁕

@Stage\n\nwhen flag clicked\nswitch backdrop to (achtergrond1 v)\n\nwhen I receive [don v]\nswitch backdrop to (achtergrond2 v)\n\nwhen I receive [done v]\nswitch backdrop to (backdrop1 v)\nbroadcast (klaar v)\n\n@Sprite3\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\n\nwhen flag clicked\nset [level v] to [1]\ngo to [front v] layer\nhide\nforever\n    if <(level) = [1]> then\n        switch costume to (costume2 v)\n    end\n    if <(level) = [2]> then\n        switch costume to (uiterlijk1 v)\n    end\n    if <(level) = [3]> then\n        switch costume to (uiterlijk2 v)\n    end\n    if <(level) = [4]> then\n        switch costume to (uiterlijk3 v)\n    end\n    if <(level) = [5]> then\n        switch costume to (uiterlijk4 v)\n    end\n    if <(level) = [6]> then\n        hide\n    end\nend\n\nwhen I receive [don v]\nhide\n\n@player\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    go to [front v] layer\n    show\n    show variable [level v]\n    wait (0) seconds\n    show\n    switch costume to (right v)\n    show variable [level v]\n    set [level v] to [1]\n    set [x velocity v] to [0]\n    set [y velocity v] to [0]\n    go to x: (-215) y: (-76)\n    forever\n        if <(x position) > [230]> then\n            change [level v] by (1)\n            set [y velocity v] to [0]\n            set [x velocity v] to [0]\n            go to x: (-195) y: (-76)\n            broadcast (NextLVL v)\n        end\n        if <key (right arrow v) pressed?> then\n            change [x velocity v] by (1)\n            switch costume to (right v)\n        end\n        if <key (left arrow v) pressed?> then\n            change [x velocity v] by (-1)\n            switch costume to (left v)\n        end\n        if <not <key (any v) pressed?>> then\n            switch costume to (normal v)\n        end\n        set [x velocity v] to ((x velocity) * (.9))\n        change x by (x velocity)\n        if <touching (lijn2 v)?> then\n            change y by (1)\n            if <touching (lijn2 v)?> then\n                change y by (1)\n                if <touching (lijn2 v)?> then\n                    change y by (1)\n                    if <touching (lijn2 v)?> then\n                        change y by (1)\n                        if <touching (lijn2 v)?> then\n                            change y by (1)\n                            if <touching (lijn2 v)?> then\n                                change x by ((x velocity) * (-1))\n                                change y by (-5)\n                                if <key (up arrow v) pressed?> then\n                                    if <(x velocity) > [0]> then\n                                        set [x velocity v] to [-5]\n                                    else\n                                        set [x velocity v] to [5]\n                                    end\n                                    set [y velocity v] to [10]\n                                else\n                                    set [x velocity v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y velocity v] by (-1)\n        change y by (y velocity)\n        if <touching (lijn2 v)?> then\n            change y by ((y velocity) * (-1))\n            set [y velocity v] to [0]\n        end\n        change y by (-1)\n        if <touching (lijn2 v)?> then\n            if <key (up arrow v) pressed?> then\n                change [y velocity v] by (15)\n            end\n        end\n        if <touching (sprite3 v)?> then\n            go to x: (-214) y: (-90)\n        end\n        if <touching (spring plank v)?> then\n            set [y velocity v] to [20]\n        end\n        if <(level) = [15]> then\n            hide variable [level v]\n        end\n        if <touching (bounce pad 2 v)?> then\n            set [y velocity v] to [20]\n        end\n        change y by (1)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nhide variable [level v]\nhide\n\nwhen flag clicked\nforever\n    set [x v] to (x position)\n    set [y v] to (y position)\nend\n\nwhen I receive [player dood v]\ngo to x: (-195) y: (-76)\n\n@lijn2\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    go to [front v] layer\n    if <(level) = [1]> then\n        switch costume to (uiterlijk1 v)\n    end\n    if <(level) = [2]> then\n        switch costume to (uiterlijk2 v)\n    end\n    if <(level) = [3]> then\n        switch costume to (uiterlijk3 v)\n    end\n    if <(level) = [4]> then\n        switch costume to (uiterlijk4 v)\n    end\n    if <(level) = [5]> then\n        switch costume to (uiterlijk5 v)\n    end\n    if <(level) = [6]> then\n        switch costume to (uiterlijk6 v)\n    end\nend\n\nwhen flag clicked\nhide\n\nset [level v] to [5]\n\n@Sprite2\n\nwhen flag clicked\nhide\n\n@Sprite4\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\n\nwhen I start as a clone\nforever\n    repeat (40)\n        change [ghost v] effect by (12)\n    end\n    delete this clone\nend\n\nwhen flag clicked\nhide\ngo to x: (-74) y: (23)\n\nwhen I receive [klaar v]\nshow\ngo to (player v)\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    go to (player v)\n    create clone of (_myself_ v)\n    go to x: (x) y: (y)\n    go [backward v] (1) layers\nend\n\n@Intro\n\nwhen I start as a clone\nif <(Clone) = [Particles]> then\n    switch costume to (pick random (29) to (31))\n    set size to (pick random (50) to (150)) %\n    set [ghost v] effect to (pick random (0.) to (5.))\n    set [brightness v] effect to (pick random (-25.) to (100.))\n    go to x: (0) y: (0)\n    point in direction (pick random (-180) to (180))\n    set [x v] to (pick random (10.) to (12.))\n    set [i v] to (pick random (2.) to (9.))\n    go to [front v] layer\n    show\n    repeat until <touching (_edge_ v)?>\n        move (X) steps\n        change y by (I)\n        change [i v] by (-0.4)\n        set [x v] to ((X) * (0.95))\n    end\n    delete this clone\nend\n\ndefine Particles\nset [clone v] to [Particles]\nrepeat (50)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(Clone) = [Name]> then\n    switch costume to (name v)\n    set size to (50) %\n    clear graphic effects\n    go to [front v] layer\n    go to x: (0) y: (-100)\n    point in direction (0)\n    show\n    repeat (50)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        change y by (((0) - (y position)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (10)\n        go to [front v] layer\n        change size by (I)\n        change [i v] by (join [-] (([abs v] of (I) ) / (2)))\n        turn right (I) degrees\n    end\n    switch costume to (logo v)\n    repeat (40)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (20)\n        go to [front v] layer\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n    end\n    delete this clone\nend\n\nwhen flag clicked\nreset timer\nhide\nstart sound [Prismo - Stronger v]\nset volume to (100) %\nclear graphic effects\nset size to (100) %\npoint in direction (90)\ngo to x: (0) y: (0)\nset [clone v] to [Square]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone v] to [Name]\ncreate clone of (_myself_ v)\nwait (0) seconds\nrepeat (2)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (4)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (2)\n    Spiral spline explosion\n    Rect\n    Spiral spline explosion\nend\n\nwhen I start as a clone\nif <(Clone) = [Square]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to x: (0) y: (300)\n    point in direction (0)\n    switch costume to (square v)\n    repeat (20)\n        change size by (((100) - (size)) / (5))\n        turn right (((90) - (direction)) / (5)) degrees\n        change y by (((0) - (y position)) / (5))\n    end\n    point in direction (90)\n    repeat (12)\n        next costume\n    end\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((2000) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    wait (3) seconds\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((100) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    repeat (12)\n        switch costume to ((costume [number v]) - (1))\n        change size by (-5)\n    end\n    set [i v] to [-1]\n    repeat (20)\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n        change y by ((I) / (3))\n    end\n    broadcast (done v)\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Bursts]> then\n    switch costume to (lineexplosion1 v)\n    clear graphic effects\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [i v] to (pick random (1) to (3))\n    if <(I) = [1]> then\n        set [brightness v] effect to (100)\n    else\n        if <(I) = [2]> then\n            set [brightness v] effect to (25)\n        else\n            set [brightness v] effect to (-25)\n        end\n    end\n    show\n    set [i v] to [20]\n    Animate   x: [0] y: [0] size: [0] rotate: (pick random (-180) to (180)) speed: [1]\n    repeat (2)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n    end\n    repeat (10)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n        change [ghost v] effect by (10)\n        next costume\n    end\n    delete this clone\nend\n\ndefine Animate   x: (x) y: (y) size: (s) rotate: (r) speed: (s)\nchange x by (((round (x)) - (round (x position))) / (s))\nchange y by (((round (y)) - (round (y position))) / (s))\nchange size by (((round (s)) - (round (size))) / (s))\nturn right (((round (r)) - (round (direction))) / (s)) degrees\n\ndefine Spiral spline explosion\nset [clone v] to [Bursts]\nrepeat (5)\n    create clone of (_myself_ v)\nend\n\ndefine Size: (s) speed: (spd)\nchange size by (((round (s)) - (round (size))) / (spd))\n\ndefine Rect\nset [clone v] to [Rect]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Rect]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to (random position v)\n    point in direction (90)\n    switch costume to (background rect v)\n    repeat until <(round (size)) = [300]>\n        change size by (((300) - (size)) / (15))\n        change [ghost v] effect by (4)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Circle]> then\n    clear graphic effects\n    set [brightness v] effect to (100)\n    go to [front v] layer\n    go [backward v] (2) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    delete this clone\nend\n\ndefine Circle\nset [clone v] to [Circle]\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nset [clone v] to [Circle 2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Circle 2]> then\n    clear graphic effects\n    set [brightness v] effect to (0)\n    go to [front v] layer\n    go [backward v] (1) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    delete this clone\nend\n\n@Sprite1\n\nwhen I receive [klaar v]\nshow\ngo to (player v)\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    point towards (mouse-pointer v)\n    go to (player v)\nend\n\nwhen flag clicked\nhide\n\n@Sprite5\n\nwhen I receive [klaar v]\ngo to [front v] layer\nshow\ngo to (sprite1 v)\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    point towards (mouse-pointer v)\n    go to (sprite1 v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [klaar v]\nforever\n    if <<mouse down?> and <not <(max shoots) = (shoots)>>> then\n        change [shoots v] by (1)\n        create clone of (_myself_ v)\n        wait (1) seconds\n    end\nend\n\nwhen I start as a clone\nrepeat until <<touching (_edge_ v)?> or <touching (lijn2 v)?>>\n    move (20) steps\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <touching (vijand v)?> then\n        broadcast (dood v)\n        delete this clone\n    end\nend\n\nhide variable [level v]\n\n@vijand\n\nwhen flag clicked\nset [level v] to [1]\ngo to [front v] layer\nhide\nforever\n    if <(level) = [1]> then\n        point in direction (90)\n        go to x: (0) y: (-85)\n    end\n    if <(level) = [2]> then\n        point in direction (90)\n        go to x: (-100) y: (-85)\n    end\n    if <(level) = [3]> then\n        point in direction (90)\n        go to x: (0) y: (-85)\n    end\n    if <(level) = [4]> then\n        point in direction (90)\n        go to x: (-50) y: (90)\n    end\n    if <(level) = [5]> then\n        go to x: (-53) y: (56)\n        point in direction (45)\n    end\n    if <(level) = [6]> then\n        point in direction (90)\n        go to x: (68) y: (92)\n    end\nend\n\nwhen I receive [klaar v]\nshow\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\n\nwhen I receive [dood v]\nif <not <(level) = [6]>> then\n    hide\nend\n\nwhen I receive [nextlvl v]\nshow\n\n@Sprite6\n\nwhen I receive [klaar v]\nshow\ngo to (vijand v)\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    point towards (player v)\n    go to (vijand v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [dood v]\nhide\n\nwhen I receive [nextlvl v]\nshow\n\n@Sprite7\n\nwhen I receive [klaar v]\ngo to [front v] layer\nshow\ngo to (sprite6 v)\nset [ghost v] effect to (100)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    go to (sprite6 v)\n    point towards (player v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [klaar v]\nforever\n    change [shoots v] by (1)\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\nrepeat until <<touching (_edge_ v)?> or <touching (lijn2 v)?>>\n    move (20) steps\nend\ndelete this clone\n\nwhen I receive [dood v]\nhide\n\nwhen I receive [nextlvl v]\nshow\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        broadcast (player dood v)\n    end\nend\n\n