0  ,]']>S}Wup8d%qy)6o;]AsVl3<W
`          2TvͫgE#2Tv2Tv   1DexͼwfUE4#" _\PxM                                   @  DD    ""  !  ""!""!"" @  DD    ""     CI4(CJ4CJ4CJ4CI4"9"DDD333DDDDD333DD 3D :)JJJ:9 OD$B$""$"""!            `   p  p  `  `vp pfw                                                                       p  pf  `      `  g wf         #   #      "                
                     `e  `e      "                
                                                                                                             DD	2C4#!B$!B$!B$!2#1DDDDDDDDDDDDDDDD                                                                 fw `vww &rw ""w ""f  bf   w            w    v v`g f`v                  w   p v g  gf  gv    pwfpwfw'b w"" v"" f& `             	          "                   #   #                                                                                                                                " , , , ,       , ,, ,, ,,      ,"                                                                                                                                                                                                                                                                        
 +  
                      "	                    "  "3 "                                                 """ , , , ,    ""  ",  ,  ,     ""         """                                                                                                                                                                                                                                                                   f  `U"  f                        2#                    
    
                                                                                                                          ps  pt  p4                                                                                                                 ݝ ݝ ̝                  ͝                                                                                                                                    
 +  
                  2#                       f  "U f                                                                                                         pD 7Ds GDtpCDtp4D4p4DD73DDG3DD                         s                              0                    ͜ݙɹٹMMMDݽݽݝݙԜԻDD        ݝ	   	 	                                                                                                        "   3"  "                    "                       
    
                                                                              p   p   p   7   G  pC  p4G3DD33DD43DD43DD33DD33DD33DD33DDt   t   4  D  D  Dw  Ds  Dt  0  0  0  0  2  2   3  03  0                             0DD 33 C4 C4MD4MC434 D3D  3  4  4DD4CCD	  	                                                                                                      2  2                !    "      	  	                                                                                                                                          74  73HH̀  33DD333333CD̜̪ɜ̤LDs  Ct  D  ݍ  ̌  Ȍ    ̌  3  02 02  2  2330C43 3D4 0CD      3 33 C3C4C<CL# C4"""""""""""""""""""""""B"""C3  """"""""""$"BD$D3$4#!          0  2  2   C                                                                           
  
               !    "      2  2                 
  
               !    "      V  V  `                                                                       D D  H  D       !4#"3A""""D  Ì  ̍         "  2#    C  @ "3                 DL#L44            ""D""D2                    4D$                 $@D<C<3                                                                                      bf ""g ""w &rwpfwpfw    gv  fv  v g    w                  gp`f vg g p   w            w   f& f"" w"" w'b wwg wf                                                                  " !" !""""""""""""""""23""""""""""""""""""""""""""""33  "2 "" "!# "!2 "!2 ""2"""                                                                          `fw pvp     `   p  f                                                                         wf g  `  p                                                                  """!""!""""!"!"""""""!"""""#,22"!""""""!"""           #   2   2                                                                                                                                                                                                                                                                                                              "        """""""""!""" """   "!"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "  "  "  "  "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @D DD DB@@@ @             @ @@ DD@@DD@DDD@D$B@          " "" B$   @                   ""  "" """ "B$                                                                                                                                                                                                                                                                                                                                                                                                 D@DD@DD@BD @D D BD$  D  "  D@@D @@DD@BDD @DD  D$@       " "" "" $"@ " " $"B @"  D  "  "   ""@$""@ "" @$B  @@<                                      }~lm|}~}~|}lm|}lm|}                                                                                                                                                                                                 !"#$%                                                                                                                                                                                                                                         12345            ?                            =                                                                                                                                                                                              ABCDEFGHIJ          O                            M                                                                                                                                                                                             AQRSTUVWXYZK         .                            ]                                                                                                                                                                                             Qabcdefghij[         >                            =                                                                                                                                                                                             aqrstuvwxyzk         O                            N                                                                                                                                                                                             q{         /                            ^                                                                                                                                                                                                      .                            -                                                                                                                                                                                                       >                            N                                                                                                                                                                                                       _                            ^                                                                                                                                                                                                             /                            ]                                                                                                                                                                                                      ?                            =                                                                                                                                                                                                                  O                            M                                                                                                                                                                                                                  _                            ]                                                                                                                                                                                                                  	                          
                                                                                                                                                                                                                  	`                                                                                                     PPP PPPP PP P P PPP P P P@PPP P P P P P P P P P P P P P                                                                       0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       ``` ` ` `   ` ```             
 6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	'43BBRPPP@@                 	 ;G  %                            E                             %                            E                                                                            #          c   C #       C   C #    	 #	 C #   #  #  C  C   C C  	 C                                                                                               %         	           %    %   	       %         	           %    %   	                                                                                                       #  #       C C 	 C  C   C   	 #                 C C 	 C    C   C                                                                                                   #                     C C    C C     	 #                C	 C     	 C C                                                                                                       #          c   C #       C   C #	 #     C  C C #   C C  #    C                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	                                                                                                           D                              d                             D                             d                    e      `   Ɛ                                                                          ?                                                                           ODODOD            !       !     !     !   !     !     !     !     !     !   03CD      gw       $B$B$B       "          "      "      "  "      "      "      "      "      " 03CD   p`ff&     $""$""$""          
  2      
      
          
      
      2      
      2   :3	  vgf""     $""$""$""     2  
  2  	  
  2  
  V  2  
  V  
  2  2  	  
  2  2  :3	  g pw""     """    2         	     2     V  2     V     2      	     2      )"    ww'b     ! ! !                                 `           `                              )"     wwg                                                                                                JD	      wf                                                                                                       JD	      wf                               33DD                                                                   JD	      g                             33DD                                                                   JD	       `                          33                    03CD                                        JD	       p                          33                    03CD                                        JD	                                  ""                  :3	                                      :3	                                   ""                  :3	                                      :3	                                      DD                  )"                                      93                                     DD                  )"                                      93                                    DD                  JD	                                                                                   DD                  JD	                                                     f   
                          DD                  JD	                                                    `U"                            DD                  JD	                                                     f   
                          33                  JD	                                                                                   33                  JD	                                                                                   33                  :3	                                                                                   33                  :3	                                                                                                             93                                                                                                              93                                                     
 f                                                                                                                  +  "U                                                                                                                 
 f                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  "                                                                                                                   3"  "	               CI4                                                                                              "                   (                                                                                                                   CJ4                                                                                                                  CJ4                                                                                                                  CJ4                                                                                                                  CI4                                                                                                                  "9"                                                                                              f                                                                                                                     `U"  2#                                                                                                                  f                                                                                                                                                                                                                                  ID                                                                                                                   3D3                                                                                                                                                                                                                                  "D"                                                                                                                  "D"        f                                                                                                       "D"      2#  "U                      IDDD	                                                                         "3"        f                       IDDD	                                                                         3                                  23CD43#             03CD                                                                                            23CD43#             03CD                                                          IDDD	                                     :3	                                                        IDDD	                                     :3	                                                        23CD43#                          !"BD$"           )"                                                        23CD43#   "                      !"BD$"           )"                                                       "  "3                     !"BD$"           JD	                                                          "                      !"BD$"           JD	                                                       !"BD$"                          !"BD$"           JD	                                                       !"BD$"                         !"BD$"           JD	                                                       !"BD$"                         !"23#"           JD	              D                                        !"BD$"                         !"23#"           JD	             @D                                       !"BD$"      03CD               13           :3	                                                      !"BD$"
   03CD               13           :3	              "                                       !"23#"+  ":3	                                 93             "                                       !"23#"
 :3	                                 93             """                                       13    )"                                                      """                                      13   )"                                                      """                                                  JD	                                                                                                             JD	                                                                                                             JD	                                                                                                            JD	                                                                                                         2#  2#JD	                                                                                                            JD	                                                                                                             :3	                                                                                                             :3	                                                                                                             93                                                                                                             93                                                                                                                                                                                                                                  
                                                                                                                 "                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                   33DD                                                                                                                  33DD                                                                                                                33                       IDDD	                                                                                 33     "   "             IDDD	                                                                                 ""     3"  "3            23CD43#                                                                                ""     "   "             23CD43#                                                                                DD                                                                                                      DD                                                                                                     DD                     !"BD$"                                                                                DD                     !"BD$"                                                                                DD                     !"BD$"                                                                                DD     f   
            !"BD$"                                                                                33    `U"              !"BD$"                                                                                33     f   
            !"BD$"                                                                                33                     !"23#"                                                                                33                     !"23#"                                                                                                             13                                                                                                             13                                                                                                                                                                                                                    
 DDDD                                                                                                              +  DDDD                                                                                                              
"33DD33"                                                                                                               "33DD33"                                                                                                                                                                                                                                                                                                                                             ""DD""                                                                                                               ""DD""                                                                                                             "  ""DD""                                                                                                             3" ""DD""                                                                                                             "  ""DD""                                                                                                               ""DD""                                                                                                               ""33""                                                                                                               ""33""                                                                                                                33                                                                                                              p 33                                                                                                             pf  p                                                                                                                   ` p                                                                                                                     `                                                                                                                    ` `vp                                                                                                                  gpfw                                                                                                                  wf fw                                                                                                                 pwf`vww                    	    	                                	              	                 	         pwf &rww     #   
  `e   
  0DD       
  `e      #   
  `e   
        
  `e        #   
  `e         ww'b  ""w v   #    `e    !    #    `e   #   #    `e       #    `e     #   #    `e     #    pw""  ""fv`g             0DD     #        #                #           #              #  v gv""   bff`  "      "      "0DD  "         "      "      "      "         "   "      "      "   "      gff&    wv                 2DD                                                              gv`                     0DD                                         -- title:   great elf gift exchange
-- author:  webriprob
-- desc:    dodge the red presents!
-- site:    website link
-- license: MIT License
-- version: 22
-- script:  lua

-- class:player
player = {x=64,y=64}
function move()
if btn(0)then player.y = player.y - 1
end
if btn(1)then player.y = player.y + 1
end
if btn(2)then player.x = player.x - 1
end
if btn(3)then player.x = player.x + 1
end
end

function moveo(o)
if o.connected == true then
if btn(0)then o.y = o.y - 1
end
if btn(1)then o.y = o.y + 1
end
if btn(2)then o.x = o.x - 1
end
if btn(3)then o.x = o.x + 1
end
else
o.y = o.y + o.vy
o.x = o.x + o.vx
end
end

-- class: box
objs = {}

function objdraw(o)
spr(2,o.x,o.y)
end

function takedmg()
end

function renderobjs()
	local spritenum=3
	for i,o in ipairs(objs) do
 if o.size == 1 then spritenum=3 end
 if o.size == 2 then spritenum=6 end
 if o.evil == true then spritenum=19 end
	 spr(spritenum,o.x,o.y,-1,o.size) end --o:draw()
end

revObjs = {}
	
function newobj(id)
local truefalse = {true,false}
	local b={}
	b.x=0
	b.y=0
	b.vx=0
	b.vy=0
	b.connected=false
	b.pos={}
	b.size=math.random(2)
	b.evil=truefalse[math.random(2)]
	randscreenpos(b)
	draw=objdraw
	table.insert(objs,b)
end

function randscreenpos(g)
local x = math.random(2)
if x == 1 then
	g.x = math.random(240)
	g.y = 0
	g.vx = (((math.random(1,10))-5)/5)
	g.vy = -((-(math.random(1,5)))/5)
end
if x == 2 then
	g.x = math.random(240)
	g.y = 136
 g.vx = (((math.random(1,10))-5)/5)
	g.vy = -(((math.random(1,5)))/5)
end
end

function moveobjs()
	for i,o in ipairs(objs) do moveo(o) 
	end 
end

function testcoll(z)
	if z.x > player.x-5
		then if z.x < player.x+5
			then if z.y > player.y-5
			 then if z.y < player.y+5
				 then if z.evil == true
						then if dmgcooldown == 0
							then takedmg() 
							end
							else z.connected=true
						end
					end
				end
			end
	end
	for i,o in ipairs(objs) do testloop(o,z) end
end

function testloop(o,m)
local sizeofo=5
if o.size == 1 then sizeofo = 8 end
if o.size == 2 then sizeofo = 15 end
if o.connected == true
	then if m.x > o.x-sizeofo
		then if m.x < o.x+sizeofo
			then if m.y > o.y-sizeofo
			 then if m.y < o.y+sizeofo
					then if m.id == o.id
					 then if m.evil == true
							then if dmgcooldown == 0
						 then takedmg()
							end
		 				else m.connected=true
							end
						end
					end
				end
			end
		end
end
return z
end

function takedmg()
sfx(16)
hearts = hearts - 1
dmgcooldown=100
end

function drawplayer()
if flash == 0 then spr(1,player.x,player.y)
	if dmgcooldown >0 then flash = 3 end
else flash = flash - 1 end
end

function gameover()
if musicplay == 1 then music(1) musicplay=2 end
	map()
	for k in pairs (objs) do
    objs [k] = nil
end
	print ("Yeah, you're getting fired for sure.",16,96,12)
	print ("want to try again? Hit Z.",16,104,12)
	print ("time:",112,112,4)
	print (score,148,112,12)
	print ("score:",112,120,4)
	print (collected,148,120,12)
	if btnp(4) then lose = false hearts = 3 musicplay=0 ready=.05 vis=1 end	
end

timer = 80
flash=0
newobj(0)
id=1
dmgcooldown=0
hearts = 3
lose = false
spawntimer = 0
musicplay=0
score =0
collected=0
ready=.05
vis = 1
flicker=0
flicker2=0
function TIC()

if lose == false then
if musicplay == 0 then music(0) musicplay=1 end

cls(0)
map(30,0)
if flicker == 0 then flicker = 3 else flicker = flicker - .5 end
if flicker == 0 then flicker2=0 else flicker2 =1 end
if math.sin(ready) < -.5 then vis = 0 end
if vis == 1 then spr(209+(flicker2*2),210,(130+(-math.sin(ready)*20)),-1,1,0,0,2,2)
end
ready=ready+.05
move()
moveobjs()
renderobjs()
if spawntimer <= 0 then newobj(id) id = id + 1 spawntimer=20 end
for i,o in ipairs(objs) do testcoll(o)end




drawplayer()
spawntimer = spawntimer -1
if hearts <= 0 then lose = true end
print((score/10),33,2,12)  
print(collected,33,10,12) 
for i=1,hearts do 
spr (7,8*i,0)
if dmgcooldown > 0 then dmgcooldown = dmgcooldown-1 end
end
score = score +1
collected =0
for i,o in ipairs(objs) do
	if o.connected == true then
		collected = collected + 1
	end
end
else
gameover()
end
end
