°A little Mystery° A Platformer


@Stage\n\nwhen flag clicked\nset [pixelate v] effect to (200)\n\n@Main\n\nwhen flag clicked\nerase all\nset [game_loop v] to [1]\nset [game_gravity v] to [-1]\nset [game_level v] to [1]\nset [game_levelcount v] to [24]\nbroadcast (ToFront_Ground v) and wait\nbroadcast (ToFront_Traps v) and wait\nbroadcast (ToFront_Player v) and wait\nbroadcast (ToFront_Foreground1 v) and wait\nbroadcast (ToFront_Foreground2 v) and wait\nbroadcast (ToFront_Foreground3 v) and wait\nbroadcast (ToFront_Monsters v) and wait\nbroadcast (ToFront_Text v) and wait\nbroadcast (ToFront_Sign v) and wait\nbroadcast (ToFront_Spider v) and wait\nbroadcast (GameStart v)\n\n@Player\n\ndefine Reset\nset [player_yvel v] to [0]\nset [player_xvel v] to [0]\ngo to x: (-200) y: (60)\npoint in direction (90)\n\ndefine None\nchange y by (yvel)\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        if <(yvel) > [0]> then\n            change y by (-1)\n        else\n            change y by (1)\n        end\n    end\n    if <(yvel) > [0]> then\n        set [player_yvel v] to ((yvel) * (-0.5))\n        set [player_falling v] to [1]\n    else\n        set [player_yvel v] to [0]\n        set [player_falling v] to [0]\n        if <(yvel) < [-7]> then\n            start sound [land v]\n        end\n    end\nelse\n    set [player_falling v] to [1]\nend\n\ndefine None\nchange x by (xvel)\nset [player_steps v] to [0]\nrepeat until <<(player_steps) = [12]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [player_steps v] by (1)\nend\nif <(player_steps) = [12]> then\n    change y by (-12)\nend\nif <touching (ground v)?> then\n    change x by ((xvel) * (-1))\n    if <key (up arrow v) pressed?> then\n        start sound [Jump v]\n        if <(xvel) > [0]> then\n            set [player_xvel v] to [-5]\n        else\n            set [player_xvel v] to [5]\n        end\n        set [player_yvel v] to [11]\n    else\n        set [player_xvel v] to ((xvel) * (-0.75))\n    end\nend\n\nwhen I receive [tofront_player v]\ngo to [front v] layer\n\nwhen I receive [gamestart v]\nset [statistics_deaths v] to [0]\nset [statistics_time v] to [0]\nset [statistics_pumpkinssmashed v] to [0]\nset [statistics_spidersscared v] to [0]\nset size to (100) %\nshow\nReset\nbroadcast (DrawLevel v)\nrepeat until <(game_loop) = [0]>\n    Physics\nend\n\ndefine Physics\npoint in direction (90)\nchange y by ((player_rotationYAddition) * (-1))\nchange [player_yvel v] by (game_gravity)\nMoveY (player_yVel)\nif <<key (up arrow v) pressed?> and <(player_falling) = [0]>> then\n    set [player_yvel v] to [13]\n    start sound [Jump v]\nend\nset [player_isxinput v] to [0]\nif <key (right arrow v) pressed?> then\n    change [player_xvel v] by (0.625)\n    set [player_isxinput v] to [1]\nend\nif <key (left arrow v) pressed?> then\n    change [player_xvel v] by (-0.625)\n    set [player_isxinput v] to [1]\nend\nif <(player_falling) = [0]> then\n    set [player_xvel v] to ((player_xVel) * (0.875))\nelse\n    set [player_xvel v] to ((player_xVel) * (0.9))\nend\nMoveX (player_xVel)\nif <(x position) > [235]> then\n    change [game_level v] by (1)\n    start sound [Stab v]\n    if <(game_level) > (game_levelCount)> then\n        set [game_loop v] to [0]\n        set [game_level v] to ((game_levelCount) + (1))\n        set [statistics_time v] to (round (timer))\n        set [statistics_pumpkinssmashed v] to (pumpkinCounter_count)\n        broadcast (DrawLevel v)\n        broadcast (GameEnd v)\n    else\n        Reset\n        broadcast (DrawLevel v)\n    end\nend\nBoxRotaion\nif <touching (traps v)?> then\n    Reset\n    start sound [Scream Short v]\n    change [statistics_deaths v] by (1)\nend\nif <(y position) < [-175]> then\n    Reset\n    start sound [Scream Short v]\n    change [statistics_deaths v] by (1)\nend\n\ndefine BoxRotaion\npoint in direction (player_storedDir)\nturn right ((player_xVel) * (6)) degrees\nif <(player_falling) = [0]> then\n    set [player_rotationyaddition v] to (((45) - ([abs v] of (((direction) mod (90)) - (45)) )) / (10))\nelse\n    set [player_rotationyaddition v] to [0]\nend\nset [player_storeddir v] to (direction)\nchange y by (player_rotationYAddition)\nif <<(player_isXInput) = [0]> and <(player_falling) = [0]>> then\n    if <not <(((round ((direction) / (5))) * (5)) mod (90)) = [0]>> then\n        if <(((direction) mod (90)) - (45)) > [0]> then\n            change [player_xvel v] by (0.15)\n        end\n        if <(((direction) mod (90)) - (45)) < [0]> then\n            change [player_xvel v] by (-0.15)\n        end\n    end\nend\n\n@Ground\n\nwhen I receive [tofront_ground v]\ngo to [front v] layer\n\nwhen I receive [drawlevel v]\nswitch costume to (game_level)\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\n@Traps\n\nwhen I receive [drawlevel v]\nswitch costume to (game_level)\n\nwhen I receive [tofront_traps v]\ngo to [front v] layer\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\n@Foreground\n\nwhen I receive [tofront_foreground1 v]\ngo to [front v] layer\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\n\n@Foreground 2\n\nwhen I receive [tofront_foreground2 v]\ngo to [front v] layer\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\n@Foreground 3\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [tofront_foreground3 v]\ngo to [front v] layer\n\n@Foreground Monster\n\ndefine Close Eyes\nswitch costume to (open v)\nwait (0.05) seconds\nswitch costume to (half open v)\nwait (0.05) seconds\nswitch costume to (nearly closed v)\nwait (0.05) seconds\nswitch costume to (closed v)\n\ndefine Open Eyes\nswitch costume to (closed v)\nwait (0.05) seconds\nswitch costume to (nearly closed v)\nwait (0.05) seconds\nswitch costume to (half open v)\nwait (0.05) seconds\nswitch costume to (open v)\n\ndefine Blink\nswitch costume to (open v)\nwait (0.01) seconds\nswitch costume to (half open v)\nwait (0.01) seconds\nswitch costume to (closed v)\nwait (pick random (0.01) to (0.2)) seconds\nswitch costume to (closed v)\nwait (0.01) seconds\nswitch costume to (half open v)\nwait (0.01) seconds\nswitch costume to (open v)\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (204) y: (-171)\nswitch costume to (closed v)\nforever\n    Open Eyes\n    repeat (pick random (3) to (5))\n        wait (pick random (0.1) to (1)) seconds\n        Blink\n        wait (pick random (0.25) to (1)) seconds\n    end\n    Close Eyes\n    wait (pick random (3) to (13)) seconds\nend\n\nwhen I receive [tofront_monsters v]\ngo to [front v] layer\n\n@Foreground Monster2\n\ndefine Close Eyes\nswitch costume to (open v)\nwait (0.05) seconds\nswitch costume to (half open v)\nwait (0.05) seconds\nswitch costume to (nearly closed v)\nwait (0.05) seconds\nswitch costume to (closed v)\n\ndefine Open Eyes\nswitch costume to (closed v)\nwait (0.05) seconds\nswitch costume to (nearly closed v)\nwait (0.05) seconds\nswitch costume to (half open v)\nwait (0.05) seconds\nswitch costume to (open v)\n\ndefine Blink\nswitch costume to (open v)\nwait (0.01) seconds\nswitch costume to (half open v)\nwait (0.01) seconds\nswitch costume to (closed v)\nwait (pick random (0.01) to (0.2)) seconds\nswitch costume to (closed v)\nwait (0.01) seconds\nswitch costume to (half open v)\nwait (0.01) seconds\nswitch costume to (open v)\n\nwhen flag clicked\nset size to (50) %\ngo to [front v] layer\nswitch costume to (closed v)\nshow\ngo to x: (-220) y: (166)\nwait (pick random (3) to (8)) seconds\nforever\n    Open Eyes\n    repeat (pick random (3) to (5))\n        wait (pick random (0.1) to (1)) seconds\n        Blink\n        wait (pick random (0.25) to (1)) seconds\n    end\n    Close Eyes\n    wait (pick random (3) to (13)) seconds\nend\n\nwhen I receive [tofront_monsters v]\ngo to [front v] layer\n\n@Instructions\n\ndefine Fade Out\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\ndefine Fade In\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [tofront_text v]\ngo to [front v] layer\n\nwhen flag clicked\ngo to x: (-12) y: (44)\nset size to (75) %\nhide\nwait until <(game_level) = [1]>\nswitch costume to (intro1 v)\nFade In\nwait until <(game_level) = [2]>\nFade Out\nswitch costume to (intro2 v)\nFade In\nwait until <(game_level) = [3]>\nFade Out\nswitch costume to (intro3 v)\nFade In\nwait until <(game_level) = [4]>\nFade Out\n\n@Sign\n\nwhen I receive [tofront_sign v]\ngo to [front v] layer\n\nwhen I receive [gamestart v]\nstart sound [Gasp v]\nset y to (200)\nshow\nset [velocity v] to [0]\nrepeat (17)\n    change [velocity v] by (-1)\n    change y by (velocity)\nend\nset [velocity v] to ((velocity) * (-0.25))\nrepeat (8)\n    change [velocity v] by (-1)\n    change y by (velocity)\nend\nwait (3) seconds\nglide (5) secs to x: (54) y: (158)\nhide\n\nwhen flag clicked\nhide\ngo to x: (54) y: (17)\n\n@Spider\n\nwhen flag clicked\nforever\n    switch costume to (normal v)\n    set x to (pick random (-240) to (240))\n    show\n    set y to (175)\n    set [velocity v] to [-10]\n    set [angry v] to [0]\n    repeat until <(velocity) > [-1]>\n        set [velocity v] to ((velocity) * (pick random (0.9) to (0.95)))\n        change y by (velocity)\n    end\n    set [endtime v] to ((timer) + (pick random (3) to (5)))\n    repeat until <<(timer) > (endTime)> or <(angry) = [1]>>\n        if <touching (player v)?> then\n            change [statistics_spidersscared v] by (1)\n            set [angry v] to [1]\n            switch costume to (angry v)\n        end\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            switch costume to (angry v)\n            wait (0.1) seconds\n            switch costume to (normal v)\n        end\n    end\n    set [velocity v] to [0]\n    repeat until <(velocity) > [11]>\n        change [velocity v] by (0.5)\n        change y by (velocity)\n    end\n    hide\n    wait (pick random (10) to (25)) seconds\nend\n\nwhen I receive [tofront_spider v]\ngo to [front v] layer\n\nwhen I receive [gameend v]\nrepeat (50)\n    create clone of (_myself_ v)\n    wait (pick random (0.05) to (0.1)) seconds\nend\n\nwhen I start as a clone\ngo to x: (0) y: (180)\nwait (pick random (0.1) to (3)) seconds\nswitch costume to (normal v)\nset x to (pick random (-240) to (240))\nshow\nset y to (175)\nset [velocity v] to [-10]\nset [angry v] to [0]\nrepeat until <(velocity) > [-1]>\n    set [velocity v] to ((velocity) * (pick random (0.9) to (0.95)))\n    change y by (velocity)\nend\nset [endtime v] to ((timer) + (pick random (3) to (5)))\nrepeat until <<(timer) > (endTime)> or <(angry) = [1]>>\n    if <touching (player v)?> then\n        change [statistics_spidersscared v] by (1)\n        set [angry v] to [1]\n        switch costume to (angry v)\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        switch costume to (angry v)\n        wait (0.1) seconds\n        switch costume to (normal v)\n    end\nend\nset [velocity v] to [0]\nrepeat until <(velocity) > [11]>\n    change [velocity v] by (0.5)\n    change y by (velocity)\nend\nhide\ndelete this clone\n\n@LevelItems\n\nwhen flag clicked\nhide\n\n@PumpkinSpawner\n\nwhen I receive [drawlevel v]\nif <(cloneType) = [MAIN]> then\n    if <(game_level) = [1]> then\n        New Pumpkin at x: (-93) y: (8) dir: (90)\n    end\n    if <(game_level) = [4]> then\n        New Pumpkin at x: (-98) y: (-72) dir: (90)\n        New Pumpkin at x: (-81) y: (-75) dir: (110)\n    end\n    if <(game_level) = [5]> then\n        New Pumpkin at x: (-58) y: (-33) dir: (82)\n        New Pumpkin at x: (113) y: (58) dir: (93)\n    end\n    if <(game_level) = [6]> then\n        New Pumpkin at x: (-22) y: (-160) dir: (93)\n    end\n    if <(game_level) = [9]> then\n        New Pumpkin at x: (-65) y: (-37) dir: (93)\n        New Pumpkin at x: (-43) y: (-37) dir: (76)\n        New Pumpkin at x: (-8) y: (-35) dir: (76)\n        New Pumpkin at x: (16) y: (-32) dir: (93)\n        New Pumpkin at x: (103) y: (5) dir: (93)\n        New Pumpkin at x: (121) y: (5) dir: (90)\n        New Pumpkin at x: (189) y: (20) dir: (76)\n    end\n    if <(game_level) = [10]> then\n        New Pumpkin at x: (-6) y: (-174) dir: (76)\n    end\n    if <(game_level) = [11]> then\n        New Pumpkin at x: (-97) y: (12) dir: (90)\n        New Pumpkin at x: (12) y: (51) dir: (90)\n        New Pumpkin at x: (152) y: (66) dir: (76)\n    end\n    if <(game_level) = [12]> then\n        New Pumpkin at x: (-154) y: (-162) dir: (81)\n    end\n    if <(game_level) = [13]> then\n        New Pumpkin at x: (-112) y: (85) dir: (65)\n    end\n    if <(game_level) = [14]> then\n        New Pumpkin at x: (-92) y: (145) dir: (65)\n    end\n    if <(game_level) = [16]> then\n        New Pumpkin at x: (-147) y: (-172) dir: (65)\n    end\n    if <(game_level) = [19]> then\n        New Pumpkin at x: (-30) y: (30) dir: (94)\n        New Pumpkin at x: (120) y: (-83) dir: (84)\n    end\n    if <(game_level) = [21]> then\n        New Pumpkin at x: (8) y: (-60) dir: (64)\n        New Pumpkin at x: (-159) y: (83) dir: (98)\n    end\n    if <(game_level) = [23]> then\n        New Pumpkin at x: (191) y: (113) dir: (97)\n    end\n    if <(game_level) = [24]> then\n        New Pumpkin at x: (-21) y: (95) dir: (90)\n        New Pumpkin at x: (-145) y: (70) dir: (75)\n        New Pumpkin at x: (160) y: (47) dir: (94)\n    end\nelse\n    delete this clone\nend\n\nwhen I start as a clone\nswitch costume to (normal v)\nshow\nwait until <touching (player v)?>\nstart sound [SmashPumpkin v]\nnext costume\nwait (0.05) seconds\nnext costume\nwait (0.05) seconds\nnext costume\nchange [pumpkincounter_count v] by (1)\nset [pumpkincounter_posx v] to ((x position) + (5))\nset [pumpkincounter_posy v] to ((y position) + (10))\nbroadcast (PumpkinSmash v)\n\ndefine None\npoint in direction (dir)\ngo to x: (x) y: (y)\nset [clonetype v] to [CLONE]\ncreate clone of (_myself_ v)\nset [clonetype v] to [MAIN]\n\nwhen flag clicked\nhide\nset [clonetype v] to [MAIN]\n\nhide\n\nshow\n\n@EndScreen\n\nwhen flag clicked\nhide\ngo to x: (0) y: (20)\n\nwhen I receive [gameend v]\nshow\n\n@ThunderSound\n\nwhen flag clicked\nforever\n    wait (pick random (8) to (23)) seconds\n    set volume to (pick random (10) to (60)) %\n    if <(pick random (1) to (2)) = [2]> then\n        start sound [Lightning v]\n    else\n        start sound [Thunder v]\n    end\nend\n\n@PumpkinCounter3\n\nwhen flag clicked\nset [pumpkincounter_posx v] to [20]\nset [pumpkincounter_posy v] to [40]\nset [pumpkincounter_count v] to [0]\nhide\n\nwhen I receive [pumpkinsmash v]\ngo to x: (pumpkinCounter_posX) y: (pumpkinCounter_posY)\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [gamestart v]\ngo to x: (pumpkinCounter_posX) y: (pumpkinCounter_posY)\n\n@PumpkinCounter2\n\nwhen I receive [gamestart v]\ngo to x: ((pumpkinCounter_posX) - (30)) y: (pumpkinCounter_posY)\n\nwhen I receive [pumpkinsmash v]\ngo to x: ((pumpkinCounter_posX) - (30)) y: (pumpkinCounter_posY)\nif <(pumpkinCounter_count) > [9]> then\n    switch costume to (letter (1) of (pumpkinCounter_count))\nelse\n    switch costume to (0 v)\nend\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nswitch costume to (1 v)\nhide\n\n@PumpkinCounter4\n\nwhen I receive [gamestart v]\ngo to x: ((pumpkinCounter_posX) - (15)) y: (pumpkinCounter_posY)\n\nwhen I receive [pumpkinsmash v]\ngo to x: ((pumpkinCounter_posX) - (15)) y: (pumpkinCounter_posY)\nif <(pumpkinCounter_count) > [9]> then\n    switch costume to (letter (2) of (pumpkinCounter_count))\nelse\n    switch costume to (letter (1) of (pumpkinCounter_count))\nend\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nhide\nswitch costume to (1 v)\n\n@EndCharacterPrinter\n\nwhen flag clicked\nhide\nswitch costume to (0 v)\n\nwhen I receive [gameend v]\ngo to x: (-33) y: (77)\nPrint (statistics_time)\ngo to x: (-42) y: (52)\nPrint (statistics_deaths)\ngo to x: (60) y: (29)\nPrint (join (statistics_pumpkinsSmashed) [/29])\ngo to x: (11) y: (9)\nPrint (statistics_spidersScared)\n\ndefine Print []\nset [index v] to [0]\nrepeat (length of (text))\n    change [index v] by (1)\n    set [char v] to (letter (index) of (text))\n    switch costume to (char)\n    stamp\n    change x by (12)\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nshow\ngo to [front v] layer\n\n