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DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDNLLLDDLDLDDLLLLDDLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLDLDNNNDDNDDNNNNDDDNDNNNDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDDNNDDNDDDDNNDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLNDDDDNLDDLNLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDNNDDNNNDDDNDNNDDNDNNNDDDNDNNDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD{.-- title: Nacho aventuras -- author: Vizarte -- desc: V 0.0.3 -- script: lua function init() player={ sp=257, x=40, y=50, h=8, w=8, dx=0, dy=0, max_dx=1.5, max_dy=3, impulso=5, acelerar=0.5, flp=0, saltar=false, correr=false, cayendo=false, enTierra=false, deslizar=false} --------variables globales------- estrella={} musicp=false gravedad=0.2 friccion=0.8 tiempo=0 cam={x=0,y=0} score=0 poder={} cant_poder=5 mant_bot=false t_poder={} tiempo1=0 festiempo=0 fest=false soundi=false enemicarga=false estrecarga=false enemigo={} game_over=false TIC=intro end ---------nubes----------- nubes ={} nubes_cant=5 nubes_x={20,60,100,170,200} nubes_y={40,80,14,30,70} for i=1,nubes_cant do nube={ sp=266, x=nubes_x[i], y=nubes_y[i], scale=math.random(1,2)} table.insert(nubes,nube) end ---------dibuja nube--------------- function dnube() for i,nube in pairs(nubes) do spr(nube.sp,nube.x,nube.y,0,nube.scale,0,0,4,4) end end -----------movimiento nube------ function nubem() for i,nube in pairs(nubes) do nube.x=nube.x-0.1 if nube.x<-64 then nube.x=240 end end end ----variables transicion e init-- ivx=1 ipx=-10 iflip=0 tran=false t_tr1=0 t_tr2=0 estado=0 estado2=0 --------fin de funcion init------ function intro() tiempo=tiempo+1 ipx=ipx+ivx if ipx>300 then ivx=-ivx iflip=1 elseif ipx<-100 then ivx=-ivx iflip=0 end cls(11) rect(44,45,154,5,4) rect(0,128,240,9,4) rect(44,95,154,5,4) dnube() nubem() print("AVENTURAS",70,109,14,0,2) print("AVENTURAS",68,107,04,0,2) spr(240,44,60,0,3,0,0,1,1) spr(241,76,60,0,3,0,0,1,1) spr(242,108,60,0,3,0,0,1,1) spr(243,142,60,0,3,0,0,1,1) spr(244,174,60,0,3,0,0,1,1) player.sp=259+tiempo%9//3 spr(player.sp,ipx,120,0,1,iflip,0,1,1) local texto="PRESIONA (A) PARA EMPEZAR" print(texto,52,130,14) print(texto,51,129,12) if ipx <240 and ipx>0 then if not soundi then sfx(18,80,236,2,3,3) soundi=true end else soundi=false sfx(18,0,0,2,0,0) end if btn(4) and estado==0 then sfx(18,0,0,2,0,0) transicion() estado=1 tran=false end if estado==2 then estado2=2 transicion() init() elseif estado==1 then transicion() end end ---------pausa----------- function juego_pausa() local texto="PAUSA, PULSA (A) O (B) PARA SALIR" print(texto,36,56,15) print(texto,35,55,04) if btn(4)and estado==0 then TIC=game_update elseif btnp(5)and estado==0 then estado=2 TIC=game_update end end ------------dibuja bala troll____ function ddisparos_troll() for i,t_disparos in pairs(t_poder) do spr(t_disparos.sp,t_disparos.x-cam.x,t_disparos.y-cam.y-5,0,2,t_disparos.dir,0,1,1) end end ------ update disparos troll----- function udisparos_troll() for i,t_disparos in pairs(t_poder) do t_disparos.x=t_disparos.x-t_disparos.vel if s_colision(t_disparos,player)and not fest then sfx(1,60,60,3,15,2) game_over=true score=score-5 tiempo=0 end if t_disparos.x>cam.x+250 or t_disparos.x40 then troll.tiempo_d=0 end if troll.x30 then troll.fuego=false end if troll.impacto then troll.sp=288+tiempo%30//15 troll.sc=2 troll.y=troll.y-3 elseif troll.fuego then troll.sp=304 else troll.sp=272+tiempo%60//30 end spr(troll.sp,troll.x-cam.x,troll.y-cam.y,0,troll.sc,troll.flp,0,1,1) end end ---------chequea sprite colision----- function s_colision(obj1,obj2) local a_izq=obj1.x-cam.x local a_der=a_izq+obj1.w local a_arriba=obj1.y-cam.y local a_abajo=a_arriba+obj1.h local b_izq=obj2.x-cam.x local b_der=b_izq+obj2.w local b_arriba=obj2.y-cam.y local b_abajo=b_arriba+obj2.h if a_der > b_izq and a_izq < b_der and a_abajo > b_arriba and a_arriba < b_abajo then return true else return false end end -------distancia player enemigo------- function distancia(spr1,spr2) if math.abs(spr1.x-spr2.x)<140 and math.abs(spr1.y- spr2.y)<10 then return true else return false end end ----------update disparos---------------- function udisparos() for i,disparos in pairs(poder) do disparos.x=disparos.x+disparos.vel if disparos.x>cam.x+220 or disparos.x8 then tiempo1=0 mant_bot=false end if score<0 then score=0 end if not tran and not game_over then if not fest then player_upd() end remap_enem() remap_estrella() pcam() udisparos() utroll() uestrella() udisparos_troll() end cls(11) dnube() nubem() --map(0,120,60,136,-cam.x//10,-cam.y//10,0,1,nil) map(0,0,958,17,-cam.x,-cam.y,0,1,nil) print("score: "..score,10,10,14) print("score: "..score,9,9,12) print("POWER X "..cant_poder,10,20,14) print("POWER X "..cant_poder,09,19,12) ddisparos() ddisparos_troll() destrella() dtroll() if not fest then player_anim() end for i,troll in pairs(enemigo) do if s_colision(player,troll) then sfx(1,78,30,3,15,4) score=score-5 game_over=true end end if btnp(5)and estado==0 then TIC=juego_pausa end if player.enTierra and #enemigo==0 then fest=true festejo() end if game_over==true then estado2=4 transicion() end if estado==1 then for i,v in pairs(poder) do table.remove(poder,i) end for i,v in pairs(t_poder) do table.remove(t_poder,i) end sfx(18,0,0,2,0,0) sfx(1,50,10,2,10,5) if not musicp then music(0) musicp=true end estado2=2 transicion() elseif estado==2 then music(1,0,0,false) estado2=1 tran=true transicion() end end ----------transicion-------------- function transicion() t_tr2=t_tr2+7 tri(0,0,t_tr1+20,0,0,t_tr1+20,4) tri(0,0,t_tr1,0,0,t_tr1,9) tri(240,136,240-t_tr1-20,136,240,136-t_tr1-20,4) tri(240,136,240-t_tr1,136,240,136-t_tr1,9) if t_tr2<190 then t_tr1=t_tr1+7 elseif t_tr2>190 and estado2==0 then TIC=game_update elseif t_tr2>190 and estado2==1 then TIC=intro elseif t_tr2>190 and estado2==4 then cam.x=0 cam.y=0 player.x=50 player.y=90 game_over=false estado=1 TIC=game_update elseif t_tr2>190 then t_tr1=t_tr1-7 end if t_tr1<0 then estado=0 estado2=0 t_tr2=0 t_tr1=0 end end -----------dibuja estrella----------- function destrella() for i,puntos in pairs(estrella) do puntos.sp=336+tiempo%60//15 spr(puntos.sp,puntos.x-cam.x,puntos.y-cam.y,0,1,0,0,1,1) end end ----------------festejo--------------- function festejo() festiempo=festiempo+1 spr(293+tiempo%30//10,player.x-cam.x,player.y-cam.y-player.h,0,1,0,0,1,2) if festiempo>220 then festiempo=0 estado=2 transicion() end end ----------colisiones---------- function colisionMapa(obj,dir,flag) local x=obj.x local y=obj.y local h=obj.h local w=obj.w local x1=0 local x2=0 local y1=0 local y2=0 if dir=="arriba" then x1=x+2 x2=x+w-2 y1=y-2 y2=y end if dir=="abajo" then x1=x+2 x2=x+w-2 y1=y+h y2=y+h end if dir=="izquierda" then x1=x-2 x2=x y1=y+2 y2=y+h-2 end if dir=="derecha" then x1=x+w x2=x+2 y1=y+2 y2=y+h-2 end x1=x1/8 y1=y1/8 x2=x2/8 y2=y2/8 if fget(mget(x1,y1),flag) or fget(mget(x1,y2),flag) or fget(mget(x2,y1),flag) or fget(mget(x2,y2),flag)then return true else return false end end ------------cam mov---------------- function pcam() if player.x > 120 and player.x < 1800 then cam.x=player.x-120 cam.y=0 end end -----------estrella update----- function uestrella() for i,puntos in pairs(estrella) do if s_colision(puntos,player)then sfx(48,90,10,2,15,5) table.remove(estrella,i) score=score+1 end end end ------------player update-------- function player_upd() player.dy=player.dy+gravedad player.dx=player.dx*friccion if btnp(4) and player.enTierra then sfx(0,78,30,3,15,4) player.dy=player.dy-player.impulso player.enTierra=false end if btn(2)then player.dx=player.dx-player.acelerar player.flp=1 player.correr=true end if btn(3)then player.dx=player.dx+player.acelerar player.flp=0 player.correr=true end if player.correr and not btn(2) and not btn(3) and not player.saltar then player.correr=false player.deslizar=true end if player.dy>0 then player.cayendo=true player.enTierra=false player.saltar=false player.dy=limit_speed(player.dy,player.max_dy) if colisionMapa(player,"abajo",4) then game_over=true score=score-5 end if colisionMapa(player,"abajo",0) then player.enTierra=true player.cayendo=false player.dy=0 player.y=player.y-(player.y+player.h)%8 end elseif player.dy<0 then player.saltar=true if colisionMapa(player,"arriba",1) then player.dy=0 end end if player.dx<0 then player.dx=limit_speed(player.dx,player.max_dx) if colisionMapa(player,"izquierda",1) then player.dx=0 end end if player.dx>0 then player.dx=limit_speed(player.dx,player.max_dx) if colisionMapa(player,"derecha",1) then player.dx=0 end end if player.deslizar then if math.abs(player.dx)<0.2 or player.correr then player.dx=0 player.deslizar=false end end if btnp(6)and cant_poder>0 then sfx(4,78,30,3,15,4) cant_poder=cant_poder-1 mant_bot=true disparos={ x=player.x, y=player.y, flp=0, vel=3, h=8, w=8, dir="derecha" } if player.flp==1 then disparos.x=player.x-4 disparos.flp=1 disparos.vel=-3 dir="izquierda" end table.insert(poder,disparos) end player.y=player.y+player.dy player.x=player.x+player.dx end ------------player animacion-------- function player_anim() if player.saltar and not mant_bot then player.sp=262 elseif player.saltar and mant_bot then player.sp=278 elseif player.cayendo and not mant_bot then player.sp=263 elseif player.cayendo and mant_bot then player.sp=279 elseif player.enTierra and mant_bot then player.sp=265 elseif player.deslizar then player.sp=264 elseif player.correr then player.sp=259+tiempo%9//3 else player.sp=257+tiempo%60//30 end spr(player.sp,player.x-cam.x,player.y-cam.y,0,1,player.flp,0,1,1) end -------limitador de fisicas------- function limit_speed(min,maxi) return math.max(-maxi,math.min(min,maxi)) end -------llamada de inicio---- TIC=init