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3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3rrrre3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2a2a2a2a2a2a2a2a2a2a2a2a2a2b2b2b2b2b2b2b2b2b2b2b2b2b2b2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2", "P", "666666666666666666666666666666666666666666666666655555555555555555555555443322110666666666666666666666666666666666666666666666666655555555555555555555555443322110666666666666666666666666666666666666666666666665544332666666666666666666666665544666666666665566666666666554666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555443322110000666666666666666666666665544666666666666666666666665544666666666666666666666665544666666666665566666666666554666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555554433221100000000000666666666666666666666666666666666665544366666666666666666666666666666666666554433666666666666666666666665544666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555443322110000666666666666666666666666666666666666666666666666655555555555555555555555443322110666666666666666666666666666666666666666666666666655555555555555555555555443322110666666666666666666666666666666666666666666666665544332666666666666666666666665544666666666665566666666666554666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555443322110000666666666666666666666665544666666666666666666666665544666666666666666666666665544666666666665566666666666554666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555443322110000666666666666666666666665544666666666666666666666665544666666666666666666666665544666666666666666666666665544666666666666666666666665544666666666666666666666666666666666666666666666665544332666666666665566666666666554666666666666666666666666666666666666666666666665544332", "n", 1], ["c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1rrrrc2c2c2c2c2c2c2c2c2c2c2rrrrrrrrrrrrrrrrc1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1rrrrc2c2c2c2c2c2c2c2c2c2c2rrrrrrrrrrrrrrrrc1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1rrrrc2c2c2c2c2c2c2c2c2c2c2rrrrrrrrrrrrrrrrc1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1rrrrc2c2c2c2c2c2c2c2c2c2c2rrrrrrrrrrrrrrrra#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrra#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrra#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrra#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrrc1c1c1c1c1c1c1c1c1c1c1c1c1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0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrra#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0a#0rrrra#1a#1a#1a#1a#1a#1a#1a#1a#1a#1a#1rrrrrrrrrrrrrrrrb0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0rrrrb1b1b1b1b1b1b1b1b1b1b1rrrrrrrrrrrrrrrrb0b0b0b0b0b0b0b0b0b0b0rrb1b1b1b1b1b1b1b1b1b1b1rrrb0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0rrrr", "T", "777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777777777777777770000777777777770000000000000000777777777770077777777777000777777777777777777777770000", "n", 1], ["c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c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c3c3c3c3c3c3c3c3c3rrrrrrrrrrrrrrrrrrd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2rrrrrrrrrrrrrrrrrrd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2rrrrrrrrrrrrrrrrrrd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2rrrrrrrrrrrrrrrrrrd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2", "P", "444444444444444444444444444444444444444444444444443333444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444444444444444444444444444443333444444444444444444444444433333222111000044444444444433444444444444444444444444444444444444444444444444443333444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444443333444444444444444444444444433444444444444444444444444433444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444444444444444444444444444444333322444444444444444444444444444444444444444444444444444444444444444444444444444333322444444444444444444444444444444444444444444444444443333444444444444444444444444433333222111000044444444444433444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444443333222444444444444444444444444433444444444444444444444444433444444444444444444444444433444444444444333322211100000444444444444444444444444444444444444444444444444443333444444444444444444444444444444444444444444444444443333444444444444444444444444433333222111000000000000000000444444444444444444444444433333222111000000000000000000444444444444444444444444433333222111000000000000000000444444444444444444444444433333222111000000000000000000444444444444444444444444444444444444444444444444443333", "n", 1], ["c3c2c2c2c2c2c2c2c2c2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2c2c2c2c2c2c2c2c2c2c2c3c3c2c2a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2c2a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2c2a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2c2a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4", "N", "544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000022211111100000222111111000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000022211111100000544322100000000000000000000000000000000000000000000000222111111000000000000000000544322100000000000000000000544322100000000000000000000000000000000000000000000000222111111000022211111100000222111111000022211111100000", "n", 1]]
music_level0=[["rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrra2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#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2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2rr", "P", "544332211000000000000000000000000000000000000000000000000000000000000000666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666666666666666666666666666666655555555555555554433221666666666666666666666666666666666666666666666666655555555555555554433221666666666666666666666666666666666666666666554433666666666666666666666666666666666666666666666666655555555555555554433221666666666655666666666655666666666666666666666666666666666666666666666666655555555555555554433221666666666655666666666655544332211000000000000000000000000000000000000000000000000000000000000000666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554544332211000000000000000000000000000000000000000000000000000000000000000666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666666666666666666666666666666655555555555555554433221666666666666666666666666666666666666666666666666655555555555555554433221666666666666666666666666666666666666666666554433544332211000000000000000000000000000000000000000000000000000000000000000666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666554666666666666666666666666666666666666666666666666655555443322666666666655666666666655666666666655666666666666666666666666666666666666666666666666655555555555555555555555555555555555554433221100", "n", 1], ["a0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a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1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrra0a0a0a0a0a0a0a0a0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrra1a1a1a1a1a1a1a1a1rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrrd1d1d1d1d1d1d1d1d1rrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1rrrd2d2d2d2d2d2d2d2d2rrre0e0e0e0e0e0e0e0e0rrrrrrrrrrrrrrre1e1e1e1e1e1e1e1e1rrre1e1e1e1e1e1e1e1e1rrre1e1e1e1e1e1e1e1e1rrre1e1e1e1e1e1e1e1e1rrre1e1e1e1e1e1e1e1e1rrrrrrrrrrrrrrr", "T", "777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000000000000000777777777000777777777000777777777000777777777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#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3", "N", "222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000555444333220222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222111111000222111111000555444333222111000000000222111111000222111111000222111111000000000000000222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444333221111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111166555444333221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111166555444333221111111111111111111111665554443332211111111111111111111166555444333221111111111111111111111665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000665554443332211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000066555444333221111111111111111111111665554443332211111111111111111111166555444333221111111111111111111111665554443332211111111111111111111166555444333221111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "n", 1], ["f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrf0f0f0f0f0f0f0f0f0f0f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e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0rrrrra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrra0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0rrrrra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1ra0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0rrr", "T", "777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777777777777777777777777777777777777777777777777777700000777777777777777707777777777777777000000000000000000000000000000000000000000000000000000000000000000000077777777777777770777777777777777700000000000000000000000000000000000000000000000000000000000000000000000777777777777777707777777777777777077777777777777777777777777777777000", "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvnvnvnvnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvnvnvnvnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvnvnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnvnvnvnvnvnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn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#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2", "S", "444433332222111111111111111111111144443333222211111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000444433332222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111444433332222111111111111111111111144443333222211111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111444433332222111111111111111111111111111111111111111111111111111111111", "n", 1], ["c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2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4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2c2c2c2c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2c2c2c2c2a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3c2", "N", "544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000054432210000000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000022211111100000000000000000000000000544322100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054432210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222111111000000002221111110000000054432210000000000000000000000000000", "n", 1]]
music_boss=[["rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2f2f2f2f2f2f2f2f2f2f2f2g2g2g2g2g2g2g2g2g2g2a2a2a2a2a2a2a2a2a2a2a2c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3rd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e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c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3re2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2rrrre3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3d3d3d3d3d3d3d3d3d3d3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3c#3rrrrrrrrrrr", "S", "544332211000000000000000000000000000000000000000000000000000000666666666666666666554666666666666666666554666666666666666666554666666666666666666554666666666666666666554666666666666666666666666666666666666666666666554433266666666655666666666566666666655666666666666666666666666666666666666666666666666655555555555555555555555555443322110666666666666666666554666666666666666666554666666666666666666554666666666666666666666666666666666666554433666666666566666666655666666666666666666666666666666666666554433544332211000000000000000000000000000000000000000000000000000000666666666666666666554666666666666666666554666666666666666666554666666666666666666554666666666666666666554544332211000000000000000000000000000000000000000000000000000000666666666666666666554666666666666666666554666666666666666666554666666666666666666554666666666666666666554666666666666666666666666666666666666666666666554433266666666655666666666566666666655666666666666666666666666666666666666666666666666655555555555555555555555555443322110666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555443322110000666666666666666666554666666666566666666666666666666666666655443666666666666666666666666666666666666666666666666655555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555554433221100000000000", "n", 1], ["e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1re1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1re1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1re1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1rre1e1e1e1e1e1e1e1e1re1e1e1e1e1e1e1e1e1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrg1g1g1g1g1g1g1g1g1g1g1g1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1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1rrf1f1f1f1f1f1f1f1f1rf1f1f1f1f1f1f1f1f1rrg1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1rg1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1rg1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1rg1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1g1rrg1g1g1g1g1g1g1g1g1rg1g1g1g1g1g1g1g1g1rra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rra1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1rra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rra1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1rra1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1rra1a1a1a1a1a1a1a1a1ra1a1a1a1a1a1a1a1a1rra0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0rra0a0a0a0a0a0a0a0a0ra0a0a0a0a0a0a0a0a0rr", "T", "777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700777777777777777777700777777777077777777700", "n", 1], ["rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrb2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrc2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2g2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1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2g#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2f#2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2c#2", "S", "333222111000000000000000000000000000000000333222111000000000000444444444444444444433444444444444444444444444444444444444444333444444444444444444433444444444444444444433333222111000000000000000000000000000000000444444444444444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444433444444444444444444444444444444444444444444444444433333322211100444444444444444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444433333222111000000000000444444444444444444433444444444444444444433444444444444444444433444444444444444444433333222111000000000000000000000000000000000000000000000000000000444444444444444444433444444444444444444444444444444444444444333444444444444444444433444444444444444444433333222111000000000000000000000000000000000000000000033322211100000000000000000000000444444444444444444444444444444444444444444444444444444444444444444444444444444333322444444444444444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444433444444444444444444433444444444344444444444444444444444444444333444444444444444444444444444444444444444333444444444444444444433444444444444444444433444444444444444444433444444444444444444433444444444444444444444444444444444444444333", "n", 1], ["c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#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#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4c3c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c3c3a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#4a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3a#3", "N", "544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333055544433300555444333222111000000544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333222111000000222111111022211111100544322100000000000000222111111022211111100555444333055544433300555444333222111000000", "n", 1]]

texte_intro=["Il y a bien longtemps, ou", "peut-etre hier, difficile a", "dire, dans une contree", "lointaine et vaguement oubliee.", "Le monde etait en paix. Les", "rivieres coulaient", "tranquillement, les oiseaux", "chantaient, et les gens", "vivaient des vies simples,", "ponctuees de petits tracas sans", "importance, comme les impots ou", "les voisins bruyants. Jusqu'au", "jour ou l'oeil Volant apparut.", "Nul ne sait d'ou il est venu.", "Certains racontent qu'il est ne", "d'une ancienne magie oubliee.", "D'autres pensent qu'il s'agit", "d'un simple accident cosmique,", "un oeil detache d'un geant", "interdimensionnel qui aurait", "malencontreusement cligne trop", "fort. Mais peu importent les", "theories, la realite est bien", "plus simple : il est la et il", "veut tout transformer en yeux.", "Son nom resonne a travers les", "ruines et les campagnes :", "Oeilor le Tyran. Avec son armee", "de creatures grotesques, de", "zombies approximativement", "coordonnes et d'arbres", "legerement hostiles, il avance", "inexorablement vers son", "objectif ultime : remodeler le", "monde pour quil ne soit qu'un", "gigantesque oeil, flottant dans", "l'espace, contemplant l'infini", "pour l'eternite. Face a une", "menace aussi absurde", "qu'effrayante, les plus grands", "heros du monde se sont", "rassembles pour… partir en", "vacances. Une retraite bien", "meritee apres des annees de", "quetes, de batailles et de", "discussions interminables avec", "des rois ennuyeux. Il ne", "restait donc plus personne pour", "sauver le monde. Personne, sauf", "toi. Tu n'es pas un guerrier.", "Tu n'as ni epee, ni arc, ni", "armure legendaire. Tu n'as meme", "pas de nom digne de ce titre.", "Mais le destin, dans sa grande", "ironie, a decide que ce serait", "toi qui porterais le poids de", "cette mission insensee. Pour", "t'aider, un guide t'a ete", "envoye. Pas un vieux sage, ni", "un puissant magicien, mais un", "simple oiseau. Un oiseau", "bruyant, impatient et", "franchement desagreable, dont", "l'unique role est de te crier", "des ordres en permanence. Sans", "autre choix que d'ecouter ce", "piaf agaçant et d'avancer sans", "poser trop de questions, tu te", "lances dans une aventure ou tu", "devras affronter l'impossible,", "sauter dans des precipices", "dangereux, recuperer des armes", "probablement rouillees, et", "defier des ennemis qui, eux,", "sont sûrement bien mieux", "prepares que toi. Mais peu", "importe. Le monde compte sur", "toi. Ou du moins, il compte sur", "quelqu'un, et il n'y avait", "personne d'autre sous la main.", "L'aventure commence."]
texte_outro=['FELICITATIONS, VALEUREUX JOUEUR', "! Tu as vaincu Oeilor, L'Oeil", 'Ensanglante de la Douleur', 'Infinie, et franchement, on ne', 'pensait pas que tu irais aussi', 'loin. Bravo ! Dans un dernier', "souffle dramatique, l'oeil a", 'tente de te faire exploser avec', 'des lazers impossibles a', 'esquiver, mais comme tout bon', 'boss de jeu video, il a', "respecte la regle d'or : il", 'devait perdre. Et maintenant ?', 'Le monde est-il sauve ?', 'Probablement pas. Le boss', 'reviendra-t-il dans une suite', 'foireuse ? Tres possible. As-tu', 'gaspille des minutes de ta vie', 'pour en arriver la ?', "Absolument. Mais ce n'est pas", 'grave, car voici le generique :', 'EQUIPE DEVELOPPEMENT : -', 'COLLARD Arthur – SALZENSTEIN', 'Valentin - .- Le code – Une', 'abomination faite de bugs et', "d'anomalies. - Les pixels,", 'Dessines avec amour, sueur et', 'probablement des larmes.', 'SPONSORS OFFICIELS : (Ah non,', "on n'en a pas. Un jour", 'peut-etre.) TESTEURS : - yani,', "qui a dit -c'est injouable-", 'mais a quand meme fini le jeu.', 'MOTS DE LA FIN : Si tu as aime,', "tant mieux. Si tu n'as pas", 'aime, desole, mais le', "remboursement n'est pas prevu", "(en meme temps c'est gratuit", 'donc benef ?). FIN ?']

transparent= [(4,1),(0,18),(0,19),(0,20)]            #[(4,1),(8,10),(9,10),(10,10),(7,10),(7,11),(0,1),(1,28),(4,28),(29,4),(30,4),(1,0),(5,0),(18,11),(19,11),(18,12),(19,12),(18,13),(19,13),(18,14),(19,14),(29,5),(31,4)]+[(i,14)for i in range(4,8)]+[(i,15)for i in range(4,8)]+[(6,16),(6,17),(6,18)]+[(21,15),(21,26),(21,17)]+[(11,16),(12,16),(11,17),(12,17),(18,22),(18,23)]
solid=[(8,28),(9,28),(8,29),(9,29),(8,30),(9,30),(9,26),(10,26),(9,27),(10,27)]
tile_save=[(31,0),(28,2),(27,2),(27,3),(27,4),(27,5),(28,5),(28,6),(28,7),(28,8),(28,9),(28,10),(28,11),(26,3),(26,2),(30,1),(31,2)]

outro_state=0

item_list=[]
particle_list=[]
block_list=[]
enemies_list=[]
other_entities=[]
camera_effect=[]


keys_dico={"up":"KEY_Z","left":"KEY_Q","down":"KEY_S","right":"KEY_D","jump":"KEY_SPACE","dash":"KEY_J","use":"KEY_H","bow":"KEY_K"}
#keys_dico={'up': 'KEY_UP', 'left': 'KEY_LEFT', 'down': 'KEY_DOWN', 'right': 'KEY_RIGHT', 'jump': 'KEY_Z', 'dash': 'KEY_SPACE', 'use': 'KEY_D'}
def detect_input():
    pyxel.flip()
    pyxel.flip()

    k=[i for i in pyxel.__dict__.keys() if (i.startswith("KEY_") or i.startswith("GAMEPAD1_") or "MOUSE_BUTTON_" in i)]
    while True:
        for i in k:
            if pyxel.btnp(getattr(pyxel, i)):
                return i
        pyxel.cls(12)
        pyxel.bltm(128,0,1,128,128,128,128,8)
        pyxel.text(128+6,62,"Press any keys",7)
        pyxel.flip()



class Player:
    def __init__(self):

        self.g=0.5
        self.effects={"resistance":0,"regeneration":0,"strength":0,"luck_potion":0,"gravity":0,"double_dash":0}


        self.max_pv=6
        self.pv=6

        self.vx,self.vy=0,0
        self.x,self.y=1*8,12*8

        self.jump_height=4.5
        self.friction=0.8
        self.facing=1
        self.speed=0.4
        self.speed_mid_air=0.4

        self.state=None
        self.go_to=None

        self.on_ground=False
        self.coyote_time=2
        self.air_time=0
        self.animation_ground=False
        self.wall_slide=False

        self.dash_speed=5
        self.horisontal_dash_speed=self.dash_speed*6/5
        self.vertical_dash_speed=self.dash_speed #*4/5
        self.dash_speed_diagonal=self.dash_speed/pyxel.sqrt(2)*1.2
        self.dashing=False
        self.dash_frame=0
        self.dash_lenght=5
        self.dash_direction=None
        self.dash_counter=0
        self.max_dash=0

        self.sword=None

        self.armor=None
        self.attacking=False
        self.attack_possible=True
        self.attack_frame=0
        self.attack_lenght=10
        self.dmg_multiplyer=1
        self.attack_deal_damage=True

        self.bow=None
        self.aiming=True
        self.aim_dir="straight"
        self.bow_frame=0
        self.bow_frame_lenght=10
        self.bow_cooldown_lenght=15
        self.bow_cooldown=0

        self.max_invincibility=30
        self.invincibility_frame=None
        self.resistance=1

        self.checkpoint=0

        self.bag={"score":0,"coin":0,"resistance":0,"regeneration":0,"strength":0,"luck_potion":0,"gravity":0,"double_dash":0}


    def teleport(self,x,y):
        self.x=x
        self.y=y
    def collision(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) not in transparent and (pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8)[0] <8 or pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) in solid )
    def interact_tm(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+1+offset_x)//8,(self.y+offset_y+1)//8),(int((self.x+1+offset_x)//8),int((self.y+offset_y+1)//8))



    def collision_sol(self,offset=0):
        return(self.collision(3,8+offset)or self.collision(5,8+offset))
    def collision_plafond(self,offset=-1):
        return(self.collision(3,0-offset)or  self.collision(5,0-offset))


    def collision_droite(self,offset=-1):
        return (self.collision(8+offset,2)or self.collision(8+offset,4)or self.collision(8+offset,6))
    def collision_gauche(self,offset=-1):
        return (self.collision(0-offset,2)or self.collision(0-offset,4)or self.collision(0-offset,6))

    def collision_corner(self,corner):
        if corner=="tr":
            return self.collision(7,1)
        if corner=="tl":
            return self.collision(1,1)
        if corner=="bl":
            return self.collision(1,8)
        if corner=="br":
            return self.collision(7,8)

    def direction_dash_speed(self,force_dir=None):

        directions = {(1,0,0,0):(0, -self.dash_speed,"t"), #t
                      (0,1,0,0):(-self.dash_speed, 0,"l"), #l
                      (0,0,1,0):(0, self.dash_speed,'b'), #b
                      (0,0,0,1):(self.dash_speed, 0,'r'), #r
                      (1,1,0,0):(-self.dash_speed_diagonal, -self.dash_speed_diagonal,'tl'), #tl
                      (0,1,1,0):(-self.dash_speed_diagonal, self.dash_speed_diagonal,'bl'), #bl
                      (0,0,1,1):(self.dash_speed_diagonal, self.dash_speed_diagonal,'br'), #br
                      (1,0,0,1):(self.dash_speed_diagonal, -self.dash_speed_diagonal,'tr'), #tr
        }
        if force_dir is None:
            input= (pyxel.btn(getattr(pyxel, keys_dico["up"])),pyxel.btn(getattr(pyxel, keys_dico["left"])),pyxel.btn(getattr(pyxel, keys_dico["down"])),pyxel.btn(getattr(pyxel, keys_dico["right"])))
        else:
            input=force_dir
        if input in directions.keys():
            return directions[input]
        return directions[(0,0,0,1)] if self.facing==1 else directions[(0,1,0,0)]
    def dash_start(self,force_dir=None):
        (xd,yd,d)=self.direction_dash_speed(force_dir)
        self.vx=xd
        self.vy=yd
        self.dashing=True
        self.dash_frame=0
        self.dash_direction=d
        self.dash_counter-=1
    def dash_manager(self):
        global particle_list
        if pyxel.btnp(getattr(pyxel, keys_dico["dash"])) and not self.dashing and self.dash_counter>=1:
            self.dash_start()



        if self.dashing:
            particle_list.append(Particle(self.x+pyxel.rndi(1,7),self.y+pyxel.rndi(1,7),self.vx,self.vy,[6,6,7,15,5][pyxel.rndi(0,4)],0.2,0.8,0,pyxel.rndi(30,60)))
            self.dash_frame+=1


        if self.dash_frame==self.dash_lenght:
            self.dashing=False
            self.dash_frame=None
            self.vx*=0.8
            self.vy*=0.6

    def mouvement_manager(self):
        if not self.dashing:
            if pyxel.btn(getattr(pyxel, keys_dico["right"])):
                self.vx+=self.speed if self.on_ground else self.speed_mid_air
                self.facing=1
                if self.collision_droite() and self.collision_corner("tr") and not self.collision_sol():
                    self.wall_slide=True
                else:
                    self.wall_slide=False

            elif pyxel.btn(getattr(pyxel, keys_dico["left"])):
                self.vx-=self.speed if self.on_ground else self.speed_mid_air
                self.facing=0
                if self.collision_gauche() and self.collision_corner("tl") and not self.collision_sol():
                    self.wall_slide=True
                else:
                    self.wall_slide=False
            else:
                if not (self.collision_droite() or self.collision_gauche()) or self.collision_sol():
                    self.wall_slide=False
            if pyxel.btn(getattr(pyxel, keys_dico["jump"])) and (self.on_ground or self.air_time<=self.coyote_time):
                self.vy=-self.jump_height
                self.on_ground=False
                self.air_time=self.coyote_time
                self.animation_ground=False



    def velocity_manager(self):
        if not self.dashing:

            self.vx= min(max(  self.vx*(self.friction if self.on_ground else self.friction)  ,-5),5)
            self.vy= min(max(  self.vy+(self.g if not self.on_ground else 0)   ,-5),5 if not self.wall_slide else 1.2)

    def collision_manager_general(self):
        precision=10
        for i in range(precision):



            if self.collision_droite() and self.collision_gauche() and self.collision_sol() and not self.collision_plafond():
                self.y=(self.y//8)*8
                self.vy=0



            if self.vx>0:
                if self.collision_droite():
                    if self.dashing:
                        self.dashing=False
                    self.vx=0


            if self.vx<0:
                if self.collision_gauche():
                    if self.dashing:
                        self.dashing=False
                    self.vx=0


            if self.collision_sol():

                self.on_ground=True
                self.dash_counter=self.max_dash+(1 if self.effects["double_dash"]>0 else 0)
                t=0
                while self.collision_sol():
                    self.y-=0.1
                    t+=1
                    if t>100:
                        break
                if self.dashing:
                    self.dashing=False
                self.vy=0
                self.air_time=0
                self.animation_ground=True
                self.wall_slide=False

            else:
                self.on_ground=False
                self.air_time+=1/precision


            if self.collision_plafond():

                    t=0
                    while self.collision_plafond():
                        self.y+=0.1
                        t+=1
                        if t>100:
                            break
                    if self.dashing:
                        self.dashing=False
                    self.vy*=-0.2
            self.apply_v(1/precision)

            if self.air_time>self.coyote_time:
                self.on_ground=False
                self.animation_ground=False


    def apply_v(self,amount=1):
        self.x+=self.vx*amount
        self.y+=self.vy*amount

    def invincibility_manager(self):
        if self.invincibility_frame is not None:
            if self.invincibility_frame<self.max_invincibility:
                self.invincibility_frame+=1
            else:
                self.invincibility_frame=None

    def attack_manager (self):
        if pyxel.btnp(getattr(pyxel, keys_dico["use"])) :
            if self.sword is not None and self.attack_possible:
                self.attacking=True
                self.attack_frame=0
                self.attack_deal_damage=True

        if self.attacking:
            self.attack_possible=False
            self.attack_frame+=1
        if  self.attack_frame==self.attack_lenght :
            self.attacking=False
            self.attack_frame=0
            self.attack_possible=True

    def bow_manager(self):
        if self.bow=="bow":
            if self.bow_cooldown!=0:
                self.bow_cooldown-=1
                if self.bow_cooldown==10:
                    self.aiming=False
            else:

                if  (pyxel.btn(getattr(pyxel, keys_dico["bow"])) or (self.bow_frame<self.bow_frame_lenght and self.bow_frame!=0)):
                    self.bow_frame+=1
                    self.aiming=True
                    if pyxel.btn(getattr(pyxel, keys_dico["up"])):
                        self.aim_dir="up"
                    elif pyxel.btn(getattr(pyxel, keys_dico["down"])):
                        self.aim_dir="down"
                    else:
                        self.aim_dir="straight"
                else:
                    self.aiming=False
                if (pyxel.btnr(getattr(pyxel, keys_dico["bow"])) and self.bow_frame>self.bow_frame_lenght) or (not pyxel.btn(getattr(pyxel, keys_dico["bow"])) and self.bow_frame>=self.bow_frame_lenght):
                    other_entities.append(arrow(self.x+4+(-6,5)[self.facing],self.y+4+[-3,0,3][["up","straight","down"].index(self.aim_dir)],[-45,0,45][["up","straight","down"].index(self.aim_dir)] *[-1,1][self.facing]+[180,0][self.facing],min(7.5,(self.bow_frame/30)*7.5),self.vx,self.vy))
                    self.bow_frame=0
                    self.bow_cooldown=self.bow_cooldown_lenght
        else:
            self.aiming=False
            self.bow_frame=0

    def cinematic_manager(self,cinematic_state):
        if cinematic_state=="dash1":
            self.dash_counter=1
            self.max_dash=1
            self.vx,self.vy=0,0


    def go_to_animation(self):
            self.dashing=False
            self.on_ground=True
            self.animation_ground=True
            self.vy=0
            self.y=self.go_to[1]
            if self.x<self.go_to[0]:
                self.vx=1.2
                if self.x+self.vx>=self.go_to[0]:
                    self.state=None
                    self.go_to=None
            elif self.x>self.go_to[0]:
                self.vx=-1.2
                if self.x+self.vx<=self.go_to[0]:
                    self.state=None
                    self.go_to=None

    def handle_effect(self):
        for ef in self.effects.items():
            self.effects[ef[0]]=max(0,ef[1]-1)

    def apply_effect(self):
        self.resistance=0.5 if self.effects["resistance"]>0 else 1
        self.g=0.3 if self.effects["gravity"]>0 else 0.5
        self.dmg_multiplyer=1.5 if self.effects["strength"]>0 else 1



    def update(self,cinematic_state=None):
        global particle_list

        self.cinematic_manager(cinematic_state)
        self.invincibility_manager()
        self.apply_effect()
        #if self.state=="go_to":
        #    self.apply_v()

        if cinematic_state==None and self.state!="go_to":
            self.dash_manager()
            self.mouvement_manager()
            self.velocity_manager()
            self.collision_manager_general()
            self.attack_manager()
            self.bow_manager()
            self.handle_effect()




        if self.state=="go_to":
            self.go_to_animation()
            self.apply_v()



class Block :
    def __init__(self,x,y,tm=0,go_trough=False,delay=None,render=True):
        self.x=x
        self.y=y
        self.render=render
        if self.render:
            self.go_trough=go_trough
            self.delay=delay
            self.tm=tm
        self.alive=True


class Door(Block):
    def __init__(self,x,y,tmy):
        super().__init__(x,y,0,False)
        self.frame=0
        self.state=None
        self.tmy=tmy

    def update(self,animation=None):

        if animation=="closing":
            self.state="closing"
        if animation=="opening":
            self.state="opening"

        if self.state=="closing":
            self.frame+=1
        if self.state=="opening":
            self.frame-=1
        self.frame=min(max(0,self.frame),3*5-1)

        if self.frame%3==0:
            pyxel.tilemaps[self.tm].pset(int(self.x),int(self.y),(0+(self.frame//3),self.tmy))


class flower_jump(Block):
    def __init__(self, x, y):
        super().__init__(x, y, 1, True, 12, True)
        self.frame=12
        self.alive=True
        self.tm_frames={5:(8,18),6:(8,18),0:(9,18),1:(10,18),2:(11,18),3:(12,18),4:(13,18)}

    def update(self):
        if (12-self.frame)//2 in (0,1):
            for i in range(1):
                particle_list.append(Particle(self.x+4,self.y+4,pyxel.rndf(-1,1),pyxel.rndf(-2,-1),[8,2,3,11][pyxel.rndi(0,3)],1,1,0,20))
        self.frame-=1
        if self.frame<0:
            self.alive=False
            pyxel.tilemaps[0].pset(self.x//8,self.y//8,(8,18))
        self.tx,self.ty=self.tm_frames[(12-self.frame)//2]
        pyxel.tilemaps[0].pset(self.x//8,self.y//8,(self.tx,self.ty))


class flower_jump_dark(Block):
    def __init__(self, x, y):
        super().__init__(x, y, 1, True, 12, True)
        self.frame=12
        self.alive=True
        self.tm_frames={5:(8,19),6:(8,19),0:(9,19),1:(10,19),2:(11,19),3:(12,19),4:(13,19)}

    def update(self):
        if (12-self.frame)//2 in (0,1):
            for i in range(1):
                particle_list.append(Particle(self.x+4,self.y+4,pyxel.rndf(-1,1),pyxel.rndf(-2,-1),[9,2,3,4][pyxel.rndi(0,3)],1,1,0,20))
        self.frame-=1
        if self.frame<0:
            self.alive=False
            pyxel.tilemaps[0].pset(self.x//8,self.y//8,(8,19))
        self.tx,self.ty=self.tm_frames[(12-self.frame)//2]
        pyxel.tilemaps[0].pset(self.x//8,self.y//8,(self.tx,self.ty))


class spring(Block):
    def __init__(self, x, y):
        super().__init__(x, y, 1, True, 12, True)
        self.frame=12
        self.alive=True
        self.tm_frames={5:(8,20),6:(8,20),0:(9,20),1:(10,20),2:(11,20),3:(12,20),4:(13,20)}

    def update(self):
        self.frame-=1
        if self.frame<0:
            self.alive=False
            pyxel.tilemaps[0].pset(self.x//8,self.y//8,(8,20))
        self.tx,self.ty=self.tm_frames[(12-self.frame)//2]
        pyxel.tilemaps[0].pset(self.x//8,self.y//8,(self.tx,self.ty))

class Semi_solid_gravel(Block):
    def __init__(self,x,y):
        super().__init__(x,y,0,False,60)
    def update(self):
        global particle_list
        self.delay-=1
        if self.delay==0:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(0,13))
        if self.delay==40:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(4,1))

        if self.delay==50:

            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(1,13))
        if self.delay==45:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(3,13))
        if self.delay==47:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(2,13))
        if self.delay==59:
            if pyxel.rndi(0,1)==1:
                particle_list.append(Particle(self.x+pyxel.rndi(1,7),self.y+pyxel.rndi(1,7),pyxel.rndf(-1,1),0,[13,13,15,5][pyxel.rndi(0,3)],1,1,1,90))
        if self.delay==0:
            self.alive=False

class Semi_solid_rock(Block):
    def __init__(self,x,y):
        super().__init__(x,y,0,False,60)
    def update(self):
        global particle_list
        self.delay-=1
        if self.delay==-60:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(4,31))
        if self.delay==40:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(4,1))

        if self.delay==50:

            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(5,31))
        if self.delay==45:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(7,31))
        if self.delay==47:
            pyxel.tilemaps[self.tm].pset(int(self.x//8),int(self.y//8),(6,31))
        if self.delay==59:
            if pyxel.rndi(0,1)==1:
                particle_list.append(Particle(self.x+pyxel.rndi(1,7),self.y+pyxel.rndi(1,7),pyxel.rndf(-1,1),0,[13,13,15,5][pyxel.rndi(0,3)],1,1,1,90))
        if self.delay==-60:
            self.alive=False

class dripstone(Block):
    def __init__(self, x, y):
        super().__init__(x, y, render=False)
    def update(self):
        global particle_list
        if pyxel.rndi(0,60)==0:
            particle_list.append(Particle(self.x*8+4+pyxel.rndi(0,1),self.y*8+8,0,0,6,1,1,0,45))

class deep_dripstone(Block):
    def __init__(self, x, y):
        super().__init__(x, y, render=False)
    def update(self):
        global particle_list
        if pyxel.rndi(0,60)==0:
            particle_list.append(Particle(self.x*8+4+pyxel.rndi(0,1),self.y*8+8,0,0,3,1,1,0,45))


class dark_dripstone(Block):
    def __init__(self, x, y):
        super().__init__(x, y, render=False)
    def update(self):
        global particle_list
        if pyxel.rndi(0,60)==0:
            particle_list.append(Particle(self.x*8+4+pyxel.rndi(0,1),self.y*8+8,0,0,8,1,1,0,60))


class small_spike(Block):
    def __init__(self,x,y):
        super().__init__(x,y,render=False)
        self.damage=1
    def update(self):
        if pyxel.rndi(0,60)==0:
            particle_list.append(Particle(self.x*8+4+pyxel.rndi(0,1),self.y*8+4+pyxel.rndi(0,1),pyxel.rndf(-0.1,0.1),pyxel.rndf(-0.1,0.1),7,0.1,1,0,30))


class Enemies:
    def __init__(self,x,y,speed,pv,damage,frame_rule,tx,ty,dontfall=False,facing=0,tml=4,particle_color=8,particle_number=10,can_auto_jump=False,deplacement_type="constant",ai="neutral",h=8,w=8,nockback_strength=0.5,start_tx=0,start_ty=0):
        self.x=x
        self.y=y
        self.speed=speed
        self.pv=pv
        self.max_pv=pv
        self.damage=damage
        self.frame_rule=frame_rule
        self.tx=tx
        self.ty=ty
        self.invicibility_max=20
        self.invicibility=0
        self.facing=facing
        self.tml=tml
        self.particle_color=particle_color
        self.particle_number=particle_number
        self.can_auto_jump=can_auto_jump
        self.dontfall=dontfall
        self.vx=0
        self.vy=0
        self.h=int(h)
        self.w=int(w)
        self.start_tx=start_tx
        self.start_ty=start_ty
        self.deplacement_type=deplacement_type
        self.frame=0
        self.ai=ai
        self.ai_check=pyxel.rndi(50,70)
        self.nockback_strength=nockback_strength
        self.idle=False

    def nockback(self,direction):
        self.vx= self.nockback_strength*(direction*2-1)
        self.vy=-1
    def collision(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) not in transparent and (pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8)[0]<8 or pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) in solid)
    def on_ground(self):
        return(self.collision(self.start_tx+2,self.h+self.start_ty) or self.collision(self.start_tx+self.w-2,self.start_ty+self.h))
    def in_ground(self):
        return(self.collision(self.start_tx+2,self.h+self.start_ty-0.5) or self.collision(self.start_tx+self.w-2,self.start_ty+self.h-0.5))
    def touch_left(self,offset=0):
        return(self.collision(self.start_tx-offset,self.start_ty+2) or self.collision(self.start_tx-offset,self.start_ty+self.h-2))
    def touch_right(self,offset=0):
        return(self.collision(self.start_tx+self.w+offset,self.start_ty+2) or self.collision(self.start_tx+self.w+offset,self.start_ty+self.h-2))
    def touch_ceiling(self):
        return(self.collision(self.start_tx+1,self.start_ty) or self.collision(self.start_tx+self.w-1,self.start_ty))

    def loose_life(self,direction,amount=1):
        if self.invicibility ==0:
            self.nockback(direction)
            self.pv-=amount
            self.invicibility=self.invicibility_max
            a=2 if self.pv<=0 else 1
            if a in (1,2,3):
                for k in range(a*pyxel.rndi(self.particle_number-4,self.particle_number+4)):
                    particle_list.append(Particle(self.x+4,self.y+4,pyxel.rndf(-1,1),pyxel.rndf(-2,-1),self.particle_color[pyxel.rndi(0,len(self.particle_color)-1)],pyxel.rndf(0.7,1),1,pyxel.rndi(0,1),30))

    def avoid_fall(self):
        if (not self.collision(self.start_tx-1,self.start_ty+self.h+1) and self.facing==0) or (not self.collision(self.start_tx+self.w+1,self.start_ty+self.h) and self.facing==1) and self.on_ground():
            self.facing=(1,0)[self.facing]
    def auto_jump(self):
        if self.on_ground():
            if self.facing==0 and self.touch_left(2) and not self.collision(self.start_tx-5,(self.start_ty+self.h)-13):
                self.vy=-1.7
            if self.facing==1 and self.touch_right(2) and not self.collision(self.start_tx+self.w+5,(self.start_ty+self.h)-13):
                self.vy=-1.7
    def face_player(self,px,py):
        if self.x>px:
            self.facing=0
        elif self.x<px:
            self.facing=1
    def update_mere (self,px,py,player_facing=None):
        if px-15*8<self.x<px+15*8 and py-15*8<self.y<py+15*8:



            self.frame+=1

            self.x+=self.vx
            self.y+=self.vy

            if self.invicibility!=0:
                self.invicibility-=1
            if self.dontfall:
                self.avoid_fall()

            if self.touch_left(-1) and self.facing==0:
                self.facing=1
                self.x+=1

            if self.touch_right(-1) and self.facing==1:
                self.facing=0
                self.x-=1

            if not self.on_ground():
                self.vy+=0.15
            elif self.in_ground():
                self.vy=0
                self.y-=0.5
            else:
                self.vy=0




            if self.deplacement_type=="constant":
                if self.on_ground():
                    self.vx=self.speed*2*(self.facing-0.5)

            if self.can_auto_jump:
                self.auto_jump()


            if self.ai=="face_player" and self.frame%self.ai_check==0:
                self.face_player(px,py)

class Ground_Boss(Enemies) :
    def __init__(self,x,y,start_tx,start_ty,hit_x,hit_y,speed,dmg,pv,patern_list,tx,ty,max_dist_atk,state=None,particle_color=[8],particle_number=10):
        super().__init__(x,y,speed,pv,dmg,6,tx,ty,False,pyxel.rndi(0,1),4,particle_color,particle_number,False,"constant",None,16,16)
        self.x,self.y=x,y
        self.start_tx=start_tx
        self.start_ty=start_ty
        self.hit_x,self.hit_y=hit_x,hit_y
        self.patern_list=patern_list
        self.state=state
        self.max_dist_atk=max_dist_atk

        self.patern_state=None
        self.patern_timer=0
        self.time_patern=30*4
    def patern_roller(self,px,py):
        if self.patern_timer>= self.time_patern:
            tmp=pyxel.rndi(0,len(self.patern_list)-1)
            self.patern_timer=0
            self.patern_state=self.patern_list[tmp]
    def update_boss(self,px,py):
        self.patern_timer+=1
        self.update_mere(px,py)
        self.patern_roller(px,py)
        if self.touch_left(-1):
            self.x+=1
        if self.touch_right(1):
            self.x-=1

        if self.patern_timer==self.time_patern:
            self.patern_timer=0

class Boss_Zombie(Ground_Boss):
    def __init__(self, x, y,first=False):
        super().__init__(x, y,2,2, 12, 14,0.15, 2, 15, ["gs","fist"], 144,208,10,None,[3,3,3,11,11,11,4,5])
        self.patern_state=None
        self.stun_time=0
        self.first=first

    def update(self,px,py,player_facing):
        global other_entities,block_list
        if px-15*8<self.x<px+15*8 and py-15*8<self.y<py+15*8:
            if self.frame%15==0:
                self.face_player(px,py)
            self.update_boss(px,py)
            if self.pv<=0 and self.first:
                item_list.append(heart_container_item(self.x+8,self.y))
                item_list.append(key_item_boss(self.x+8,self.y))
                for bl in block_list :
                    if type(bl) is Door:
                        bl.state="opening"

            if self.stun_time!=0:
                self.stun_time-=1
                self.vx=0
                if self.stun_time==0:
                    self.patern_state=None
                    self.face_player(px,py)

            elif self.patern_state=="gs":
                if self.patern_timer==0:
                    self.face_player(px,py)
                    self.vy-=2
                    self.vx=min(max((px-self.x)/26,-2),2)
                else:
                    if self.on_ground():
                        other_entities.append(Dust_boss_wave(self.x+4,(self.y+1+17)//8*8-3,-1,1))
                        other_entities.append(Dust_boss_wave(self.x+12,(self.y+1+17)//8*8-3,1,1))
                        #self.patern_state=None
                        self.stun_time=20
            elif self.patern_state=="fist":
                if self.patern_timer==0:
                    self.face_player(px,py)
                    self.vx=0
                    self.stun_time=30
                    if self.facing==0:
                        other_entities.append(Fist_boss_wave(self.x-4,(self.y+8),-1,2))
                    else:
                        other_entities.append(Fist_boss_wave(self.x+16-1,(self.y+8),1,1))


class Sheep(Enemies):
    def __init__(self,x,y):
        super().__init__(x,y,0.08,3,0,10,96,208,True,pyxel.rndi(0,1),2,[7,15,7,4],7)
    def update(self,px,py,player_facing):
        self.update_mere(px,py)
class pig(Enemies):
    def __init__(self,x,y):
        super().__init__(x,y,0.1,2,0,7,56,224,True,pyxel.rndi(0,1),2,[14,14,4],7)
    def update(self,px,py,player_facing):
        self.update_mere(px,py)

class Goomba(Enemies):
    def __init__(self,x,y):
        super().__init__(x,y,0.4,2,1,4,32,240,False,pyxel.rndi(0,1),4,[4,4,4,4,4,15,9,2],7)
    def update(self,px,py,player_facing):
        self.update_mere(px,py)
class Cave_goomba(Enemies):
    def __init__(self, x, y,):
        super().__init__(x,y,0.4,2,1,4,128,240,False,pyxel.rndi(0,1),4,[1,3,5,5],7)
    def update(self,px,py,player_facing):
        self.update_mere(px,py)

class fake_tree(Enemies):
    def __init__(self, x, y,):
        super().__init__(x,y,0.3,2,1,4,96,168,False,0,4,[4,4,4,3,1,2],5,True,"constant","face_player")
        self.patern_timer=1
    def update(self,px,py,player_facing):
        if px-15*8<self.x<px+15*8 and py-15*8<self.y<py+15*8:
            self.update_mere(px,py)
            self.patern_timer+=1
            if self.patern_timer%(30*5)==0:
                self.tree_branch_attack(px,py)
    def tree_branch_attack(self,px,py):
        ty_choose=py//8
        while pyxel.tilemaps[0].pget(px//8,ty_choose) [0]>=8 or pyxel.tilemaps[0].pget(px//8,ty_choose) in (transparent or solid):
            ty_choose+=1
        ty_choose-=1
        other_entities.append(root(px,ty_choose*8))


class ghost(Enemies):
    def __init__(self, x, y,):
        super().__init__(x,y,0.7+pyxel.rndf(-0.2,0.1),5,1,4,96,184,False,0,4,[13,13,13,7,7,7,8],4,False,"fly_trough","face_player",8,8,0.5,0,0)
    def update(self,px,py,player_facing):
        if px-15*8<self.x<px+15*8 and py-15*8<self.y<py+15*8:

            if (player_facing==1 and px<self.x ) or (player_facing==0 and px>self.x):
                self.idle=True
            else:
                self.idle=False
                dy=py-self.y
                dx=px-self.x
                self.angle = pyxel.atan2(dy, dx)

                self.x+=pyxel.cos(self.angle)*self.speed
                self.y+=pyxel.sin(self.angle)*self.speed
        if self.invicibility!=0:
            self.invicibility-=1






class Zombie(Enemies):
    def __init__(self,x,y):
        super().__init__(x,y,0.3+pyxel.rndf(-0.1,0.2),3,1,8,72,224,False,pyxel.rndi(0,1),4,[3,3,3,11,11,11,4,5],5,True,"constant",'face_player')
    def update(self,px,py,player_facing):
        global item_list
        self.update_mere(px,py)
        if self.pv<=0:
            item_list.append(coin_item(self.x,self.y,self.vx))









class Oeilor:
    def __init__(self,x,y):
        self.x=x
        self.y=y
        self.pv=100
        self.max_pv=self.pv
        self.damage=1
        self.frame_rule=3
        self.invicibility_max=20
        self.invicibility=0
        self.facing=None
        self.tml=8
        self.particle_color=[8,8,2,3,5,11,12]
        self.particle_number=10
        self.vx=0
        self.vy=0
        self.h=13
        self.w=13
        self.start_tx=0
        self.start_ty=0
        self.frame=0
        self.patern_timer=None
        self.active_patern=None
        self.nockback_strength=2
        self.patern_list=["beam_solo","circle_beam","bullet_hell","rush_player","invocation_mini","mega_invoquation"]
        self.shadow_sbires=[]
        self.cannon=[]
        self.active_cannons=[]
        for i in range(222,255):
            for j in range(192,223):
                if pyxel.tilemaps[0].pget(i,j)==(5,30):
                    self.cannon.append((i*8,j*8))

        self.go_to_target=(236*8,203*8)

        self.target_beam=(0,0)
        self.phase=0
        self.sbires=[]

        self.split_eye=[]
    def collision(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) not in transparent and (pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8)[0]<8 or pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) in solid)

    def go_to(self):
        new=((self.x*3+self.go_to_target[0])/4,(self.y*3+self.go_to_target[1])/4)
        self.x,self.y=new

    def loose_life(self,direction,amount=1):
        if self.invicibility ==0:
            self.pv-=amount
            self.invicibility=self.invicibility_max
            a=2 if self.pv<=0 else 1
            if a in (1,2,3):
                for k in range(a*pyxel.rndi(self.particle_number-4,self.particle_number+4)):
                    particle_list.append(Particle(self.x+4,self.y+4,pyxel.rndf(-1,1),pyxel.rndf(-2,-1),self.particle_color[pyxel.rndi(0,len(self.particle_color)-1)],pyxel.rndf(0.7,1),1,pyxel.rndi(0,1),30))

    def update (self,px,py,player_facing=None,player=None):
        global enemies_list
        if not (px>220*8 and py>192*8):
            return

        if self.frame is not None:
            self.frame+=1

        if self.invicibility!=0:
            self.invicibility-=1
        self.x+=self.vx
        self.y+=self.vy


        #if self.patern_timer<30*10 :
        #    self.patern_timer+=1
        #elif self.active_patern==None:
        #    patern_id=[0,1,3][pyxel.rndi(0,2)]
        #    self.active_patern=self.patern_list[patern_id]
        #    self.patern_timer=0

        if self.phase==0:

            if self.go_to_target !=None:
                self.go_to()
                if abs(self.x-self.go_to_target[0])<0.1  and abs(self.y-self.go_to_target[1])<0.1:
                    self.x,self.y=self.go_to_target
                    self.go_to_target=None
                    self.patern_timer=0
                    self.active_patern=None



            if self.patern_timer is not None:
                if self.patern_timer==90:
                    player.teleport(229*8,216*8)
                    for i in range(216,232):
                        for j in range(200,216):
                            pyxel.tilemaps[0].pset(i,j,pyxel.tilemaps[1].pget(i,j))
                if self.patern_timer>=120:
                    self.phase=0.5
                    self.go_to_target=[self.x,self.y+40]
                    self.patern_timer=0
        if self.phase==0.5:
            self.go_to()
            if abs(self.x-self.go_to_target[0])<0.1  and abs(self.y-self.go_to_target[1])<0.1:
                self.x,self.y=self.go_to_target
                self.go_to_target=None
                self.phase=1
                self.patern_timer=0



        if self.phase==1:
            #beam_solo
            if self.patern_timer<30:
                #vise
                self.target_beam=(px+4,py+4)
            elif self.patern_timer==45:
                #tir
                dy=self.target_beam[1]-self.y-7
                dx=self.target_beam[0]-self.x-7
                angle = pyxel.atan2(dy, dx)
                other_entities.append(line_beam_final(self.x+7,self.y+7,angle,3,30))

                for i in range(50):
                    a=pyxel.rndi(1,360)
                    f=pyxel.rndf(0.1,1.41)**2
                    particle_list.append(Particle(self.x+7,self.y+7,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,[8,2,14,7][pyxel.rndi(0,3)],1,1,0,60))
            elif self.patern_timer>=7*30:
                self.patern_timer=0
                self.active_patern=None
                if self.pv<=(5/6)*self.max_pv:
                    self.pv=(5/6)*self.max_pv
                    self.phase=2


        if self.phase==2:
            if self.patern_timer==0:
                self.shadow_sbires=[]
                self.sbires=[[self.x+7,self.y+8,360/6*i] for i in range(6)]
                for i in range(50):
                    a=pyxel.rndi(1,360)
                    f=pyxel.rndf(0.1,1.41)**2
                    particle_list.append(Particle(self.x+7,self.y+7,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,[8,2,14,7][pyxel.rndi(0,3)],1,1,0,60))
            elif self.patern_timer<30:
                self.sbires=[[self.x+4+pyxel.cos(360/6*i)*(pyxel.sqrt(self.patern_timer)*4.2),self.y+4+pyxel.sin(360/6*i)*(pyxel.sqrt(self.patern_timer)*4.2),360/6*i] for i in range(6)]

            elif self.patern_timer<90:
                for sbire in self.sbires:
                    sbire[2]+=self.patern_timer-30
                    sbire[0]=pyxel.cos(sbire[2])*25+self.x+4
                    sbire[1]=pyxel.sin(sbire[2])*25+self.y+4
            elif self.patern_timer==90:
                for sbire in self.sbires:
                    dy=py+4-sbire[1]-3
                    dx=px+4-sbire[0]-3
                    angle = pyxel.atan2(dy, dx)
                    other_entities.append(line_beam_final(sbire[0]+3,sbire[1]+3,angle,7,30))

            elif 120<self.patern_timer<=150:
                for sbire in self.sbires:
                    sbire[2]+=self.patern_timer-120
                    sbire[0]=pyxel.cos(sbire[2])*(pyxel.sqrt(150-self.patern_timer)*4.2)+self.x+4
                    sbire[1]=pyxel.sin(sbire[2])*(pyxel.sqrt(150-self.patern_timer)*4.2)+self.y+4

            elif self.patern_timer==151:
                self.sbires=[]
            elif self.patern_timer>=300:
                self.patern_timer=0
                self.active_patern=None
                if self.pv<=(4/6)*self.max_pv:
                    self.pv=(4/6)*self.max_pv
                    self.phase=3
            self.shadow_sbires.append([sbire[:] for sbire in self.sbires])
            if len(self.shadow_sbires)==4:
                del self.shadow_sbires[0]

        if self.phase==3:


            if self.frame==1 :
                if len(enemies_list)<16:
                    for i in range(10):
                        a=pyxel.rndi(1,360)
                        f=pyxel.rndf(0.1,1.41)**2
                        particle_list.append(Particle(self.x+7,self.y+7,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,pyxel.rndi(0,15),1,1,0,60))
                    id=pyxel.rndi(0,8)
                    x=pyxel.rndi(226,247)*8
                    y=203*8

                    enemies_list.append((Zombie(x,y)))# if id in (0,1,2) else (ghost(x,y)) if id==3 else (fake_tree(x,y)) if id==4 else (pig(x,y)) if id==5 else(Sheep(x,y)) if id==6 else (Goomba(x,y)) if id==7 else (Cave_goomba(x,y)))
            if self.frame>50:
                self.frame=0

            if self.pv<=(3/6)*self.max_pv:
                    self.pv=(3/6)*self.max_pv
                    self.phase=4
        if self.phase==4:
            if self.patern_timer in(0,1):
                self.saved_center=(self.x,self.y)
                self.go_to_target=(px+4-7,py+4-7)
                self.patern_timer=2
            if self.patern_timer==2:
                self.go_to()
                if abs(self.x-self.go_to_target[0])<1  and abs(self.y-self.go_to_target[1])<1:

                    self.x,self.y=self.go_to_target
                    self.go_to_target=None
                    self.patern_timer=3
            if 30>self.patern_timer>=3:
                self.patern_timer+=1
            if self.patern_timer==30:

                self.go_to_target=self.saved_center
                self.patern_timer+=1
            if self.patern_timer==31:
                self.go_to()
                if abs(self.x-self.go_to_target[0])<1  and abs(self.y-self.go_to_target[1])<1:
                    self.x,self.y=self.go_to_target
                    self.go_to_target=None
                    self.patern_timer=32
                    self.active_patern=None
            if self.patern_timer>=32:
                self.patern_timer+=1
                if self.patern_timer>60:
                    self.patern_timer=0
                    self.active_patern=None
            if self.pv<=(2/6)*self.max_pv:
                self.go_to_target=self.saved_center

                self.go_to()
                if abs(self.x-self.go_to_target[0])<1  and abs(self.y-self.go_to_target[1])<1:
                    self.x,self.y=self.go_to_target
                    self.go_to_target=None

                    self.active_patern=0
                    self.pv=(2/6)*self.max_pv
                    self.phase=5
        if self.patern_timer is not None and not self.phase in (4,"end_1","end_2"):
            self.patern_timer+=1


        if self.phase==5:


            if self.frame==1 :
                if len(enemies_list)<5:
                    for i in range(10):
                        a=pyxel.rndi(1,360)
                        f=pyxel.rndf(0.1,1.41)**2
                        particle_list.append(Particle(self.x+7,self.y+7,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,pyxel.rndi(0,15),1,1,0,60))
                    id=pyxel.rndi(0,8)
                    x=pyxel.rndi(226,247)*8
                    y=203*8

                    enemies_list.append((Boss_Zombie(x,y)))# if id in (0,1,2) else (ghost(x,y)) if id==3 else (fake_tree(x,y)) if id==4 else (pig(x,y)) if id==5 else(Sheep(x,y)) if id==6 else (Goomba(x,y)) if id==7 else (Cave_goomba(x,y)))
            if self.frame>100:
                self.frame=0

            if self.pv<=(1/6)*self.max_pv:
                    self.pv=(1/6)*self.max_pv
                    self.phase=6
                    self.patern_timer=0
        if self.phase==6:
            if self.patern_timer==1:
                self.active_cannons.append([pyxel.rndi(0,len(self.cannon)-1),0,(px,py)])
            elif self.patern_timer==70:
                self.patern_timer=0
                if self.pv<=(0/6)*self.max_pv:
                    self.pv=(0/6)*self.max_pv
                    self.phase="end_1"
                    self.pv=10
                    self.patern_timer=0
            else:
                for c in self.active_cannons:
                    if c[1]<30:
                        self.target_beam=(px+4,py+4)
                        c[2]=self.target_beam
                    if c[1]==60:
                        dy=c[2][1]-self.cannon[c[0]][1]-4
                        dx=c[2][0]-self.cannon[c[0]][0]-4
                        angle = pyxel.atan2(dy, dx)
                        other_entities.append(line_beam_final(self.cannon[c[0]][0]+4,self.cannon[c[0]][1]+4,angle,7,30,go_trough=True))
                    c[1]+=1

        if self.phase=="end_1":
            if self.patern_timer in(0,1):
                self.go_to_target=(236*8,217*8)
                self.go_to()
                if abs(self.x-self.go_to_target[0])<1  and abs(self.y-self.go_to_target[1])<1:
                    self.x,self.y=self.go_to_target
                    self.go_to_target=None
                    self.patern_timer=2
                    camera_effect.append(["sin","y",10])
            if 2<=self.patern_timer<=19:
                self.patern_timer+=1
            if self.patern_timer==20:
                self.go_to_target=(236*8,210*8)
                self.go_to()
                if abs(self.x-self.go_to_target[0])<1  and abs(self.y-self.go_to_target[1])<1:
                    self.x,self.y=self.go_to_target
                    self.go_to_target=None
                    self.patern_timer=21


            if 21<=self.patern_timer<90:
                self.patern_timer+=1
            if self.patern_timer==90:
                for i in self.cannon:
                    dy=py+4-i[1]-4
                    dx=px+4-i[0]-4
                    angle = pyxel.atan2(dy, dx)
                    other_entities.append(line_beam_final(i[0]+4,i[1]+4,angle,7,30,go_trough=True,damage=False))
                self.patern_timer+=1
            if self.patern_timer>=91:
                self.patern_timer+=1

            if self.patern_timer==120:
                self.patern_timer=0
                self.phase="end_2"

        if self.phase=="end_2":
            if self.patern_timer in(0,1):
                self.patern_timer=2
                self.split_eye=[[self.x-2,self.y-2,0,-1],[self.x+2,self.y+2,1,0.5]]
                for i in range(200):
                    a=pyxel.rndi(1,360)
                    f=pyxel.rndf(0.1,1.41)**2
                    particle_list.append(Particle(self.x+8,self.y+8,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,[8,2,14,7][pyxel.rndi(0,3)],1,1,0,60))
            if 2<=self.patern_timer<=15:
                self.patern_timer+=1
            if 16<=self.patern_timer<=60:
                self.patern_timer+=1
                for c in self.split_eye:
                    c[0]+=[-1,1][c[2]]*0.4
                    c[1]+=c[3]
                    c[3]+=0.1
            if 60==self.patern_timer:
                for i in range(20):
                        a=pyxel.rndi(1,360)
                        f=pyxel.rndf(0.1,1.41)**2
                        particle_list.append(Particle(self.split_eye[0][0]+4,self.split_eye[0][1]+8,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,[8,2,14,7][pyxel.rndi(0,3)],1,1,0,60))
                        particle_list.append(Particle(self.split_eye[1][0]+4+8,self.split_eye[1][1]+8,pyxel.cos(a)*f,(pyxel.sin(a)-1)*f,[8,2,14,7][pyxel.rndi(0,3)],1,1,0,60))
                global outro_state
                outro_state=1




    def draw(self,px,py,cx,cy):
        if self.frame is not None:

            if self.phase ==4 and self.patern_timer in (2,3):
                self.draw_eat()
            elif self.phase=="end_2":
                self.draw_split_eye()
            else:
                self.dram_main_body()
            if type(self.phase) is int:
                if self.phase>=1:
                    pyxel.rect(cx+2+8,cy+128-16+7,self.pv/self.max_pv*(128-4-16),7,2)
                    pyxel.rect(cx+2+8,cy+128-16+7,self.pv/self.max_pv*(128-4-16),1,8)
                    pyxel.blt(cx,cy+128-16,1,128,240,128,16,12)

            if self.phase==0:
                if self.patern_timer!=None:

                    pyxel.text((236*8)-len("Oeilor le Tyran")*1.5,192*8+(((-pyxel.cos(self.patern_timer*2)+1)*64) if self.patern_timer<=90 else (((self.patern_timer-90)**2)+128)),"Oeilor le Tyran",10)
            if self.phase==1:
                if 0<self.patern_timer<=30:
                    pyxel.circb(self.target_beam[0],self.target_beam[1],4,[14,8,2,8][self.patern_timer%4])
                    pyxel.line(px-1,py-1,px+9,py+9,[14,8,2,8][self.patern_timer%4])
                    pyxel.line(px+9,py-1,px-1,py+9,[14,8,2,8][self.patern_timer%4])
                    pyxel.line(self.x+7,self.y+7,px+4,py+4,(8,14,8,2)[self.patern_timer%4])
                elif self.patern_timer<=45:
                    for x,y in((6,6),(6,8),(8,8),(8,6)):
                        pyxel.line(self.x+x,self.y+y,self.target_beam[0]+(self.target_beam[0]-self.x-x)*10,self.target_beam[1]+(self.target_beam[1]-self.y-y)*10,[7,8][self.patern_timer%2])


            if self.phase==2:
                if self.sbires!=[]:
                    for shadow in range(len(self.shadow_sbires)):
                        for k in range(len(self.shadow_sbires[0])):
                            pyxel.blt(self.shadow_sbires[len(self.shadow_sbires)-shadow-1][k][0],self.shadow_sbires[len(self.shadow_sbires)-shadow-1][k][1],0,8,128+8*shadow,7,7,12)
                #for k in range(6):
                    #pyxel.circb(self.shadow_sbires[-1][k][0],self.shadow_sbires[-1][k][1],20,0)
                    #pyxel.blt(self.shadow_sbires[-1][k][0],self.shadow_sbires[-1][k][1],0,8,128,7,7,12)

                for sbire in self.sbires:
                    pyxel.blt(sbire[0],sbire[1],0,8,128,7,7,12)
                    if 45<self.patern_timer<=90:
                        pyxel.line(sbire[0]+3,sbire[1]+3,px+4,py+4,8)

            if self.phase==6:
                for c in self.active_cannons:
                    if c[1]<30:
                        pyxel.circb(self.target_beam[0],self.target_beam[1],4,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(px-1,py-1,px+9,py+9,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(px+9,py-1,px-1,py+9,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(self.cannon[c[0]][0]+4,self.cannon[c[0]][1]+4,px+4,py+4,(8,14,8,2)[self.patern_timer%4])
                    elif 30<c[1]<60:
                        x,y=0,0
                        pyxel.line(self.cannon[c[0]][0]+4,self.cannon[c[0]][1]+4,self.target_beam[0],self.target_beam[1],[7,8][self.patern_timer%2])

            if self.phase=="end_1":
                if 22<self.patern_timer<90:
                    for c in self.cannon:
                        pyxel.circb(self.target_beam[0],self.target_beam[1],4,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(px-1,py-1,px+9,py+9,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(px+9,py-1,px-1,py+9,[14,8,2,8][self.patern_timer%4])
                        pyxel.line(c[0]+4,c[1]+4,px+4,py+4,(8,14,8,2)[self.patern_timer%4])

    def dram_main_body(self):

        pyxel.blt(self.x,self.y,0,16+((self.frame//self.frame_rule)%self.tml)*16,128,16,24,1)

    def draw_eat (self):
        pyxel.blt(self.x,self.y,0,96,104,16,24,1)

    def draw_split_eye(self):
        for c in self.split_eye:
            pyxel.blt(c[0],c[1],0,128+16*c[2],104,16,16,1)



class Particle:
    def __init__(self,x,y,vx,vy,color,weight,friction,size,retention,text=None):
        self.x=x
        self.y=y
        self.vx,self.vy=vx,vy
        self.color=color
        self.size=size
        self.weight=weight
        self.friction=friction
        self.frame_left=int(retention*pyxel.rndf(0.5,1.5))
        self.text=text
    def collision(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) not in transparent and ( pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8)[0]<8 or pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) in solid)

    def update(self):
        if self.text==None:
            if self.collision(0,self.size):
                self.y-=self.vy
                self.vy*=-0.5
        self.vx *= self.friction
        self.vy *= self.friction
        self.vy+=0.2*self.weight
        self.x+=self.vx
        self.y+=self.vy
        self.frame_left-=1

class Zombie_wave_dust :
    def __init__(self,x,y,direction,damage,speed):
        self.direction=direction
        self.alive=True
        self.damage=damage
        self.frame=0
        self.x=x
        self.y=y
        self.vx=direction*speed
        self.max_frame=19
    def update(self):
        self.frame+=1
        self.vx*=0.8
        self.x+=self.vx
        if self.frame==self.max_frame:
            self.alive=False
class Dust_boss_wave(Zombie_wave_dust):
    def __init__(self,x,y,direction,damage):
        super().__init__(x,y,direction,damage,4)
        self.max_frame=19
        self.ty=216 if direction==1 else 221
        hit_x=-2
        hit_y=-4
        hit_w=2+4+2
        hit_h=4+3+2

class Fist_boss_wave(Zombie_wave_dust):
    def __init__(self,x,y,direction,damage):
        super().__init__(x,y,direction,damage,2)
        self.max_frame=19
        self.ty=208
        self.tx=48 if direction==-1 else 40
        hit_x=-2
        hit_y=-4
        hit_w=2+4+2
        hit_h=4+3+2

class arrow:
    def __init__(self,x,y,angle,v,add_vx=0,add_vy=0):
        self.damage=2
        self.x,self.y,self.angle,self.v=x,y,angle,v
        self.vx=pyxel.cos(angle)*v+add_vx
        self.vy=pyxel.sin(angle)*v-1+add_vy
        self.alive=True

    def update(self):
        self.vx*=0.98
        self.vy+=0.2
        self.x+=self.vx
        self.y+=self.vy
        self.angle = pyxel.atan2(self.vy, self.vx)
        if pyxel.tilemaps[0].pget((self.x)//8,(self.y)//8) not in transparent and (pyxel.tilemaps[0].pget((self.x)//8,(self.y)//8)[0] <8 or pyxel.tilemaps[0].pget((self.x)//8,(self.y)//8) in solid ):
            self.alive=False
            for i in range(10):
                particle_list.append(Particle(self.x-self.vx,self.y-self.vy,pyxel.cos(pyxel.rndi(0,360)),pyxel.sin(pyxel.rndi(0,360)),[7,13,4][pyxel.rndi(0,2)],1,1,0,20))

    def draw(self):
        pyxel.line(self.x,self.y,self.x-pyxel.cos(self.angle)*4,self.y-pyxel.sin(self.angle)*4,4)

        pyxel.line(self.x,self.y,self.x-pyxel.cos(self.angle+60)*1,self.y-pyxel.sin(self.angle+60)*1,7)
        pyxel.line(self.x,self.y,self.x-pyxel.cos(self.angle-60)*1,self.y-pyxel.sin(self.angle-60)*1,7)

        pyxel.line(self.x-pyxel.cos(self.angle)*4,self.y-pyxel.sin(self.angle)*4,self.x-pyxel.cos(self.angle)*4-pyxel.cos(self.angle-60)*1,self.y-pyxel.sin(self.angle)*4-pyxel.sin(self.angle-60)*1,13)
        pyxel.line(self.x-pyxel.cos(self.angle)*4,self.y-pyxel.sin(self.angle)*4,self.x-pyxel.cos(self.angle)*4-pyxel.cos(self.angle+60)*1,self.y-pyxel.sin(self.angle)*4-pyxel.sin(self.angle+60)*1,13)





class root:
    def __init__(self,x,y):
        self.alive=True
        self.x=x
        self.y=y
        self.frame=0
        self.animation=0
        self.damage=0
    def update(self):
        self.frame+=1
        if self.animation>=5:
            self.damage=1
        if self.frame%3==0:
            self.animation+=1
        if self.animation>=11:
            self.alive=False
        #pyxel.tilemaps[0].pset(self.x,self.y,(0,0))

class line_beam_final:
    def __init__(self,x1,y1,angle,w,t,render=False,color=7,go_trough=False,damage=True):
        self.x,self.y,self.w=x1,y1,w
        self.t=t
        self.x2=self.x
        self.y2=self.y
        self.angle=angle
        self.damage=2 if damage else None
        for i in range(100):
            if go_trough==False:
                if (pyxel.tilemaps[0].pget(self.x2//8,self.y2//8) in solid or pyxel.tilemaps[0].pget(self.x2//8,self.y2//8)[0]<8) and pyxel.tilemaps[0].pget(self.x2//8,self.y2//8) not in transparent:
                    break
                else:
                    self.x2+=pyxel.cos(angle)*3
                    self.y2+=pyxel.sin(angle)*3
            else:
                    self.x2+=pyxel.cos(angle)*3
                    self.y2+=pyxel.sin(angle)*3

        self.time_left=t
        self.alive=True

        self.col={7:[2,8,7,7,7,8,2],
                 6:[2,8,7,7,8,2],
                 5:[2,8,7,8,2],
                 4:[2,8,8,2],
                 3:[2,8,2],
                 2:[2,2],
                 1:[2],
                 0:[]}

    def update(self):
        self.w=pyxel.sqrt(self.t)
        self.t-=1
        if self.t==0:
            self.alive=False
    def draw(self):
        for i in range(-int(self.w/2),int(self.w/2)):


            col=self.col[int(self.w)][int(self.w/2+i)]
            pyxel.line(self.x+pyxel.sin(self.angle)*i,self.y+pyxel.cos(self.angle)*i,self.x2+pyxel.sin(self.angle)*i,self.y2+pyxel.cos(self.angle)*i,col)
class item :
    def __init__(self,x,y,tmx,tmy,w,h,frame_rule,tml,vx=0,vy=0):
        self.x,self.y=x,y
        self.tmx,self.tmy=tmx,tmy
        self.tml=tml
        self.w,self.h=w,h
        self.frame_rule=frame_rule
        self.frame=0
        self.vx,self.vy=vx,vy
        self.alive=True
    def interact(self,px,py):
        if self.x-1<=px+4<=self.x+self.w+1 and self.y-1<=py+4<=self.y+self.h+1:
            return True
        return False
    def collision(self,offset_x,offset_y):
        return pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) not in transparent and ( pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8)[0]<8 or pyxel.tilemaps[0].pget((self.x+offset_x)//8,(self.y+offset_y)//8) in solid)
    def update(self):
        self.frame+=1
        self.x+=self.vx
        self.y+=self.vy
        if self.collision(2,self.w) and self.vy>0:
            self.vy*=-0.7
        else:
            self.vy+=0.25
        if self.collision(2,self.w+1) and abs(self.vy)<0.1:
            self.vy=0
            self.y-=0.2
        if self.collision(0,2) or self.collision(self.h,2) and abs(self.vx)>0:
            self.vx*=-0.7
        if self.collision(0,4) and abs(self.vx)<0.1:
            self.x-=pyxel.sgn(self.vx)*0.2
            self.vx=0







class heart_container_item(item):
    def __init__(self, x, y):
        super().__init__(x, y, 24, 232, 5, 5, 8, 4,-0.2,-2)
class key_item_boss(item):
    def __init__(self, x, y):
        super().__init__(x, y, 56, 216, 8, 5, 1, 1,0.2,-2)

class potion(item):
    def __init__(self, x, y,effect):
        super().__init__(x, y, 16, 216,8,8,1,1,0,-1)
        ef={1:"resistance",2:"regeneration",3:"strength",4:"luck_potion",5:"gravity",6:"double_dash"}
        self.effect=ef[effect]
        tm=[(16+8*i,216) for i in range(3)]+[(16+8*i,224) for i in range(3)]
        self.tmx,self.tmy= tm[effect-1]





class coin_item(item):
    def __init__(self, x, y,vx):
        super().__init__(x, y,56,208,5,5,5,4,vx,-1)
        self.value=1

class App:
    def __init__(self):
        pyxel.init(128, 128,title="L'Épopée Pixellisée",fps=30,quit_key=pyxel.KEY_UNKNOWN,capture_sec=6)
        self.player = Player()
        self.state="menu"
        self.pause=False
        self.cam_x = 0
        self.cam_y = 0
        self.frame=0
        self.frame_animation=0
        self.start=True

        self.transition_to=None
        self.transition_frame=None
        self.transition_delay=2

        self.cinematic_state=None

        self.level=0
        self.checkpoints={}

        self.music_start=True

        self.creative=False
        self.code=0


        #pyxel.musics[0].set([])

        pyxel.load("my_resource.pyxres")
        for i in range(len(music_menu)):
            pyxel.sounds[40+i].set(music_menu[i][0],music_menu[i][1],music_menu[i][2],music_menu[i][3],music_menu[i][4],)
        for i in range(len(music_level0)):
            pyxel.sounds[45+i].set(music_level0[i][0],music_level0[i][1],music_level0[i][2],music_level0[i][3],music_level0[i][4],)
        for i in range(len(music_angoise)):
            pyxel.sounds[50+i].set(music_angoise[i][0],music_angoise[i][1],music_angoise[i][2],music_angoise[i][3],music_angoise[i][4],)
        for i in range(len(music_boss)):
            pyxel.sounds[55+i].set(music_boss[i][0],music_boss[i][1],music_boss[i][2],music_boss[i][3],music_boss[i][4],)
        self.step_sound=True



        pyxel.run(self.update, self.draw)


    def sound_controler(self):
        if self.state=="menu" and self.music_start:
            self.music_start=False
            for ch in range(2):
                pyxel.play(ch,ch+40,loop=True)
        if self.state=="run" and self.level==0 and self.music_start:
            self.music_start=False
            for ch in range(2):
                pyxel.play(ch,ch+45,loop=True)
        if self.state=="run" and self.level in(1,2,3) and self.music_start:
            self.music_start=False
            for ch in range(2):
                pyxel.play(ch,ch+50,loop=True)
        if self.state=="run" and self.level==4 and self.music_start:
            self.music_start=False
            for ch in range(2):
                pyxel.play(ch,ch+55,loop=True)
            pyxel.play(2,3+55,loop=True)


        #elif self.level!=0 and self.transition_frame==8:
        #    pyxel.play(0,0)
        #    pyxel.play(1,0)
        if self.player.animation_ground and abs(self.player.vx)>0.2 and self.frame_animation%6==1 and self.step_sound:
            pyxel.play(2,0)
        if self.player.dashing and self.player.dash_frame==1:
            pyxel.play(3,3)
        if self.player.vy==-self.player.jump_height+0.5:
            pyxel.play(3,2)
        if self.player.invincibility_frame==0 :
            pyxel.play(3,1)
        if self.player.air_time>1 and self.player.collision_sol(self.player.vy+1) and self.player.vy>0:
            pyxel.play(3,4)
        if self.player.attacking and self.player.attack_frame==1:
            pyxel.play(3,5)




    def handle_control(self):
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 19*8-16*8<pyxel.mouse_x<24*8-16*8 and 11*8<pyxel.mouse_y<12*8+5:
            if self.pause:
                self.state='run'
                self.cam_x,self.cam_y=self.save_cam
                #self.save()
            else:
                self.transition_to="menu"
                self.transition_frame=0
                self.transition_delay=2
                #self.save()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 17*8-16*8<pyxel.mouse_x<18*8-16*8 and 1*8<pyxel.mouse_y<2*8:
            keys_dico["up"]=detect_input()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 17*8-16*8<pyxel.mouse_x<18*8-16*8 and 3*8<pyxel.mouse_y<4*8:
            keys_dico["down"]=detect_input()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 20*8-16*8<pyxel.mouse_x<21*8-16*8 and 1*8<pyxel.mouse_y<2*8:
            keys_dico["left"]=detect_input()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 20*8-16*8<pyxel.mouse_x<21*8-16*8 and 3*8<pyxel.mouse_y<4*8:
            keys_dico["right"]=detect_input()

        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 17*8-16*8<pyxel.mouse_x<20*8-16*8 and 5*8<pyxel.mouse_y<6*8:
            keys_dico["jump"]=detect_input()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 17*8-16*8<pyxel.mouse_x<20*8-16*8 and 7*8<pyxel.mouse_y<8*8:
            keys_dico["dash"]=detect_input()
        elif pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 17*8-16*8<pyxel.mouse_x<19*8-16*8 and 9*8<pyxel.mouse_y<10*8:
            keys_dico["use"]=detect_input()

    def handle_menu(self):
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 6*8<pyxel.mouse_x<12*8 and 10*8<pyxel.mouse_y<12*8 and self.transition_to==None:
            self.transition_to="control"
            self.transition_frame=0
            self.transition_delay=2




        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and 5*8<pyxel.mouse_x<13*8 and 5*8<pyxel.mouse_y<8*8 and self.transition_to==None:
            self.transition_to="select"
            self.transition_frame=0
            self.transition_delay=3

    def handle_select(self):
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (33-32)*8<pyxel.mouse_x<(39-32)*8 and 1*8<pyxel.mouse_y<3*8 and self.transition_to==None:
            self.transition_to="run"
            self.transition_frame=0
            self.transition_delay=3
            self.load_things()
            #self.load()
            self.player.pv=0
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (41-32)*8<pyxel.mouse_x<(47-32)*8 and 3*8<pyxel.mouse_y<5*8 and self.transition_to==None:

            self.transition_frame=0
            self.transition_delay=3
            self.transition_to="transition_debut_txt"
            #self.load_things()
            #self.save()





    def handle_pause(self):
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (1*8)<=pyxel.mouse_x<=(8*8) and (4*8)<=pyxel.mouse_y<=(6*8) and self.transition_to==None:
            self.save_cam=(self.cam_x,self.cam_y)
            self.transition_to="control"
            self.transition_frame=0
            self.transition_delay=2

        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (49)<=pyxel.mouse_y<=(56) and self.transition_to==None and self.player.bag["resistance"]>=1 :
            self.player.bag["resistance"]-=1
            self.player.effects["resistance"]+=30*60
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (57)<pyxel.mouse_y<=(64) and self.transition_to==None and self.player.bag["regeneration"]>=1:
            self.player.bag["regeneration"]-=1
            self.player.pv=min(self.player.pv+4,self.player.max_pv)
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (65)<pyxel.mouse_y<=(72) and self.transition_to==None and self.player.bag["strength"]>=1:
            self.player.bag["strength"]-=1
            self.player.effects["strength"]+=30*40
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (73)<pyxel.mouse_y<=(80) and self.transition_to==None and self.player.bag["luck_potion"]>=1:
            self.player.bag["luck_potion"]-=1
            self.player.effects["luck_potion"]+=30*120
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (81)<pyxel.mouse_y<=(88) and self.transition_to==None and self.player.bag["gravity"]>=1:
            self.player.bag["gravity"]-=1
            self.player.effects["gravity"]+=30*30
        if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT) and (2*8)<=pyxel.mouse_x<=(4*8) and (89)<pyxel.mouse_y<=(96) and self.transition_to==None and self.player.bag["double_dash"]>=1:
            self.player.bag["double_dash"]-=1
            self.player.effects["double_dash"]+=30*30


    def load_things(self):
        for ty in (0,48,96,144,192,208):
            for i in  range(255):
                for j in range(ty,ty+16):

                    if pyxel.tilemaps[0].pget(i,j)==(26,0):
                        enemies_list.append(Goomba(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])
                    if pyxel.tilemaps[0].pget(i,j)==(27,0):
                        enemies_list.append(Cave_goomba(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])
                    if pyxel.tilemaps[0].pget(i,j)==(29,0):
                        enemies_list.append(pig(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])
                    if pyxel.tilemaps[0].pget(i,j)==(29,1):
                        enemies_list.append(Sheep(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])
                    if pyxel.tilemaps[0].pget(i,j)==(28,0):
                        enemies_list.append(Zombie(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])
                    if pyxel.tilemaps[0].pget(i,j)==(26,1):
                        enemies_list.append(ghost(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])

                    if pyxel.tilemaps[0].pget(i,j)==(28,1):
                        enemies_list.append(Boss_Zombie(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])

                    if pyxel.tilemaps[0].pget(i,j)==(27,1):
                        enemies_list.append(fake_tree(i*8,j*8))
                        pyxel.tilemaps[0].set(i,j,["0401"])



                    if pyxel.tilemaps[0].pget(i,j)==(30,0):
                        self.checkpoints[len(self.checkpoints)]=(i*8,j*8)
                        pyxel.tilemaps[0].set(i,j,["0401"])

                    if pyxel.tilemaps[0].pget(i,j)==(8,11):
                        block_list.append(dripstone(i,j))
                    if pyxel.tilemaps[0].pget(i,j)==(8,15):
                        block_list.append(deep_dripstone(i,j))
                    if pyxel.tilemaps[0].pget(i,j)==(8,17):
                        block_list.append(dark_dripstone(i,j))
                    if pyxel.tilemaps[0].pget(i,j) in ((9,14),(10,14),(9,15),(10,15)):
                        block_list.append(small_spike(i,j))
    def checkpoint_manager(self):
        for i in self.checkpoints.items():
            if self.player.x<i[1][0]+4<self.player.x+8 and i[1][1]//128==self.player.y//128:
                previous=self.player.checkpoint
                self.player.checkpoint=i[0]
                if previous!=self.player.checkpoint:
                    #self.save()
                    pass
    def creative_mode(self):

        if pyxel.btnp(pyxel.KEY_UP) and self.code in (0,1):
            self.code+=1
        if pyxel.btnp(pyxel.KEY_DOWN) and self.code in (2,3):
            self.code+=1
        if pyxel.btnp(pyxel.KEY_LEFT) and self.code in (4,6):
            self.code+=1
        if pyxel.btnp(pyxel.KEY_RIGHT) and self.code in(5,7):
            self.code+=1
        if pyxel.btnp(pyxel.KEY_B) and self.code==8:
            self.code+=1
        if pyxel.btnp(pyxel.KEY_A) and self.code==9:
            self.player.max_dash=40
            self.creative=True

    def creative_mode_debugger(self):
        if pyxel.btnp(pyxel.KEY_C):
            enemies_list.append(Oeilor(self.player.x,self.player.y-30))
        if pyxel.btnp(pyxel.KEY_W):
            self.player.pv-=0.5
        if pyxel.btnp(pyxel.KEY_1):
            self.level=0
            self.cam_y=0
            self.player.teleport(1*8,11*8)
        if pyxel.btnp(pyxel.KEY_2):
            self.level=0
            self.cam_y=0
            self.player.teleport(110*8,9*8)
        if pyxel.btnp(pyxel.KEY_3):
            self.level=0
            self.cam_y=0
            self.player.teleport(161*8,9*8)
        if pyxel.btnp(pyxel.KEY_4):
            self.level=0
            self.cam_y=0
            self.player.teleport(250*8,9*8)
        if pyxel.btnp(pyxel.KEY_5):
            self.level=1
            self.cam_y=48*8
            self.player.teleport(61*8,75*8-16*8)
        if pyxel.btnp(pyxel.KEY_6):
            self.level=1
            self.cam_y=48*8
            self.player.teleport(153*8,75*8-16*8)
        if pyxel.btnp(pyxel.KEY_7):
            self.level=1
            self.cam_y=48*8
            self.player.teleport(197*8,68*8-16*8)
        if pyxel.btnp(pyxel.KEY_8):
            self.level=4
            #self.cam_y=48*8
            self.player.checkpoint=40
            self.player_game_over()
        if pyxel.btnp(pyxel.KEY_LEFT):
            self.player.checkpoint-=1
            self.player_game_over()

        if pyxel.btnp(pyxel.KEY_RIGHT):
            self.player.checkpoint+=1
            self.player_game_over()
        if pyxel.btnp(pyxel.KEY_V):
            self.player.bag={"score":0,"coin":0,"resistance":9,"regeneration":9,"strength":9,"luck_potion":9,"gravity":9,"double_dash":9}

        if pyxel.btnp(pyxel.KEY_P):
            exec(f"print({input()})")
        if pyxel.btnp(pyxel.KEY_X):
            exec(f"{input()}")
        if pyxel.btnp(pyxel.KEY_T):
            self.execution=input()
        if pyxel.btnp(pyxel.KEY_Y):
            exec(f"{self.execution}")
        if pyxel.btn(pyxel.KEY_A):
            item_list.append(coin_item(self.player.x,self.player.y-10,self.player.vx))


    def trigger_manager(self):
        global enemies_list
        #chest
        if self.player.interact_tm(4,4)[0] in [(28,5+i) for i in range(6)]:
            (x,y)=self.player.interact_tm(4,4)[1]
            item_list.append(potion(x*8,y*8-9,self.player.interact_tm(4,4)[0][1]-4))
            pyxel.tilemaps[0].pset(x,y,(27,5))
        if self.player.interact_tm(4,4)[0] == (28,11):
            (x,y)=self.player.interact_tm(4,4)[1]
            item_list.append(heart_container_item(x*8,y*8-9))
            pyxel.tilemaps[0].pset(x,y,(27,5))



        # gravel

        if self.player.interact_tm(3,8)[0] == (0,13):
            (x,y)=self.player.interact_tm(3,8)[1]
            block_list.append(Semi_solid_gravel(x*8,y*8))


        if self.player.interact_tm(5,8)[0] == (0,13):
            (x,y)=self.player.interact_tm(5,8)[1]
            block_list.append(Semi_solid_gravel(x*8,y*8))
        # gravel2
        if self.player.interact_tm(3,8)[0] == (4,31):
            (x,y)=self.player.interact_tm(3,8)[1]
            block_list.append(Semi_solid_rock(x*8,y*8))

        if self.player.interact_tm(5,8)[0] == (4,31):
            (x,y)=self.player.interact_tm(5,8)[1]
            block_list.append(Semi_solid_rock(x*8,y*8))

        #flower

        if self.player.interact_tm(4,4)[0] == (8,18):
            (x,y)=self.player.interact_tm(4,4)[1]
            block_list.append(flower_jump(x*8,y*8))
            self.player.vy=-7
        if self.player.interact_tm(4,4)[0] == (8,19):
            (x,y)=self.player.interact_tm(4,4)[1]
            block_list.append(flower_jump_dark(x*8,y*8))
            self.player.vy=-7
        if self.player.interact_tm(4,4)[0] == (8,20):
            (x,y)=self.player.interact_tm(4,4)[1]
            block_list.append(spring(x*8,y*8))
            self.player.vy=-7
        #swords
        if self.player.interact_tm(4,5)[0]==(27,2):
            (x,y)=self.player.interact_tm(4,5)[1]
            pyxel.tilemaps[0].pset(x,y,(26,2))
            self.player.sword="wooden_sword"
        if self.player.interact_tm(4,5)[0]==(27,3):
            (x,y)=self.player.interact_tm(4,5)[1]
            pyxel.tilemaps[0].pset(x,y,(26,2))
            self.player.sword="golden_sword"
        if self.player.interact_tm(4,5)[0]==(27,4):
            (x,y)=self.player.interact_tm(4,5)[1]
            pyxel.tilemaps[0].pset(x,y,(26,2))
            self.player.sword="iron_sword"
        if self.player.interact_tm(4,5)[0]==(28,2):
            (x,y)=self.player.interact_tm(4,5)[1]
            pyxel.tilemaps[0].pset(x,y,(26,3))
            self.player.armor="iron_armor"
            self.player.resistance=0.5
        if self.player.interact_tm(4,4)[0]==(28,4):
            (x,y)=self.player.interact_tm(4,4)[1]
            pyxel.tilemaps[0].pset(x,y,(26,4))
            self.player.bow="bow"

        #cinematic_dash
        if self.player.interact_tm(4,4)[0] == (31,0):
            (x,y)=self.player.interact_tm(4,4)[1]
            for i in range(153,161):
                for j in range(12,16):
                    pyxel.tilemaps[0].set(int(i),int(j),["0401"])
            self.transition_to="cfd"
            self.cinematic_state="dash1"
            self.transition_frame=0
            self.transition_delay=1

        #zombie_boss
        if self.player.interact_tm(4,5)[0]==(30,1) and not "key" in self.player.bag :
            self.player.pv=self.player.max_pv
            (x,y)=self.player.interact_tm(4,5)[1]
            enemies_list.append(Boss_Zombie(131*8,58*8,True))
            enemies_list.append(Zombie(129,58*8))
            enemies_list.append(Zombie(132,58*8))
            for k in range(3):
                block_list.append(Door(120,53+k,18+k))
                pyxel.tilemaps[0].pset(124,53+k,(4,1))
            for i in block_list:
                if type(i) is Door :
                    i.update("closing")

        if self.player.interact_tm(4,4)[0]==(30,2):
            if "key" in self.player.bag and self.player.bag["key"]>=1:
                for k in range(3):
                    for kprime in range(2):
                        pyxel.tilemaps[0].pset(105+k,59+16+8+kprime,(13+k,13+kprime))
                self.transition_to="beaten_b1_door"
                self.transition_frame=0
                self.transition_delay=2
                self.player.bag["key"]-=1
            else:
                if self.frame%30==0:
                    particle_list.append(Particle(self.player.x,self.player.y,0,-0.5,13,0.1,1,1,30,"locked..."))
        #oeilor
        if self.player.interact_tm(4,4)[0]==(31,3):
            (x,y)=self.player.interact_tm(4,4)[1]
            pyxel.tilemaps[0].pset(x,y,(31,2))

            enemies_list=[]
            enemies_list.append(Oeilor(236*8,256*8))
            self.step_sound=False
            self.music_start=True
        #level_transition
        if self.player.interact_tm(4,4)[0] == (31,1) and self.player.state!="go_to" :
                if self.player.x>250*8: # and self.level==0:
                    self.player.state="go_to"
                    self.player.go_to=(257*8,self.player.y)

                if self.player.x<4*8:# and self.level==1:
                    self.player.state="go_to"
                    self.player.go_to=(-16,self.player.y)

    def handle_enemies(self):
        global other_entities,particle_list,enemies_list,block_list
        for i in enemies_list:
            #damage enemie
            if self.player.attacking==True and self.player.attack_frame<3 and self.player.attack_deal_damage:
                offset_player=-1 if self.player.facing==0 else 8+1
                if i.x+i.start_tx-1<self.player.x+offset_player<i.x+i.start_tx+i.w+1  and i.y+i.start_ty-1<self.player.y+3<i.y+i.start_ty+i.h+1  :#if <self.player.x+offset_player<i.x+i.w/2<self.player.x+8+offset_player and self.player.y<i.y+i.h/2<self.player.y+8:
                    if self.player.sword=='wooden_sword':
                        i.loose_life(self.player.facing,1*self.player.dmg_multiplyer)
                    elif self.player.sword=='golden_sword':
                        i.loose_life(self.player.facing,2*self.player.dmg_multiplyer)
                    elif self.player.sword=='iron_sword':
                        i.loose_life(self.player.facing,10*self.player.dmg_multiplyer)
                    self.player.attack_deal_damage=False

            #damage_player
            if self.player.invincibility_frame ==None and i.damage>0:
                if (i.x+i.start_tx<self.player.x+4<i.x+i.start_tx+i.w and i.y+i.start_ty<self.player.y+4<i.y+i.h+i.start_ty and i.pv>0):
                    self.player.pv-=i.damage*self.player.resistance
                    self.player.vy=-2
                    self.player.vx=i.damage*2*(int(i.x<self.player.x)*2-1)
                    for _ in range(i.damage*2):
                        particle_list.append(Particle(self.player.x+4,self.player.y+4,pyxel.rndf(-1,1),pyxel.rndf(-3,-1),8,pyxel.rndf(0.7,1),1,pyxel.rndi(0,1),30))
                    self.player.invincibility_frame=0
            #enemie_update
            if type(i)is Oeilor:
                if i.phase==0:
                    i.update(self.player.x,self.player.y,self.player.facing,self.player)
                else:
                    i.update(self.player.x,self.player.y,self.player.facing)

            else:
                i.update(self.player.x,self.player.y,self.player.facing)
        #tri enemie
        enemies_list = [i for i in enemies_list if (i.pv > 0 or type(i) is Oeilor)]

    def handle_particle(self):
        global other_entities,particle_list,enemies_list,block_list
        for i in particle_list:
            i.update()

        particle_list = [i for i in particle_list if i.frame_left > 0]

    def handle_item(self):
        global other_entities,particle_list,enemies_list,block_list,item_list
        for i in item_list:
            i.update()
            if i.interact(self.player.x,self.player.y):
                i.alive=False
                if type(i) is heart_container_item:
                    self.player.max_pv+=2
                    self.player.pv=self.player.max_pv
                    self.player.bag["score"]+=20
                if type(i)is coin_item:
                    self.player.bag["coin"]+=i.value
                    self.player.bag["score"]+=1
                if type(i) is key_item_boss :
                    self.player.bag["key"]=1 if not "key" in self.player.bag else self.player.bag["key"]+1
                    #self.save()
                if type(i) is potion:
                    self.player.bag[i.effect]+=1
        item_list = [i for i in item_list if i.alive==True]

    def handle_blocks(self):
        global other_entities,particle_list,enemies_list,block_list
        for i in block_list:
            i.update()
            if type(i) is small_spike:
                if self.player.invincibility_frame==None and i.x*8<self.player.x+4<i.x*8+8 and i.y*8<self.player.y+4<i.y*8+8:
                    self.player.pv-=i.damage
                    self.player.invincibility_frame=0
                    particle_list.append(Particle(self.player.x+4,self.player.y+4,pyxel.rndf(-1,1),pyxel.rndf(-3,-1),8,pyxel.rndf(0.7,1),1,pyxel.rndi(0,1),30))
        block_list = [i for i in block_list if i.alive]

    def handle_other_entity(self):
        global other_entities,particle_list,enemies_list,block_list
        for i in other_entities:
            i.update()
            if type(i) is arrow:
                if self.player.invincibility_frame==None and self.player.x-1<i.x+2<self.player.x+9 and self.player.y-1<i.y+1<self.player.y+9:
                    self.player.pv-=i.damage*(self.player.resistance)
                    self.player.invincibility_frame=0
                    i.alive=False
                for enemie in enemies_list:
                    if enemie.x<i.x<enemie.x+enemie.w and enemie.y<i.y<enemie.y+enemie.h:
                        enemie.loose_life([1,0][int(90<i.angle<270)],i.damage)
                        i.alive=False
                if not i.alive:
                    for _ in range(10):
                        particle_list.append(Particle(i.x-i.vx,i.y-i.vy,pyxel.cos(pyxel.rndi(0,360)),pyxel.sin(pyxel.rndi(0,360)),[7,13,4][pyxel.rndi(0,2)],1,1,0,20))



            if type(i) is line_beam_final:
                if i.damage is not None:
                    x1,y1=i.x,i.y
                    x2,y2=i.x2,i.y2
                    x0,y0=self.player.x+4,self.player.y+4
                    dx,dy=x2-x1,y2-y1
                    seg_length_squared=dx*dx+dy*dy
                    if seg_length_squared == 0:
                        d= pyxel.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)
                    else:
                        t = ((x0 - x1) * dx + (y0 - y1) * dy) / seg_length_squared
                        if t < 0 or t > 1:
                            d= 100
                        else:
                            proj_x, proj_y = x1 + t * dx, y1 + t * dy
                            d= pyxel.sqrt((x0 - proj_x) ** 2 + (y0 - proj_y) ** 2)
                    if d<=5:
                        if self.player.invincibility_frame==None:
                            self.player.pv-=i.damage*(self.player.resistance)
                            self.player.invincibility_frame=0
            else:
                if self.player.invincibility_frame==None and self.player.x-1<i.x+2<self.player.x+9 and self.player.y-1<i.y+1<self.player.y+9:
                    self.player.pv-=i.damage*(self.player.resistance)
                    self.player.invincibility_frame=0
        other_entities = [i for i in other_entities if i.alive==True]

    def cinematic_manager(self):
        if self.cinematic_state =="dash1":
            self.player.facing=1
            if pyxel.btn(getattr(pyxel, keys_dico["right"])) and pyxel.btn(getattr(pyxel, keys_dico["up"])) and pyxel.btnp(getattr(pyxel, keys_dico["dash"])) and not (pyxel.btn(getattr(pyxel, keys_dico["down"])) and pyxel.btn(getattr(pyxel, keys_dico["left"]))):
                self.cinematic_state=None
                self.player.dash_start((1,0,0,1))
        if self.cinematic_state in ("transition_debut_txt","texte_outro"):
            if self.start==True:
                self.frame_txt_presentation=0
                self.start=False
            else:
                self.frame_txt_presentation+=1
                if self.cinematic_state=="transition_debut_txt":
                    if pyxel.btnp(pyxel.KEY_SPACE)  or self.frame_txt_presentation==2500:
                        self.cinematic_state=None
                        self.transition_to="run"
                        self.transition_frame=0
                        self.load_things()
                        #self.save()
                pyxel.screen_mode(2)



    def player_game_over(self):
        self.transition_to=f"cp{self.player.checkpoint}"
        self.transition_frame=0
        self.transition_delay=1

    def transition_manager(self):
        #before_change
        if self.frame%self.transition_delay==0:
            self.transition_frame+=1
        #during_change
            if self.transition_frame==5:
                #game_over
                if self.transition_to.startswith("cp"):

                    self.player.teleport(self.checkpoints[int(self.player.checkpoint)][0],self.checkpoints[int(self.player.checkpoint)][1])
                    self.player.pv=self.player.max_pv
                elif self.transition_to=="transition_debut_txt":
                    self.cinematic_state="transition_debut_txt"
                    self.state="transition_debut_txt"
                elif self.transition_to=="texte_outro":
                    self.cinematic_state="texte_outro"
                    self.state="texte_outro"

                #cinematic_dash
                elif self.transition_to=="cfd":
                    self.player.teleport(158*8,12*8)

                elif self.transition_to=="beaten_b1_door":
                    self.player.teleport(152*8,61*8)

                #level_transition
                elif self.transition_to.startswith("lvl_"):
                    self.player.state="go_to"
                    if "next" in self.transition_to:
                        if self.level==0:
                            self.music_start=True

                        self.level+=1
                        self.cam_y+=48*8
                        self.player.facing=1
                        #new_x
                        new_y=(58*8) if self.player.y//(48*8)==0 else (104*8) if self.player.y//(48*8)==1 else ((157)*8) if self.player.y//(48*8)==2 else ((205)*8) if self.player.y//(48*8)==3 else 0
                        self.player.teleport(-1*8,new_y)
                        self.cam_x=0
                        self.player.go_to=(5*8,new_y)



                    if "previous" in self.transition_to:
                        self.cam_x=255*8
                        self.cam_y-=48*8
                        self.level-=1
                        self.player.facing=0
                        new_y=(9*8) if self.player.y//(48*8)==1 else (56*8) if self.player.y//(48*8)==2 else 0
                        self.player.teleport(255*8,new_y)
                        self.player.go_to=(250*8,new_y)
                #changement de game_state
                else:
                    if self.transition_to=="run":
                        self.music_start=True
                    self.state=self.transition_to
                self.transition_to=None
        #after_transition
        if self.transition_frame>=9:

            self.transition_frame=None



    def camera_controler(self):

        if self.player.y//(3*128)in(0.0,1.0,2.0,3.0):
            self.level=(self.player.y+4+3*8)//(3*128)
            self.cam_y=(self.player.y+4+3*8)//(3*128)*(128*3)
        else:
            self.level=4
        is_in=False
        for i in enemies_list:
            if type(i) is Oeilor:
                if i.phase in(0,0.5):
                    self.cam_x=min(max(0,self.cam_x+(i.x+8-self.cam_x-64)/10),256*8-128)

                    self.cam_y=min(max(192*8,self.cam_y+(i.y+8-self.cam_y-64)/10),208*8)
                    is_in=True


        if not is_in:
            self.cam_x=min(max(0,self.cam_x+(self.player.x+4-self.cam_x-64)/10),256*8-128)
            if self.level==4:
                self.cam_y=min(max(192*8,self.cam_y+(self.player.y+4-self.cam_y-64)/10),208*8)
        global camera_effect
        for i in camera_effect:
            if i[0]=="sin":
                if i[1]=="y":
                    self.cam_y+=pyxel.sin(self.frame*20)*i[2]
                    i[2]-=0.5
                if i[1]=="x":
                    self.cam_x+=pyxel.sin(self.frame*20)*i[2]
                    i[2]-=0.5

        camera_effect=[ i for i in camera_effect if i[2]>0]

    def level_manager(self):

        if self.player.x>256*8-2 and self.transition_to==None:
            #self.player.teleport(260*8,57*8)
            self.transition_to="lvl_next"
            self.transition_frame=0
            self.transition_delay=2
        if self.player.x<-8 and self.transition_to==None:
            #self.player.teleport(-5*8,12*8)
            self.transition_to="lvl_previous"
            self.transition_frame=0
            self.transition_delay=2

    def save(self):
        global keys_dico
        save=""
        save+=f"{self.player.checkpoint} {self.player.max_dash} {self.player.max_pv} {int(self.level)} {int(self.cam_y)} {self.cam_x} {self.player.sword} {self.player.armor} {self.player.bow}"+" "
        for i in keys_dico:
            save+=str(i)+" "+str(keys_dico[i])+" "
        save+='\n'
        for key in self.player.bag.keys():
            save+=str(key)+","+str(self.player.bag[key])+" "
        save+="\n"
        for i in range(16):
            for j in range(256):
                save+=str(pyxel.tilemaps[0].pget(j,i)[0])+" "+str(pyxel.tilemaps[0].pget(j,i)[1])+','+str(j)+" "+str(i)+"," if pyxel.tilemaps[0].pget(j,i) in tile_save else ""
        save+="\n"
        for i in range(48,64):
            for j in range(256):
                save+=str(pyxel.tilemaps[0].pget(j,i)[0])+" "+str(pyxel.tilemaps[0].pget(j,i)[1])+','+str(j)+" "+str(i)+"," if pyxel.tilemaps[0].pget(j,i) in tile_save else ""
        save+="\n"
        for i in range(96,112):
            for j in range(256):
                save+=str(pyxel.tilemaps[0].pget(j,i)[0])+" "+str(pyxel.tilemaps[0].pget(j,i)[1])+','+str(j)+" "+str(i) +","if pyxel.tilemaps[0].pget(j,i) in tile_save else ""
        save+="\n"
        for i in range(144,160):
            for j in range(256):
                save+=str(pyxel.tilemaps[0].pget(j,i)[0])+" "+str(pyxel.tilemaps[0].pget(j,i)[1])+','+str(j)+" "+str(i) +","if pyxel.tilemaps[0].pget(j,i) in tile_save else ""
        save+="\n"
        for i in range(192,224):
            for j in range(256):
                save+=str(pyxel.tilemaps[0].pget(j,i)[0])+" "+str(pyxel.tilemaps[0].pget(j,i)[1])+','+str(j)+" "+str(i) +","if pyxel.tilemaps[0].pget(j,i) in tile_save else ""
        save+="\n"
        for i in enemies_list:
            save+=f'{type(i).__name__} {i.x} {i.y}'+' '
        save+='\n'
        for i in block_list:
            if type(i) is Door:
                save+=f'{type(i).__name__} {i.x} {i.y} {i.tmy} {i.frame} {i.state}'+' '

        save+='\n'
        file = open("Sauvegarde.txt", "w")
        file.write(save)
        file.close()

    def load(self):
        global enemies_list, block_list
        try:
            lst=[]
            file = open("Sauvegarde.txt", "r")
            for i in range(2):
                if i==0:
                    line = file.readline().split()
                    self.player.checkpoint=int(line[0])
                    self.player.max_dash=int(line[1])
                    self.player.max_pv=int(line[2])
                    self.level=int(line[3])
                    self.cam_y=int(line[4])
                    self.cam_x=float(line[5])
                    self.player.sword=line[6]
                    self.player.armor=line[7]
                    self.player.bow=line[8]
                    for i in range(9,23,2):
                        keys_dico[line[i]]=line[i+1]


                else:
                    line=file.readline().split()
                    for i in line:
                        tmp=i.split(",")
                        self.player.bag[tmp[0]]=tmp[1] if not tmp[1].isnumeric() else int(tmp[1])
            for i in range(5):
                line=file.readline().split(',')
                line=[i for i in line if i not in (' ' ,'\n')]
                for i in range(len(line)):
                    if not type(line[i]) is tuple:
                        line[i]=line[i].split()
                        line[i][0]=int(line[i][0])
                        line[i][1]=int(line[i][1])
                        line[i]=tuple(line[i])
                for i in range(0,len(line),2):
                    pyxel.tilemaps[0].pset(line[i+1][0],line[i+1][1],line[i])



            line=file.readline().split()
            for i in range(0,len(line),3):
                lst.append(globals()[line[i]](float(line[i+1]),float(line[i+2])))
            enemies_list=lst
            line=file.readline().split()
            lst=[]
            for i in range(0,len(line),6):
                lst.append(globals()[line[i]](float(line[i+1]),float(line[i+2]),int(line[i+3])))
                lst[len(lst)-1].frame=int(line[i+4])-2
                lst[len(lst)-1].state=line[i+5]
            block_list+=lst

        except:
            self.save()
    def update(self):
        global enemies_list,block_list,particle_list,other_entities,item_list,music_level0,outro_state
        self.frame+=1 if not self.pause else 0
        """if self.start:
            self.load()
            self.start=False"""

        self.sound_controler()

        if outro_state==1:
            self.cinematic_state="texte_outro"
            self.frame_txt_presentation=0
            self.start=True
            self.state="texte_outro"
            self.transition_delay=3
            self.transition_to="texte_outro"
            self.transition_frame=0
            outro_state=2
            pyxel.camera(0,0)
            return
        if outro_state==2:
            if self.transition_frame is not None:
                self.transition_manager()
            if self.cinematic_state is not None:
                self.cinematic_manager()


            return

        if self.transition_frame is not None:
            self.transition_manager()

        if self.cinematic_state is not None:
                self.cinematic_manager()

        if self.state=="menu":
            self.handle_menu()
            self.creative_mode()
        if self.state=="select":
            self.handle_select()

        elif self.state=="control":
            self.handle_control()
        elif self.state=="pause":
            self.handle_pause()
        elif self.state=="run":
            if self.creative:
                self.creative_mode_debugger()

            if not self.pause:


                self.player.update(self.cinematic_state)

                self.checkpoint_manager()


                self.trigger_manager()

                self.handle_enemies()
                self.handle_particle()
                self.handle_item()
                self.handle_blocks()
                self.handle_other_entity()
                self.camera_controler()
                if self.frame%120==0:
                    #self.save()
                    pass
            if pyxel.btnp(pyxel.KEY_TAB)and self.transition_to==None:
                self.pause=not self.pause



            if (self.player.pv<=0 or self.player.interact_tm(4,4)[0] == (30,4)) and self.transition_to is None:
                self.player_game_over()
            if self.pause:
                self.handle_pause()
            self.level_manager()

            pyxel.camera(self.cam_x,self.cam_y)


    def draw_menu(self):
        pyxel.mouse(False)
        self.cam_x=0
        pyxel.camera(0,0)
        pyxel.cls(12)
        pyxel.bltm(0,0,1,0,0,128,128,12)
        pyxel.blt(pyxel.mouse_x+self.cam_x,pyxel.mouse_y,0,96,0,8,8,12)
        if self.creative:
            pyxel.text(3,3,'DEBUG MODE',0)

    def draw_select(self):
        pyxel.mouse(False)
        self.cam_x=256
        pyxel.camera(self.cam_x,0)
        pyxel.cls(12)
        pyxel.bltm(256,0,1,256,0,128,128,12)
        pyxel.blt(pyxel.mouse_x+self.cam_x,pyxel.mouse_y,0,96,0,8,8,12)


    def draw_control(self):
        pyxel.mouse(False)
        self.cam_x=128
        pyxel.camera(self.cam_x,0)
        pyxel.cls(12)
        pyxel.bltm(128,0,1,128,0,128,128,8)
        pyxel.blt(pyxel.mouse_x+self.cam_x,pyxel.mouse_y,0,96,0,8,8,12)

        pyxel.text(18*8+2,1*8+2,keys_dico["up"][4:],7)
        pyxel.text(18*8+2,3*8+2,keys_dico["down"][4:],7)
        pyxel.text(21*8+2,1*8+2,keys_dico["left"][4:],7)
        pyxel.text(21*8+2,3*8+2,keys_dico["right"][4:],7)
        pyxel.text(20*8+2,5*8+2,keys_dico["jump"][4:],7)
        pyxel.text(20*8+1,7*8+2,keys_dico["dash"][4:],7)
        pyxel.text(19*8+3,9*8+2,keys_dico["use"][4:],7)
    def draw_oeior(self):
        for i in enemies_list:
            if type(i) is Oeilor:
                i.draw(self.player.x,self.player.y,self.cam_x,self.cam_y)
    def draw_enemies(self):
        for i in enemies_list:
            if not isinstance(i,(Ground_Boss,Oeilor)):
                col_key= 12 if type(i) in (pig,Goomba,ghost,Sheep) else 15 if type(i)==Zombie else 12
                if i.invicibility!=0:
                    pyxel.blt(i.x,i.y-5,0,64,117,8,3,12)
                    pyxel.rect(i.x+1,i.y-4,int((i.pv/i.max_pv)*6),1,8)
                if i.invicibility%2==0 :
                    if type(i) is ghost:
                        pyxel.blt(i.x+i.start_tx,i.y+i.start_ty,0,i.tx+((self.frame//i.frame_rule)%i.tml)*8,i.ty+8-i.idle*8,i.h,i.w,col_key,)

                    else:
                        pyxel.blt(i.x+i.start_tx,i.y+i.start_ty,0,i.tx+((self.frame//i.frame_rule)%i.tml)*8,i.ty+8-i.facing*8,i.h,i.w,col_key)
            elif  type(i) is Boss_Zombie:
                if i.invicibility!=0:
                    pyxel.blt(i.x+2,i.y-5,0,64,112,16,4,12)
                    pyxel.rect(i.x+3,i.y-4,int((i.pv/i.max_pv)*14),2,8)

                if i.patern_state=="gs":
                    pyxel.blt(i.x+i.start_tx,i.y+i.start_ty,0,112,i.ty+16-i.facing*16,i.h,i.w,15)
                elif i.patern_state=="fist":
                    pyxel.blt(i.x+i.start_tx,i.y+i.start_ty,0,128,i.ty+16-i.facing*16,i.h,i.w,15)
                else:
                    pyxel.blt(i.x+i.start_tx,i.y+i.start_ty,0,i.tx+((self.frame//i.frame_rule)%i.tml)*16,i.ty+16-i.facing*16,i.h,i.w,15)

    def draw_particles(self):
        for i in particle_list:
            if i.text==None:
                pyxel.circ(i.x,i.y,i.size,i.color)
            else:
                pyxel.text(i.x-9,i.y-16,i.text,i.color)
    def draw_items(self):
        for i in item_list:
            pyxel.blt(i.x,i.y,0,i.tmx+((self.frame//i.frame_rule)%i.tml)*i.w,i.tmy,i.h,i.w,12)

    def draw_other_entities(self):
        for i in other_entities:
            if type(i) is root:
                pyxel.blt(i.x,i.y,0,128+i.animation*8,168,8,8,12)
            if type(i) is Dust_boss_wave:
                if i.direction==-1:
                    pyxel.blt(i.x,i.y,0,52-int(i.frame//(5)*4),i.ty,4,3,12)
                elif i.direction==1:
                    pyxel.blt(i.x,i.y,0,40+int(i.frame//(5)*4),i.ty,4,3,12)
            if type(i) is Fist_boss_wave:
                if i.direction==-1:
                    pyxel.blt(i.x,i.y,0,i.tx,i.ty,5,6,12)
                elif i.direction==1:
                    pyxel.blt(i.x,i.y,0,i.tx,i.ty,5,6,12)
            if type(i) is line_beam_final:
                i.draw()
            if type(i) is arrow:
                i.draw()


    def draw_bg(self):
        if self.level==0:
            pyxel.bltm(0,0,0,0,8*24,8*256,128)
        elif self.level==1:
            pyxel.bltm(0,384,0,0,576,256*8,128)
        elif self.level==2:
            pyxel.bltm(0,96*8,0,0,120*8,256*8,128)
        elif self.level==3:
            pyxel.bltm(0,144*8,0,0,168*8,256*8,128)
        elif self.level==4:
            pyxel.bltm(0,192*8,0,0,224*8,256*8,256)

    def draw_player(self):
        if self.player.dashing:
            if self.player.dash_direction == "r":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,0,8,8,2)
            elif self.player.dash_direction == "l":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,8,8,8,2)
            elif self.player.dash_direction == "b":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,24,8,8,2)
            elif self.player.dash_direction =="t":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,16,8,8,2)

            elif self.player.dash_direction =="tr":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,32,8,8,2)
            elif self.player.dash_direction =="tl":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,40,8,8,2)
            elif self.player.dash_direction =="bl":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,48,8,8,2)
            elif self.player.dash_direction =="br":
                pyxel.blt(self.player.x, self.player.y, 0,184+8*self.player.dash_frame,56,8,8,2)


        elif self.player.invincibility_frame ==None or self.player.invincibility_frame%2==0:
            offset_ty=16 if self.player.armor=="iron_armor" else 0
            if self.player.wall_slide:
                pyxel.blt(self.player.x,self.player.y,0,112-self.player.facing*8+offset_ty,48,8,8,2)
            elif not self.player.animation_ground:
                self.frame_animation=0
                pyxel.blt(self.player.x, self.player.y, 0, 112-self.player.facing*8+offset_ty,32,8,8,2)
            elif abs(self.player.vx)<0.2:
                self.frame_animation=0
                pyxel.blt(self.player.x, self.player.y, 0, 0, 40-self.player.facing*8+offset_ty,8,8,2)
            else:
                self.frame_animation+=1 if not self.pause else 0
                pyxel.blt(self.player.x, self.player.y, 0, (10-self.frame_animation%11)*8, 40-self.player.facing*8+offset_ty,8,8,2)

            if self.player.aiming:
                    pyxel.blt(self.player.x+[-4,5][self.player.facing],self.player.y+1,0,[0,8,16][["straight","down","up"].index(self.player.aim_dir)],[104,96][self.player.facing]+[16,0][int(self.player.bow_frame>self.player.bow_frame_lenght)],8,8,12)
            elif self.player.sword is not None:
                if self.player.sword=="wooden_sword":
                    pyxel.blt(self.player.x+(-2+8*self.player.facing), self.player.y+2 ,0, 4-4*self.player.facing  +8*(self.player.attack_frame//2)  ,200,4,4,12)
                elif self.player.sword=="golden_sword":
                    pyxel.blt(self.player.x+(-2+8*self.player.facing), self.player.y+2 ,0, 4-4*self.player.facing  +8*(self.player.attack_frame//2)  ,204,4,4,12)
                elif self.player.sword=="iron_sword":
                    pyxel.blt(self.player.x+(-2+8*self.player.facing), self.player.y+2 ,0, 4-4*self.player.facing  +8*(self.player.attack_frame//2)  ,208,4,4,12)


    def draw_level(self):

        if self.level==0:
            pyxel.blt(21*8,4*8,0,88,56+16*(self.frame//15%2),16,16,12)
            if self.player.checkpoint==0:
                pyxel.bltm(23*8+3,3*8,1,0,48*8,6*8,3*8,0)
                pyxel.text(24*8+13,3*8+5,"Jump",6)
                pyxel.text(24*8+6,4*8+6, "Space_bar" if keys_dico['jump']=="KEY_SPACE" else keys_dico['jump'],7)

            pyxel.blt(160*8,5*8,0,88,24+16*(self.frame//15%2),16,16,12)
            if self.cinematic_state=="dash1":
                pyxel.bltm(152*8+3,5*8,1,0,51*8,8*8,3*8,0)
                pyxel.text(153*8+5+5+4,5*8+5,"Dash",6)
                pyxel.text(152*8+7,6*8+6,"up right + " + keys_dico["dash"][4:] if keys_dico['dash'].startswith("KEY_") else keys_dico['dash'],7)
            pyxel.blt(246*8,3*8,0,88,24+16*(self.frame//15%2),16,16,12)
            pyxel.bltm(0,0,0,0,0,8*256,128,12)
        elif self.level==1:
            pyxel.bltm(0,48*8,0,0,48*8,256*8,128,12)

            pyxel.blt(89*8,66*8-128,0,88,24+16*(self.frame//15%2),16,16,12)
            pyxel.bltm(91*8,65*8-128,1,0,48*8,6*8,3*8,0)
            pyxel.text(92*8+10,65*8+5-128,"Attack",6)
            pyxel.text(92*8+6,66*8+6-128, "Press "+keys_dico["use"][4:] if keys_dico['use'].startswith("KEY_") else keys_dico['use'],7)

        elif self.level==2:
            pyxel.bltm(0,96*8,0,0,96*8,256*8,128,12)
        elif self.level==3:
            pyxel.bltm(0,144*8,0,0,144*8,256*8,128,12)
        elif self.level==4:
            pyxel.bltm(0,192*8,0,0,192*8,256*8,256,12)

            pyxel.blt(10*8,199*8,0,88,56+16*(self.frame//15%2),16,16,12)


            pyxel.bltm(12*8,198*8,1,0,54*8,7*8,3*8,0)
            pyxel.text(13*8+10,198*8+5,"Use bow",6)
            pyxel.text(13*8+6,199*8+6, "release "+keys_dico["bow"][4:] if keys_dico['bow'].startswith("KEY_") else keys_dico['bow'],7)


    def draw_score(self):
        pyxel.text(self.cam_x+100-len(str(self.player.bag['score'])*3),self.cam_y+1,'score:'+str(self.player.bag['score']),7)

    def draw_heart(self):
        for k in range(self.player.max_pv//2):
            if k < self.player.pv//2:
                pyxel.blt(1+k*8+(self.cam_x),self.cam_y+1+((pyxel.rndi(0,1))if self.player.pv<=2 else 0),0,120,64,8,8,12) #full
            elif k <= self.player.pv//2 and self.player.pv%2==1 :
                pyxel.blt(1+k*8+self.cam_x,self.cam_y+1+((pyxel.rndi(0,1))if self.player.pv<=2 else 0),0,128,64,8,8,12) #half
            elif k <= self.player.pv//2 and self.player.pv%2==0.5 :
                pyxel.blt(1+k*8+self.cam_x,self.cam_y+1+((pyxel.rndi(0,1))if self.player.pv<=2 else 0),0,128,72,8,8,12) #half
            elif k <= self.player.pv//2 and self.player.pv%2==1.5 :
                pyxel.blt(1+k*8+self.cam_x,self.cam_y+1+((pyxel.rndi(0,1))if self.player.pv<=2 else 0),0,120,72,8,8,12) #half
            else:
                pyxel.blt(1+k*8+self.cam_x,self.cam_y+1+((pyxel.rndi(0,1))if self.player.pv<=2 else 0),0,136,64,8,8,12) #empty

    def draw_effect(self):
        h=0
        eff={"resistance":0,"regeneration":1,"strength":2,"luck_potion":3,"gravity":4,"double_dash":5}
        for ef in self.player.effects.items():
            if ef[1]!=0:
                t=ef[1]//30
                pyxel.text(self.cam_x+128-25,self.cam_y+2+h*8,str(str(t//60)+":"+("0" if t%60<10 else ""+str(t%60))),0)
                tm=[(144+8*i,224) for i in range(3)]+[(144+8*i,232) for i in range(3)]
                tmx,tmy= tm[eff[ef[0]]]
                pyxel.blt(self.cam_x+128-7,self.cam_y+8*h,1,tmx,tmy,8,8,13)
                h+=1



    def draw_gui(self):
        self.draw_heart()
        self.draw_effect()

    def draw_transition (self):
        for i in range(16):
            for j in range(16):
                pyxel.blt(i*8+self.cam_x,j*8+self.cam_y,0,144+8*self.transition_frame,80,8,8,8)

    def draw_pause(self):
        pyxel.bltm(self.cam_x,self.cam_y,1,0,16*8,128,128,12)
        for i in range(6):
            pyxel.text(5*8+self.cam_x,self.cam_y+6*8+8*i+2,f"X{self.player.bag[list(self.player.effects.keys())[i]]} {list(self.player.effects.keys())[i]}",0)
        pyxel.blt(pyxel.mouse_x+self.cam_x,pyxel.mouse_y+self.cam_y,0,96,0,8,8,12)

    def draw_transition_debut_txt(self):
        pyxel.cls(0)
        self.cam_x,self.cam_y=0,0
        pyxel.camera(0,self.cam_y)
        for i in range(len(texte_intro)):
            pyxel.text(2,120+i*8-self.frame_txt_presentation*0.3,texte_intro[i],10)
        if self.frame%30//15==1:
            pyxel.text(76,120,"SPACE to skip",7)

    def draw_texte_fin(self):
        pyxel.cls(0)
        self.cam_x,self.cam_y=0,0
        pyxel.camera(0,self.cam_y)
        for i in range(len(texte_outro)):
            pyxel.text(2,120+i*8-self.frame_txt_presentation*0.3,texte_outro[i],10)


    def draw(self):
        global enemies_list,block_list,particle_list

        if self.state=="menu":
            self.draw_menu()


        if self.state=="control":
            self.draw_control()

        if self.state=="select":
            self.draw_select()


        if self.state=="run":
            pyxel.screen_mode(0)


            self.draw_bg()

            self.draw_enemies()

            self.draw_particles()
            self.draw_other_entities()

            self.draw_player()

            self.draw_level()
            self.draw_items()

            self.draw_oeior()

            self.draw_gui()

            if self.pause:
                self.draw_pause()

        if self.cinematic_state=="transition_debut_txt":
            self.draw_transition_debut_txt()
        if self.cinematic_state=="texte_outro":
            self.draw_texte_fin()


        if self.transition_frame is not None:
            self.draw_transition()



App()