Square Quest - Platformer
@Stage\n\ndefine title part\nbroadcast (menu show v) and wait\nswitch backdrop to (background v) and wait\nrepeat (10)\n    change [ghost v] by (10)\n    broadcast (main tick v)\n    broadcast (menu tick v)\nend\nrepeat until <not <(screen) = [title]>>\n    broadcast (main tick v)\n    broadcast (menu tick v)\nend\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\n    broadcast (menu tick v)\nend\nset [clonesdelete v] to [1]\nbroadcast (menu hide v)\nswitch backdrop to (backdrop1 v)\n\ndefine options part\nbroadcast (options show v)\nshow variable [volume v]\nrepeat (10)\n    change [ghost v] by (10)\n    broadcast (main tick v)\n    broadcast (options tick v)\nend\nbroadcast (light hide v)\nrepeat until <not <(screen) = [options]>>\n    set volume to (Volume) %\n    broadcast (main tick v)\n    broadcast (options tick v)\nend\nbroadcast (light show v)\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\n    broadcast (options tick v)\nend\nhide variable [volume v]\nbroadcast (options hide v)\n\ndefine levels part\nswitch backdrop to (backdrop3 v)\nbroadcast (level select show v) and wait\nrepeat (10)\n    change [ghost v] by (10)\n    broadcast (main tick v)\n    broadcast (level select tick v)\nend\nrepeat until <not <(screen) = [levels]>>\n    broadcast (main tick v)\n    broadcast (level select tick v)\nend\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\n    broadcast (level select tick v)\nend\nset [clonesdelete v] to [1]\nbroadcast (level select hide v)\nswitch backdrop to (backdrop1 v)\n\ndefine play part\nbroadcast (-load level and character v) and wait\nrepeat (10)\n    change [ghost v] by (10)\n    broadcast (main tick v)\nend\nset [-pause v] to [0]\nrepeat until <not <(screen) = [play]>>\n    broadcast (main tick v)\n    broadcast (-play tick v)\n    if <(-pause) = [1]> then\n        broadcast (show pause v)\n        set [-pause v] to [1]\n        repeat until <(-pause) = [0]>\n            broadcast (pause tick v)\n        end\n        broadcast (hide pause v)\n    end\nend\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\nend\nbroadcast (-hide level v)\n\nwhen I receive [main tick v]\nset [:fps v] to (round ((1) / (timer)))\nchange [:time played v] by (timer)\nreset timer\n\ndefine variables\nset [:coins v] to [0]\nset [ticks v] to [0]\nset [clonesdelete v] to [0]\nset [screen v] to [start]\nset [ghost v] to [100]\nset [volume v] to [100]\nset [:time played v] to [0]\nset [level select start # v] to [1]\nset [:complete levels v] to [0]\nset [-pause v] to [0]\nset [current character costume v] to [1]\nhide variable [volume v]\nhide variable [level reader v]\nset volume to (Volume) %\n\ndefine reset completed levels\ndelete (all) of [levels - completed v]\nrepeat (60)\n    add [0] to [levels - completed v]\nend\n\ndefine shop part\nbroadcast (shop show v) and wait\nrepeat (10)\n    change [ghost v] by (10)\n    broadcast (main tick v)\n    broadcast (shop tick v)\nend\nrepeat until <not <(screen) = [shop]>>\n    broadcast (main tick v)\n    broadcast (shop tick v)\nend\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\n    broadcast (shop tick v)\nend\nbroadcast (shop hide v)\n\nwhen flag clicked\nerase all\nvariables\nreset completed levels\nreset costumes owned\nswitch backdrop to (backdrop2 v)\nbroadcast (menu hide v)\nbroadcast (main tick v)\nwait (1) seconds\nrepeat (10)\n    change [ghost v] by (-10)\n    broadcast (main tick v)\nend\nset [screen v] to [title]\nswitch backdrop to (backdrop1 v)\nforever\n    wait until <(screen) = [title]>\n    title part\n    if <(screen) = [levels]> then\n        repeat until <(screen) = [title]>\n            levels part\n            if <(screen) = [play]> then\n                play part\n            end\n            if <(screen) = [shop]> then\n                shop part\n            end\n        end\n    else\n        options part\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [18  Pedal wo fume - Yowamushi Pedal Grande Road.mp3 v] until done\nend\n\ndefine reset costumes owned\ndelete (all) of [shop - costumes owned v]\nadd [1] to [shop - costumes owned v]\nrepeat (9)\n    add [0] to [shop - costumes owned v]\nend\n\n@Level Loader\n\ndefine load level code []\ndelete (all) of [level data c v]\ndelete (all) of [level data k/l id v]\nset [c v] to [1]\nrepeat (192)\n    if <(letter ((c) + (1)) of (code)) = [,]> then\n        add (letter (c) of (code)) to [level data c v]\n        change [c v] by (2)\n    else\n        if <(letter ((c) + (2)) of (code)) = [,]> then\n            add (join (letter (c) of (code)) (letter ((c) + (1)) of (code))) to [level data c v]\n            change [c v] by (3)\n        else\n            if <(letter ((c) + (3)) of (code)) = [,]> then\n                add (join (join (letter (c) of (code)) (letter ((c) + (1)) of (code))) (letter ((c) + (2)) of (code))) to [level data c v]\n                change [c v] by (4)\n            end\n        end\n    end\nend\nrepeat (192)\n    if <(letter ((c) + (1)) of (code)) = [,]> then\n        add (letter (c) of (code)) to [level data k/l id v]\n        change [c v] by (2)\n    else\n        if <(letter ((c) + (2)) of (code)) = [,]> then\n            add (join (letter (c) of (code)) (letter ((c) + (1)) of (code))) to [level data k/l id v]\n            change [c v] by (3)\n        else\n            if <(letter ((c) + (3)) of (code)) = [,]> then\n                add (join (join (letter (c) of (code)) (letter ((c) + (1)) of (code))) (letter ((c) + (2)) of (code))) to [level data k/l id v]\n                change [c v] by (4)\n            end\n        end\n    end\nend\nload level\n\nwhen I start as a clone\nshow\nwait until <(clonesdelete) = [1]>\ndelete this clone\n\nwhen flag clicked\nset size to (101) %\n\nwhen I receive [-load level and character v]\nset volume to (Volume) %\nset [clonesdelete v] to [0]\nload level code (item (-current level) of [levels - codes v])\nbroadcast (-show character v) and wait\n\nwhen I receive [-play tick v]\nif <(distance to [player v]) < [50]> then\n    if <(costume [number v]) = [14]> then\n        if <touching (player v)?> then\n            broadcast (-play spring v)\n        end\n    else\n        if <(costume [number v]) = [8]> then\n            if <touching (player v)?> then\n                if <not <(item (-current level) of [levels - completed v]) = [1]>> then\n                    change [:complete levels v] by (1)\n                end\n                replace item (-current level) of [levels - completed v] with [1]\n                set [screen v] to [levels]\n            end\n        else\n            if <(costume [number v]) = [9]> then\n                if <touching (player v)?> then\n                    set [key id remove v] to (key/lock id)\n                    broadcast (remove lock v)\n                    hide\n                end\n            else\n                if <(costume [number v]) = [16]> then\n                    if <touching (player v)?> then\n                        hide\n                        change [:coins v] by (1)\n                        start sound [Coin v]\n                    end\n                else\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [-hide level v]\nset [clonesdelete v] to [1]\n\nwhen I receive [remove lock v]\nif <(costume [number v]) = [10]> then\n    if <(key/lock id) = (key id remove)> then\n        hide\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [death v]\nif <<not <(c id) = [-10]>> and <not <(costume [number v]) = [16]>>> then\n    show\nend\n\ndefine load level\nhide\nset [c v] to [1]\ngo to x: (-225) y: (165)\nset [c id v] to [1]\nrepeat (12)\n    repeat (16)\n        switch costume to (item (c) of [level data c v])\n        set [key/lock id v] to (item (c) of [level data k/l id v])\n        if <not <<(item (c) of [level data c v]) = [0]> or <(item (c) of [level data c v]) = []>>> then\n            create clone of (_myself_ v)\n            change [c id v] by (1)\n        end\n        change x by (30)\n        change [c v] by (1)\n    end\n    set x to (-225)\n    change y by (-30)\nend\nset [c id v] to [-10]\n\n@Title\n\nwhen I receive [menu tick v]\ngo to x: (0) y: ((110) + (([sin v] of ((ticks) * (4)) ) * (30)))\nchange [ticks v] by (1)\n\nwhen I receive [menu show v]\nset size to (95) %\nswitch costume to (cooltext126331138032280 v)\nshow\n\nwhen I receive [menu hide v]\nhide\n\nwhen I receive [options show v]\nswitch costume to (cooltext127589092639506 v)\ngo to x: (0) y: (120)\nset size to (70) %\nshow\n\nwhen I receive [options hide v]\nhide\n\nwhen I receive [level select show v]\nswitch costume to (cooltext127589145727172 v)\ngo to x: (0) y: (135)\nset size to (60) %\nshow\n\nwhen I receive [level select hide v]\nhide\n\n@Play\n\nwhen I receive [menu tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [menu hide v]\nhide\n\nwhen I receive [menu show v]\nshow\n\nwhen this sprite clicked\nset [screen v] to [levels]\n\n@Light\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen I receive [main tick v]\nset [ghost v] effect to (ghost)\ngo to [front v] layer\n\nwhen I receive [light hide v]\nhide\n\nwhen I receive [light show v]\nshow\n\n@Options\n\nwhen I receive [menu tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen flag clicked\ngo to x: (0) y: (-75)\n\nwhen I receive [menu hide v]\nhide\n\nwhen I receive [menu show v]\nshow\n\nwhen this sprite clicked\nset [screen v] to [options]\n\n@Back\n\nwhen flag clicked\nhide\ngo to x: (-180) y: (-150)\n\nwhen I receive [options show v]\nshow\n\nwhen I receive [options tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [options hide v]\nhide\n\nwhen this sprite clicked\nif <(screen) = [shop]> then\n    set [screen v] to [levels]\nelse\n    set [screen v] to [title]\nend\n\nwhen I receive [level select show v]\nshow\n\nwhen I receive [level select tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [level select hide v]\nhide\n\nwhen I receive [shop show v]\nshow\n\nwhen I receive [shop hide v]\nhide\n\nwhen I receive [shop tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\n@Text Engine\n\ndefine None\nif <(mid/start) = [mid]> then\n    go to x: ((x) - ((((length of (text)) - (1)) * (30)) * (size))) y: (y)\nelse\n    go to x: (x) y: (y)\nend\nset [brightness v] effect to (brightness effect)\nset size to ((size) * (100)) %\nset [c v] to [1]\nrepeat (length of (text))\n    switch costume to (  v)\n    switch costume to (letter (c) of (text))\n    stamp\n    move ((60) * (size)) steps\n    change [c v] by (1)\nend\n\ndefine None\nset [c2 v] to (level)\nset [level#print x v] to [-160]\nset [level#print y v] to [60]\nrepeat (3)\n    repeat (5)\n        print (c2) at (level#print x) (level#print y) size (0.2) BE (0) enlarged around [mid]\n        change [level#print x v] by (80)\n        change [c2 v] by (1)\n    end\n    set [level#print x v] to [-160]\n    change [level#print y v] by (-50)\nend\n\nwhen I receive [level select # show v]\nnumber levels starting at (Level Select start #)\n\nwhen I receive [level select show v]\nprint (join (join [YOU HAVE ] (:coins)) [ COINS!]) at (-230) (-120) size (0.15) BE (0) enlarged around [start]\nprint (join (join [YOU HAVE  COMPLETED ] (:complete levels)) [ LEVELS!]) at (-35) (-120) size (0.15) BE (0) enlarged around [start]\n\nwhen I receive [update shop text v]\nerase all\nprint (join [YOUR COINS - ] (:coins)) at (-220) (-90) size (0.25) BE (0) enlarged around [start]\nprint (join [PRICE - ] (item (shop character show #) of [shop - prices v])) at (-220) (-113) size (0.25) BE (0) enlarged around [start]\n\n@Level Select\n\ndefine create level select buttons\nhide\nset [l.select id v] to [1]\ngo to x: (-160) y: (60)\nrepeat (3)\n    repeat (5)\n        create clone of (_myself_ v)\n        change x by (80)\n        change [l.select id v] by (1)\n    end\n    change y by (-50)\n    set x to (-160)\nend\n\nwhen I start as a clone\nif <(item ((Level Select start #) + ((L.Select ID) - (1))) of [levels - completed v]) = [0]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume3 v)\nend\nshow\nset [ghost v] effect to (0)\nstamp\nset [ghost v] effect to (99)\nwait until <(L.Select Clone delete) = [1]>\ndelete this clone\n\nwhen I receive [level select show v]\nshow variable [level reader v]\nbroadcast (refresh level buttons v)\n\nwhen I receive [refresh level buttons v]\nset [l.select clone delete v] to [0]\ncreate level select buttons\nbroadcast (level select # show v)\n\nwhen I receive [level button touch check v]\nif <(distance to [mouse-pointer v]) < [60]> then\n    if <touching (mouse-pointer v)?> then\n        set [level select level button touching v] to (L.Select ID)\n        switch costume to (costume2 v)\n        set [ghost v] effect to (70)\n        if <(item ((Level Select Level Button Touching) + ((Level Select start #) - (1))) of [levels - completed v]) = [0]> then\n            set [level reader v] to (join (join (join (join ((Level Select Level Button Touching) + ((Level Select start #) - (1))) [ - | ]) (item ((Level Select Level Button Touching) + ((Level Select start #) - (1))) of [levels - name v])) [ | by ]) (item ((Level Select Level Button Touching) + ((Level Select start #) - (1))) of [levels - creators v]))\n        else\n            set [level reader v] to (join [\(COMPLETED\) ] (join (join (join (join ((Level Select Level Button Touching) + ((Level Select start #) - (1))) [ - | ]) (item ((Level Select Level Button Touching) + ((Level Select start #) - (1))) of [levels - name v])) [ | by ]) (item ((Level Select Level Button Touching) + ((Level Select start #) - (1))) of [levels - creators v])))\n        end\n    else\n        set [ghost v] effect to (99)\n        switch costume to (costume1 v)\n    end\nelse\n    set [ghost v] effect to (99)\n    switch costume to (costume1 v)\nend\n\nwhen I receive [level select tick v]\nset [level select level button touching v] to [0]\nbroadcast (Level button touch check v)\nset [level reader v] to [Level Info :D]\n\nwhen this sprite clicked\nset [-current level v] to ((Level Select Level Button Touching) + ((Level Select start #) - (1)))\nset [screen v] to [play]\n\nwhen I receive [level select hide v]\nset [l.select clone delete v] to [1]\nhide variable [level reader v]\nerase all\n\n@Level Select Arrows\n\nwhen I receive [level select show v]\nset [arrows show v] to [1]\nset rotation style [left-right v]\ncreate clones\n\ndefine create clones\npoint in direction (90)\ngo to x: (-215) y: (10)\nset [arrow id v] to [1]\ncreate clone of (_myself_ v)\nturn right (180) degrees\ngo to x: (215) y: (10)\nset [arrow id v] to [2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nif <(Arrow ID) = [1]> then\n    if <(Level Select start #) = [1]> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nelse\n    if <(Level Select start #) = [46]> then\n        switch costume to (costume2 v)\n    else\n        if <(:complete levels) > ([floor v] of ((((Level Select start #) + (15)) * (0.666)) - (1)) )> then\n            switch costume to (costume1 v)\n        else\n            switch costume to (costume3 v)\n        end\n    end\nend\nwait until <(Arrows show) = [0]>\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    if <(Arrow ID) = [1]> then\n        change [level select start # v] by (-15)\n    else\n        change [level select start # v] by (15)\n    end\n    broadcast (level select reset # v)\nend\n\nwhen I receive [level select reset # v]\nbroadcast (level select hide v) and wait\nbroadcast (level select show v) and wait\n\nwhen I receive [level select tick v]\nif <(costume [number v]) = [3]> then\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (20)\n        if <(Level Select start #) = [1]> then\n            say (join (join [Complete ] (([floor v] of (((Level Select start #) + (15)) * (0.666)) ) - (:complete levels))) [ more levels to unlock more levels!])\n        else\n            say [Thanks for playing! This is the end of the game so far! In the notes and credits I'll put a link to a project  where you can make your own levels. If enough are posted in the forum I'll add them in! :D]\n        end\n    else\n        set [brightness v] effect to (0)\n        say []\n    end\nelse\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (20)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [level select hide v]\nset [arrows show v] to [0]\n\n@Player\n\nwhen flag clicked\nswitch costume to (still1 v)\ngo to x: (-225) y: (-75)\nhide\n\nwhen I receive [-play tick v]\nplatform script\n\ndefine platform script\nchange x by (Xvelo)\nchange y by (Yvelo)\nif <<touching color (#ed1c24)?> or <key (r v) pressed?>> then\n    set [xvelo v] to [0]\n    set [yvelo v] to [0]\n    switch costume to (still v)\n    if <touching color (#ed1c24)?> then\n        start sound [death.mp3 v]\n    end\n    broadcast (death v)\n    go to x: (-225) y: (-75)\nend\nif <touching color (#ff9400)?> then\n    set [yvelo v] to [0]\nend\nchange x by ((Xvelo) * (-1))\nchange y by ((Yvelo) * (-1))\nif <key (right arrow v) pressed?> then\n    change [xvelo v] by (1)\nend\nif <key (left arrow v) pressed?> then\n    change [xvelo v] by (-1)\nend\nset [xvelo v] to ((Xvelo) * (0.9))\nchange x by (Xvelo)\nif <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n    change y by (1)\n    if <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n        change y by (1)\n        if <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n            change y by (1)\n            if <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n                change y by (1)\n                if <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n                    change y by (1)\n                    if <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n                        change x by ((Xvelo) * (-1))\n                        change y by (-5)\n                        if <key (up arrow v) pressed?> then\n                            if <(Xvelo) > [0]> then\n                                set [xvelo v] to [-5]\n                            else\n                                set [xvelo v] to [5]\n                            end\n                            set [yvelo v] to [10]\n                        else\n                            set [xvelo v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [yvelo v] by (-1)\nchange y by (Yvelo)\nif <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n    change y by ((Yvelo) * (-1))\n    set [yvelo v] to [0]\nend\nchange y by (-1)\nif <<<<touching color (#b5e61d)?> or <touching color (#b97a57)?>> or <touching color (#7f7f7f)?>> or <touching color (#c3c3c3)?>> then\n    if <key (up arrow v) pressed?> then\n        set [yvelo v] to [15]\n    end\nend\nchange y by (1)\nif <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> then\n    if <<key (left arrow v) pressed?> and <key (right arrow v) pressed?>> then\n        switch costume to (join [Still] (current character costume))\n    else\n        if <key (left arrow v) pressed?> then\n            switch costume to (join [Left] (current character costume))\n        else\n            switch costume to (join [Right] (current character costume))\n        end\n    end\nelse\n    switch costume to (join [Still] (current character costume))\nend\n\nwhen I receive [-hide level v]\nhide\n\nwhen I receive [-play spring v]\nset [yvelo v] to [20]\n\nwhen I receive [-retry v]\nset [xvelo v] to [0]\nset [yvelo v] to [0]\nswitch costume to (join [Still] (current character costume))\nbroadcast (death v)\ngo to x: (-225) y: (-75)\n\nwhen I receive [-show character v]\nset volume to (Volume) %\nset [xvelo v] to [0]\nset [yvelo v] to [0]\ngo to x: (-225) y: (-75)\nshow\nswitch costume to (join [Still] (current character costume))\n\n@Logo\n\nwhen flag clicked\nset size to (10) %\ngo to x: (220) y: (-160)\nhide\n\nwhen I receive [menu show v]\nshow\n\nwhen I receive [menu hide v]\nhide\n\n@Pause Backing\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [show pause v]\nset [ghost v] effect to (10)\nshow\n\nwhen I receive [hide pause v]\nhide\n\n@Pause Continue\n\nwhen flag clicked\nhide\ngo to x: (0) y: (75)\nset size to (60) %\n\nwhen I receive [show pause v]\ngo to [front v] layer\nshow\n\nwhen I receive [hide pause v]\nhide\n\nwhen I receive [pause tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen this sprite clicked\nset [-pause v] to [0]\n\n@Pause Return\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-70)\nset size to (60) %\n\nwhen I receive [show pause v]\ngo to [front v] layer\nshow\n\nwhen I receive [hide pause v]\nhide\n\nwhen I receive [pause tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen this sprite clicked\nset [-pause v] to [0]\nset [screen v] to [levels]\n\n@Pause\n\nwhen flag clicked\ngo to x: (-230) y: (170)\nhide\n\nwhen I receive [-load level and character v]\nshow\n\nwhen I receive [-play tick v]\nif <key (p v) pressed?> then\n    set [-pause v] to [1]\nend\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [-hide level v]\nhide\n\nwhen this sprite clicked\nset [-pause v] to [1]\n\n@Pause Retry\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset size to (60) %\n\nwhen I receive [hide pause v]\nhide\n\nwhen I receive [pause tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen this sprite clicked\nset [-pause v] to [0]\nbroadcast (-retry v)\n\nwhen I receive [show pause v]\ngo to [front v] layer\nshow\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\n@Shop Button\n\nwhen flag clicked\nhide\ngo to x: (100) y: (-151)\nset size to (25) %\n\nwhen I receive [level select show v]\nshow\n\nwhen I receive [level select hide v]\nhide\n\nwhen I receive [level select tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen this sprite clicked\nset [screen v] to [shop]\n\n@Shop Character Show\n\nwhen flag clicked\ngo to x: (0) y: (30)\nset size to (700) %\nhide\nswitch costume to (still1 v)\n\nwhen I receive [shop show v]\nset [shop character show # v] to (current character costume)\nshow\nswitch costume to (join [Still] (shop character show #))\nset [ghost v] effect to (0)\nbroadcast (update shop text v)\n\nwhen I receive [shop hide v]\nerase all\nhide\n\nwhen I receive [shop update costume show v]\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nbroadcast (update shop text v)\nswitch costume to (join [Still] (shop character show #))\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\n@Shop Arrows\n\nwhen flag clicked\nset size to (75) %\nhide\n\nwhen I receive [shop show v]\nset [shop clone delete v] to [0]\ncreate shop arrows\n\ndefine create shop arrows\npoint in direction (90)\nset rotation style [left-right v]\nset [shop arrow id v] to [1]\ngo to x: (-170) y: (30)\ncreate clone of (_myself_ v)\nturn right (180) degrees\nchange [shop arrow id v] by (1)\ngo to x: (170) y: (30)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nwait until <(shop clone delete) = [1]>\ndelete this clone\n\nwhen I receive [shop hide v]\nset [shop clone delete v] to [1]\n\nwhen I receive [shop tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen this sprite clicked\nif <(shop arrow id) = [1]> then\n    if <(shop character show #) = [1]> then\n        set [shop character show # v] to [11]\n    else\n        change [shop character show # v] by (-1)\n    end\nelse\n    if <(shop character show #) = [11]> then\n        set [shop character show # v] to [1]\n    else\n        change [shop character show # v] by (1)\n    end\nend\nbroadcast (shop update costume show v)\n\n@Shop Equip Notif.\n\nwhen flag clicked\nset size to (45) %\ngo to x: (0) y: (-35)\nhide\n\nwhen I receive [shop show v]\nshow\n\nwhen I receive [shop hide v]\nhide\n\nwhen I receive [shop update costume show v]\nif <(current character costume) = (shop character show #)> then\n    show\nelse\n    hide\nend\n\n@Equip/ Purchase\n\nwhen flag clicked\nset size to (70) %\ngo to x: (60) y: (-150)\nhide\n\nwhen I receive [shop update costume show v]\nif <(current character costume) = (shop character show #)> then\n    hide\nelse\n    show\n    if <(item (shop character show #) of [shop - costumes owned v]) = [1]> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    if <(:coins) > ((item (shop character show #) of [shop - prices v]) - (1))> then\n        set [current character costume v] to (shop character show #)\n        replace item (shop character show #) of [shop - costumes owned v] with [1]\n        change [:coins v] by ((0) - (item (shop character show #) of [shop - prices v]))\n        broadcast (shop update costume show v)\n    end\nelse\n    set [current character costume v] to (shop character show #)\n    broadcast (shop update costume show v)\nend\n\nwhen I receive [shop tick v]\nif <touching (mouse-pointer v)?> then\n    set [brightness v] effect to (20)\nelse\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [shop hide v]\nhide\n\n