0,]']P@}Wup8d%qyaL]DAsVl387>:5<25;>=97526853<8?0?  !MMKJMIOMJGKKEBOHJOMCGOOIOIBJDO  &   °CdffvfffffffVT@@VT@@VT@@@@@@8v````````@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@444%t%he~u~%~et~e~%tv`aean5xuyou5xyucl5c}bl%u5oyu%y5cu5w%euy5lcuu5~o%5l%yo5dul5wq5c~%uo{o%e```````````````````````````````````````````````````````````````_%@5_E_U@e_u_@u_e_U@E_5_%@_%_5_E@U_e_u@__u@_@@u_e@U_E_5@%_5_E@U_e@u__@_@_@u_e_U_E_5_%__%_5_E_U_e_u___e___u_`````````````@@@@@@@@@@@@@@@@@@@@@@@@@@@@```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````z2C!qCb Cb?ݻ̻ݻ̻ݻ̻ݽ̻ݽ̻ݽ ̻ ̼ ̼ ̼ ̻ ݻ̻ ݻ̻ݻ̼ݻ̼ݻ̼ݽ̻ݽ̻ݽ̻̻̻ݻ̼̼̻ݻ̻ݻ̻ݻ̻ݽ̼ݽ̼ݽ̼̼ݻ̻̻ݻ̼̻ݻ̻ܽݻ̼ݽݻ̼ݽݻ̼ݻݻ̼ݽݻ̼ݻݻ̻ݽݽ̼ݽݽ̻ݽݽ̼ݽݻݽݻݻݽݽݽݻݻݻݻݽ"ݽ{ݽ+""̷̼ݻݻ+""|gݽݻ+""\ufݽݽ""|Ugݻݻ;3#""\uݻݽ>33""|g\Uݽݽ>33"""\ufU̻ݻ?333/lUg&̪̻ݻ333/"BDTUl&RuȻ̪̻ݻ33/"BDTUl&RUȻ̪DD̻ݻ+B4C&"23swwgfFDUUef̪DD̻ݽ+"ODDd&"23swwgfFDtWef̪݈̻ݻ+""dF3CDdff63cf6CDtWU̪݈̻ݽ+"8C63CDdff63cf6CDtWU̪DD̻ݽ;k8DRUE4cffFdfFD4CDtw̪DD̻ݻkCDRUE4cffFdfFD4CDtw̪̻ݻ4+r8DDtw7cff6CDD43C43#̪̻ݻK4+rC$CDw7cff6CDD43C43#̻ݻKD+"C43DdFDDd6sC4c63CT%̻ݽD4+2B4CdFDDd67C4c63CT%̻ݻD{wC438D433cu63CDT53#""̻ݻ4{wG4333433Su63CDT53#""̻ݽ{{g&h6C3cVUgf633Cdf&̻̻ݻ{g&h6C4cUuff633Cdf&̼̻ݻ{g+bVu7gfUg&bff63cfv̻̻ݽ[uf+bVu7sUug"bff63cfv̼̻ݻUg+Ru7cVUg""""'RUUe̻̻ݻ[uݽ+Ru7cVuf&""r"RUUe̻̻ݻ]Uݽ+""Rwvf"R'""2SUU̼̻ݽUݻ+""""Uw"U'""2SUU̼̻ݽݽ-"""UuUu&""2sw̼̻ݽݻ-"""RUUg"""2CD̻̻ݽvW""Ruf(""2D̻̻ݽmvU""Rw&(""2C̻̻mWU""""(""8D̻̻vU%""""(""C̻W%""""x8̻W-"*""w(r<̻}-"8C"Ugw̻-8D*XufUg̻-CDUw(Ruf̻-8D$Uu(Uw̻-C$XUUu̻-C"("\U̻="*"̻#"(*̬̻MDDDD-"""""=""""""-""("̻MDDDD-"""""""""""-"("̻M -,"=""""-"("̻G M(M4""""-"("W̻GwWD-"(wWgUݻ}GM}wfVM-"((|wfV|gVݽwwJ-?3wwefM33"("""wwefwwVfݻwgF-?3}wgfg33"(""|wglgwgfgݽ{wgu6339#-""""wwfVf"""""("(wwf|wgufUݽ{wVf6339#-""""wgfegM"""""("(\wgflg\|wgVffVݽwwJZv鞙/""wgeffU3"""("((\wgeffU\wwgUvgfwwfǖ鞙/""wguVgfC=4m"""("(Lwg5VgfswwffwVewwvcL<339#/""""rwwffVf3fM""""""""""("""(XV|wwCcf<4Vwwvffff|}w647339#-""""bVwwfffVf4"""""""""("""(\f\U\|gVww6fL\\U\|c5|wvgewf|gV}wgcVo/ge}wgwfս]M8D"""""""(""""""""lŬ\V|ge|wgw\V7WCS|wgfVff|ge}wwg_/evVwwfUmݭ"""*"*""*""̥eVwevVwwfUeVCc7V|wwgfUwevVUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUZUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUUUUUuwUUwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWuwUuwgfWufWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvgfWgffhvghvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhffhvfhfffhfhfhfhfhfhfhfhfhfhfhfhfhfhfhh8h8h8h8h8h8h8h8h8h8h8h8h8h8h838338338338338338338338338338338338338338338383338333833383338333833383338333833383338333833383338333833333833833833833833833833833833833833833833833883838383offfffffffffff8383838383838383offfffffffffff83838383333333333offfffffffffff3333333333333offfffffffffff333338888offfffffffffff888833333333offfffffffffff3333333333333333333333offfffffffffff3333333333333offfffffffffff8383838383offfffffffffff838383838333833383338333833offfffffffffff83338333833383333333333333333offfffffffffff33333333333333833833833833offfffffffffff338338338338338383838383offfffffffffff83838383383838383offfffffffffff38383838833833833833offfffffffffff338338338338333333333333333offfffffffffff3333333333333383838383offfffffffffff83838383838838838838838offfffffffffff8838838838833383338333833383333383338333833383833833833833833833833833833833833833833833833A-- title: Tree Protect -- author: OdiStudio Games, odistudio4444@gmail.com, etc. -- desc: For the 3 hours game jam -- site: website link -- license: MIT License (change this to your license of choice) -- version: 0.1 -- script: lua -- mouse value mou={ x=96, y=80, ml=0, mm=0, mr=0 } -- function mouse function mous() --print(mou.x,10,10) --print(mou.y,10,20) --print(mou.ml,10,30) --print(mou.mm,10,40) --print(mou.mr,10,50) -- mouse value mou.x,mou.y,mou.ml,mou.mm,mou.mr=mouse() -- limit mouse x if mou.x<=0 then mou.x=0 elseif mou.x>=247 then mou.x=247 end -- y if mou.y<=0 then mou.y=0 elseif mou.y>=140 then mou.y=140 end -- end -- feuilles fe={} function addFe(x,y) local f={} f.x=x f.y=y f.dx=math.random(-10.0,10.0)/150.0 f.dy=math.random(2,10.0)/50 f.mm=math.random(2) f.ro=math.random(4) f.sprite=0 f.t=0 table.insert(fe,f) end function ticFe() for k,f in pairs(fe) do f.x=f.x+f.dx f.y=f.y+f.dy -- if f.mm==0 then f.mm=1 end if f.mm==1 and f.y<92 then f.sprite=320 elseif f.mm==2 and f.y<92 then f.sprite=321 end spr(f.sprite,f.x,f.y,1,1,0,f.ro) -- remove feuilles if f.y>=96 then f.y=96 f.t=f.t+1 f.ro=0 if f.sprite==320 then f.sprite=322 elseif f.sprite==321 then f.sprite=323 end end if f.t>=100 then table.remove(fe,k) end end end -- Tree tree={} vitality=100 function addTree(x,y) local t={} t.x=x t.y=y t.s=2 t.sprite=256 t.t=0.1 t.tf=0 t.tfx=0 t.tfy=0 table.insert(tree,t) end function ticTree() for k,t in pairs(tree) do vitality=vitality-t.t t.tfx=math.random(85,130) t.tfy=math.random(40,60) if vitality>=100 then vitality=100 end -- graphisme vitality tree if vitality>70 then t.sprite=256 t.tf=t.tf+0.2 end if vitality>=40 and vitality<=70 then t.sprite=260 t.tf=t.tf+2 end if vitality>=10 and vitality<40 then t.sprite=264 t.tf=t.tf+3 end if vitality<10 then t.sprite=268 t.tf=t.tf+4 end if vitality<=0 then t.sprite=268 table.remove(tree,k) st=0 end -- graphisme spr(t.sprite,t.x,t.y,1,2,0,0,4,4) rect(70,115,100,20,0) rect(70,115,vitality,20,6) rectb(70,115,100,20,15) -- add feuilles if t.tf>= 50 then t.tf=0 addFe(t.tfx,t.tfy) sfx(4,"E-1") end end end -- water water={} function addWater(x,y) local w={} w.x=x w.y=y w.dx=math.random(-10.0,40.0)//20 w.dy=math.random(-50.0,50.0)//40 w.g=0 w.t=0 table.insert(water,w) end function ticWater() for k,w in pairs(water) do -- value water w.y=w.y+w.dy+w.g w.x=w.x+w.dx -- graphisme water pix(w.x,w.y,10) -- remove water if w.y>=103 then w.y=103 w.g=0 w.dy=0 w.dx=0 w.t=w.t+1 elseif w.y<103 then w.g=w.g+0.18 end if w.t>=30 then for v,t in pairs(tree) do if w.x<=t.x+80 and w.x>=t.x-4 then vitality=vitality+0.05 end end table.remove(water,k) end -- end end -- insects insects={} function addInsects(x,y) local i={} i.x=x i.y=y i.dx=0 i.dy=0 i.sprite=0 i.bea=math.random(6) i.dxx=math.random(90,120) i.dyy=math.random(35,95) i.live=50 i.t=0 i.stat=0 i.at=0 i.stl=0 i.att=0 i.ats=0 i.tt=0 i.flip=0 table.insert(insects,i) end function ticInsects() for k,i in pairs(insects) do i.t=i.t+1 if i.bea==0 then i.bea=1 end -- beavior insectes 1 if i.bea==1 -- graphisme insectes then i.sprite=336 spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) -- attack insectes if i.xi.dxx then i.x=i.x-0.5 end if i.yi.dyy then i.y=i.y-0.5 end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then table.remove(insects,k) for q=1,20 do addWater(i.x,i.y) end sc=sc+5 sfx(0,"C-1") -- print("collision with mouse",20,30) end for v,t in pairs(tree) do if i.x<=t.x+60 and i.x>=t.x-4 then i.tt=i.tt+1 end end if i.tt>=100 then sfx(0,"C-1") vitality=vitality-4 table.remove(insects,k) end end -- beavior insectes 2 if i.bea==2 -- graphisme insectes then i.sprite=338 if i.stl==0 then i.stl=1 i.live=10 end spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) -- attack insectes if i.xi.dxx then i.x=i.x-0.2 end if i.yi.dyy then i.y=i.y-0.1 end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then table.remove(insects,k) for q=1,20 do addWater(i.x,i.y) end sc=sc+10 sfx(0,"C-1") -- print("collision with mouse",20,30) end for v,t in pairs(tree) do if i.x<=t.x+60 and i.x>=t.x-4 then i.tt=i.tt+1 end end if i.tt>=180 then vitality=vitality-0.5 sfx(1,"C-1") end if i.tt>=200 then table.remove(insects,k) sfx(0,"C-1") end end -- beavior insectes 3 if i.bea==3 -- graphisme insectes then if i.at==0 then i.sprite=342 spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) elseif i.at==1 then i.sprite=342 spr(i.sprite+i.ats,i.x,i.y,1,2,i.flip) i.ats=i.ats+0.035 if i.ats>=4 then i.ats=0 end end -- attack insectes if i.xi.dxx and i.at==0 then i.x=i.x-0.5 end for v,t in pairs(tree) do if i.x<=t.x+105 and i.x>=t.x-70 then if i.flip==0 then i.at=1 end if i.flip==1 then i.at=1 end end end i.y=88 -- if i.at==1 then i.att=i.att+1 end if i.att>=120 then if i.flip==0 then addArrows(i.x+5,i.y+5,i.flip) i.att=0 end if i.flip==1 then addArrows(i.x+20,i.y+5,i.flip) i.att=0 end end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then table.remove(insects,k) for q=1,50 do addWater(i.x,i.y) end sc=sc+20 sfx(0,"C-1") -- print("collision with mouse",20,30) end end -- beavior insectes 4 if i.bea==4 -- graphisme insectes then i.sprite=358 spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) -- attack insectes if i.xi.dxx and i.at==0 then i.x=i.x-0.5 end i.y=88 for v,t in pairs(tree) do if i.x<=t.x+55 and i.x>=t.x+5 then if i.flip==0 then i.at=1 end if i.flip==1 then i.at=1 end end end for v,t in pairs(tree) do if i.x<=t.x+60 and i.x>=t.x-4 then vitality=vitality-0.4 sfx(3,"E-1") end end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then i.live=i.live-1 addWater(i.x,i.y) sfx(3,"C-1") end if i.live<=0 then for q=1,50 do addWater(i.x,i.y) end sfx(0,"C-1") table.remove(insects,k) sc=sc+100 end -- print("collision with mouse",20,30) end -- beavior insectes 5 if i.bea==5 -- graphisme insectes then i.sprite=368 spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) -- jump and gravity i.y=i.y+i.dy if i.y>=88 then i.y=88 i.dy=0 elseif i.y<88 then i.dy=i.dy+0.3 end i.ats=i.ats+0.3 if i.ats>=20 and i.y>=88 then i.dy=i.dy-5 i.ats=0 end -- attack insectes if i.xi.dxx and i.at==0 then i.x=i.x-0.3 end for v,t in pairs(tree) do if i.x<=t.x+55 and i.x>=t.x+5 then if i.flip==0 then i.at=1 end if i.flip==1 then i.at=1 end end end for v,t in pairs(tree) do if i.x<=t.x+60 and i.x>=t.x-4 then vitality=vitality-0.4 sfx(0,"C-1") end end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then i.live=i.live-1 addWater(i.x,i.y) sfx(3,"C-1") end if i.live<=0 then for q=1,50 do addWater(i.x,i.y) end table.remove(insects,k) sfx(0,"C-1") sc=sc+100 end -- print("collision with mouse",20,30) end -- beavior insectes 6 if i.bea==6 -- graphisme insectes then i.sprite=352 spr(i.sprite+i.t%20//10,i.x,i.y,1,2,i.flip) if i.stl==0 then i.stl=1 i.live=20 end -- attack insectes if i.xi.dxx then i.x=i.x-1+math.random(-4.0,4.0)/60 end if i.yi.dyy then i.y=i.y-1+math.random(-4.0,4.0)/60 end -- remove insectes if mou.mr==true and i.x<=mou.x+4 and i.x>=mou.x-20 and i.y<=mou.y+4 and i.y>=mou.y-20 then i.live=i.live-1 addWater(i.x,i.y) -- print("collision with mouse",20,30) end if i.live<=0 then table.remove(insects,k) for q=1,30 do addWater(i.x,i.y) end sc=sc+50 sfx(0,"C-1") end for v,t in pairs(tree) do if i.x<=t.x+60 and i.x>=t.x-4 then i.tt=i.tt+1 end end if i.tt>=20 then vitality=vitality-6 table.remove(insects,k) sfx(4,"E-2") end end end ticArrows() end -- fire arrows arrows={} function addArrows(x,y,flip) local a={} a.x=x a.y=y a.dx=0 a.dy=0 a.mm=math.random(-1.00,1.00) a.sprite=340 a.t=0 a.sp=0 a.flip=flip table.insert(arrows,a) end function ticArrows() for k,a in pairs(arrows) do -- value arrows a.x=a.x+a.dx a.y=a.y+a.dy a.t=a.t+1 a.dy=a.dy+0.2 if a.flip==0 then a.dx=-2 end if a.flip==1 then a.dx=2 end -- graphisme arrows spr(a.sprite+a.t%20//10,a.x,a.y,1,1,a.flip) addParticle(a.x,a.y+4) sfx(3,"C-1") -- spawn arrows gravity if a.sp==0 then a.sp=1 a.dy=a.dy-4-a.mm end if a.x>=90 and a.x<=130 then if a.flip==0 then addParticle(a.x-10,a.y) sfx(3,"C-1") elseif a.flip==1 then addParticle(a.x+10,a.y) sfx(3,"C-1") end if a.flip==0 then addFire(a.x-10,a.y) sfx(3,"C-1") elseif a.flip==1 then addFire(a.x+10,a.y) sfx(3,"C-1") end vitality=vitality-10 table.remove(arrows,k) end end ticParticle() ticFire() end -- fire fire={} function addFire(x,y) local f={} f.x=x f.y=y f.live=100 f.t=0 table.insert(fire,f) end function ticFire() for k,f in pairs(fire) do f.t=f.t+1 if f.t>=10 then f.t=0 addParticle(f.x+2,f.y) addParticle(f.x,f.y) sfx(3,"C-2") end if f.y<=50 then f.y=f.y+20 end -- remove fire spot for v,w in pairs(water) do if f.x<=w.x+4 and f.x>=w.x-10 and f.y<=w.y+4 and f.y>=w.y-10 then table.remove(water,v) f.live=f.live-1 sc=sc+1 -- print("collision with mouse",20,30) end end if f.live<=0 then table.remove(fire,k) sc=sc+10 end end ticParticle() end -- fire particles particle = {} palete = {4,3,2,15,14,13} function addParticle(x,y) local p = {} p.x = x p.y = y p.dx = math.random(-10.0,10.0)/150.0 p.dy = math.random(-10.0,-2)/50 p.t = 0 p.live=3 table.insert(particle,p) end function ticParticle() --print("#"..#particle) local s=0 local s2=0 local c=0 for k,p in pairs(particle) do p.t = p.t + 1 s = math.log(p.t / 3.0) s2 = s/6.0 c = palete[math.ceil(p.t/20)] p.x = p.x + p.dx p.y = p.y + p.dy circ(p.x-s2,p.y-s2,s,c) -- remove with water for v,w in pairs(water) do if p.x<=w.x+4 and p.x>=w.x-20 and p.y<=w.y+4 and p.y>=w.y-20 then table.remove(water,v) p.live=p.live-1 sc=sc+1 -- print("collision with mouse",20,30) end end --remove old ones if p.t > 100 then for v,t in pairs(tree) do if p.x<=t.x+60 and p.x>=t.x+5 then vitality=vitality-0.02 table.remove(particle,k) end end table.remove(particle,k) end if p.live<=0 then table.remove(particle,k) end end end -- cloud1 tc=0 cc=0 mc=0 cloud={} cloud1={} function addCloud(x,y) local c={} c.x=x c.y=y c.dx=math.random(30.0)/100.0 c.dy=math.random(-100.0,100.0)/180.0 c.r=math.random(4,20) c.fm=math.random(5) c.co=12 table.insert(cloud,c) end function ticCloud() for k,c in pairs(cloud) do c.x=c.x-c.dx c.y=c.y+c.dy if c.fm==1 then circ(c.x-c.r,c.y,c.r,c.co) circ(c.x+c.r,c.y,c.r,c.co) circ(c.x,c.y-c.r,c.r,c.co) elseif c.fm==2 then circ(c.x-c.r,c.y-c.r,c.r,c.co) circ(c.x-c.r,c.y,c.r,c.co) circ(c.x+c.r,c.y,c.r,c.co) circ(c.x,c.y-c.r,c.r,c.co) circ(c.x,c.y,c.r,c.co) elseif c.fm==3 then circ(c.x-c.r,c.y,c.r,c.co) circ(c.x+c.r,c.y,c.r,c.co) circ(c.x,c.y-c.r,c.r,c.co) circ(c.x,c.y+c.r,c.r,c.co) elseif c.fm==4 then circ(c.x,c.y,c.r,c.co) elseif c.fm==5 then circ(c.x,c.y,c.r,c.co) circ(c.x-c.r,c.y,c.r,c.co) circ(c.x,c.y-c.r,c.r,c.co) circ(c.x+c.r,c.y,c.r,c.co) circ(c.x+c.r*2,c.y,c.r,c.co) circ(c.x+c.r*2,c.y+c.r,c.r,c.co) circ(c.x+c.r*2,c.y-c.r,c.r,c.co) end if c.x<=-300 then table.remove(cloud,k) end end end -- cloud 1 function addCloud1(x,y) local c1={} c1.x=x c1.y=y c1.dx=math.random(30.0)/100.0 c1.dy=math.random(-100.0,100.0)/180.0 c1.r=math.random(4,20) c1.fm=math.random(5) c1.co=13 table.insert(cloud1,c1) end function ticCloud1() for k,c1 in pairs(cloud1) do c1.x=c1.x-c1.dx c1.y=c1.y+c1.dy if c1.fm==1 then circ(c1.x-c1.r,c1.y,c1.r,c1.co) circ(c1.x+c1.r,c1.y,c1.r,c1.co) circ(c1.x,c1.y-c1.r,c1.r,c1.co) elseif c1.fm==2 then circ(c1.x-c1.r,c1.y-c1.r,c1.r,c1.co) circ(c1.x-c1.r,c1.y,c1.r,c1.co) circ(c1.x+c1.r,c1.y,c1.r,c1.co) circ(c1.x,c1.y-c1.r,c1.r,c1.co) circ(c1.x,c1.y,c1.r,c1.co) elseif c1.fm==3 then circ(c1.x-c1.r,c1.y,c1.r,c1.co) circ(c1.x+c1.r,c1.y,c1.r,c1.co) circ(c1.x,c1.y-c1.r,c1.r,c1.co) circ(c1.x,c1.y+c1.r,c1.r,c1.co) elseif c1.fm==4 then circ(c1.x,c1.y,c1.r,c1.co) elseif c1.fm==5 then circ(c1.x,c1.y,c1.r,c1.co) circ(c1.x-c1.r,c1.y,c1.r,c1.co) circ(c1.x,c1.y-c1.r,c1.r,c1.co) circ(c1.x+c1.r,c1.y,c1.r,c1.co) circ(c1.x+c1.r*2,c1.y,c1.r,c1.co) circ(c1.x+c1.r*2,c1.y+c1.r,c1.r,c1.co) circ(c1.x+c1.r*2,c1.y-c1.r,c1.r,c1.co) end if c1.x<=-300 then table.remove(cloud1,k) end end end -- draw cloud ftc=0 function drawCloud() tc=tc+1 mc=math.random(0,80) ticCloud1() ticCloud() if tc>=10 then addCloud(280,mc) addCloud1(280,mc) tc=0 end if ftc==0 then for i=1,240,10 do addCloud(i,mc) addCloud(i,mc) addCloud1(i,mc) addCloud1(i,mc) end ftc=1 end end -- end cloud -- draw ennemies spwn=0 spw=0 spwmax=100 spwtime=0 mx=0 my=0 mxx=0 myy=0 function drawEnnemies() if st==1 then spwtime=spwtime+1 spw=spw+1 else spwtime=0 spw=0 spwmax=100 end mxx=math.random(2) my=math.random(-10,105) -- ticInsects() -- if mxx==0 then mxx=1 end if mxx==1 then mx=-10 elseif mxx==2 then mx=260 end -- add insects if spw>=spwmax then spw=0 addInsects(mx,my) end -- print("spwmax : "..spwmax,30,25,0) if spwmax<=70 then spwmax=70 end -- time of add insects if spwtime>=300 then spwtime=0 spwmax=spwmax-1 end end -- draw Tree st=0 spt=0 die=0 tt=0 timest=0 function drawTree() ticTree() -- add tree if mou.ml==true and st==0 and timest>=150 and #insects<=0 and #particle<=0 then sfx(0,"E-5") st=1 addTree(85,40) timest=0 vitality=100 sc=0 die=0 end if mou.ml==true and st==0 then timest=timest+1 else timest=0 end -- remove tree if vitality<=0 then st=0 sc=0 die=1 vitality=100 spw=0 tt=0 timest=0 end -- die tree graphics if die==1 then spr(268,85,40,1,2,0,0,4,4) print("GAME OVER",40,30,0,3,3) sc=0 end -- clignotage tt=tt+0.4 if tt<=10 and st==0 and #particle<=0 and #insects<=0 then print("Maintain for play!",80,115,0) elseif tt>=20 then tt=0 end if st==0 and st==0 and #particle<=0 then print("By OdiStudioGames",75,70,ccc) print("odistudio4444@gmail.com",60,80,ccc) end end -- draw score tsc=0 sc=0 hisc=5000 function score() if st==1 then tsc=tsc+1 end if tsc>=50 then tsc=0 sc=sc+1 end if sc>=hisc then hisc=sc end -- print("Score : "..sc,5,5,0) print("Hingh score : "..hisc,135,5,0) -- end -- draw game function drawGame() map(0,0,30,17,0,0,1) drawTree() ticWater() -- if mou.ml==true then sfx(3,"E-1") addWater(mou.x,mou.y) addWater(mou.x,mou.y) addWater(mou.x,mou.y) addWater(mou.x,mou.y) end end -- mus=0 function TIC() cls(11) if mus==0 then mus=1 music(0) end drawCloud() drawGame() ticFe() drawEnnemies() score() mous() end