Re: jumping tutorial?
Posted: Sat Nov 13, 2010 1:41 am
Guys, I'm really beat. I'll try and attempt walls tomorrow morning thank you for the continued support though!
Or use the love.keypressed(), which might be more appropriate here (it's hard to read your code).kikito wrote:The keybard() call should be inside love.update.
Code: Select all
--______________________________________________________________________________________________
function love.load()
-- screen
scrx=640; scry=480; zx=(scrx/2); zy=(scry/2); zi=200;
love.graphics.setMode(scrx,scry,false,true,0); love.graphics.setCaption("Love2D project"); love.graphics.setBackgroundColor(10,30,50);
-- font
love.graphics.setFont(12);
-- global
col=0; alpha=255; k_up=0; k_right=0; k_down=0; k_left=0; k_enter=0;
-- global dim
kl=10; dost={};
for d=0,kl-1 do-- for >
dost[d]=0;
end-- for <
end
--______________________________________________________________________________________________
function love.draw()
-- function
keyboard();
map_options();
object_options();
map_pos();
object_pos();
map_image();
object_image();
end
--______________________________________________________________________________________________
function keyboard()
-- sleep
love.timer.sleep(10);
-- keyboard
k_up=0; k_right=0; k_down=0; k_left=0; k_enter=0;
-- up, right, down, left
if love.keyboard.isDown("up") then k_up=1;end;
if love.keyboard.isDown("right") then k_right=1;end;
if love.keyboard.isDown("down") then k_down=1;end;
if love.keyboard.isDown("left") then k_left=1;end;
-- enter
if love.keyboard.isDown("return") then k_enter=1;end;
-- exit
if love.keyboard.isDown("escape") then os.exit();end;
---- text
--col=(250/1); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
--love.graphics.print("k_enter: "..k_enter,10,200,0,1,1);
-- image
col=(250/2); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
love.graphics.line(zx-zi,zy,zx+zi,zy); love.graphics.line(zx,zy-zi,zx,zy+zi);
end
--______________________________________________________________________________________________
function map_options()
if dost[1]==0 then dost[1]=1;-- dost >
-- map
map="-,1,=,=,=,=,=,2,-,-,"..
"1,4,-,-,-,-,-,3,2,-,"..
"|,-,-,-,<,>,-,-,|,-,"..
"3,2,p,-,-,-,-,1,4,-,"..
"-,3,=,=,=,=,=,4,-,-,";
-- len
ma_len=string.len(map); ma_len=(ma_len/2);
-- dim
ma_kl1=ma_len; ma_kl2=5; ma_x={}; ma_y={}; ma_rx={}; ma_ry={}; ma_x2={}; ma_y2={}; ma_x3={}; ma_y3={}; ma_tip={};
-- options
ma_rr=30; ma_xx=0; ma_yy=0; ma_aa=(ma_len/5)-1; ma_bb=ma_aa; map_x=0; map_y=0; map_x2=0; map_y2=0; ma_xx1=10000; ma_yy1=10000; ma_xx2=-10000; ma_yy2=-10000; ma_pl=0;
for d1=0,ma_kl1-1 do-- for >
-- options
ma_x[d1]={}; ma_y[d1]={}; ma_rx[d1]={}; ma_ry[d1]={}; ma_x2[d1]={}; ma_y2[d1]={}; ma_x3[d1]={}; ma_y3[d1]={}; ma_tip[d1]={};
for d2=0,ma_kl2-1 do-- for >
-- options
ma_x[d1][d2]=0; ma_y[d1][d2]=0; ma_x2[d1][d2]=0; ma_y2[d1][d2]=0; ma_x3[d1][d2]=0; ma_y3[d1][d2]=0; ma_rx[d1][d2]=0; ma_ry[d1][d2]=0; ma_tip[d1][d2]="";
if d2==0 then-- d2 >
-- tip
ma_tip[d1][d2]=string.sub(map,1+(d1*2),1+(d1*2));
-- tip - object
if ma_tip[d1][d2]=="p" then ma_pl=ma_pl+1;end;
-- pos.
ma_x[d1][d2]=100+ma_xx; ma_y[d1][d2]=100+ma_yy;
ma_xx=ma_xx+ma_rr; if d1==ma_bb then ma_bb=ma_bb+ma_aa+1; ma_xx=0; ma_yy=ma_yy+ma_rr; end;
-- pos. on screen
if ma_tip[d1][d2]=="=" or ma_tip[d1][d2]=="|" or ma_tip[d1][d2]=="+" then-- tip >
if ma_xx1>=ma_x[d1][d2] then ma_xx1=ma_x[d1][d2];
elseif ma_yy1>=ma_y[d1][d2] then ma_yy1=ma_y[d1][d2];
elseif ma_xx2<=ma_x[d1][d2] then ma_xx2=ma_x[d1][d2];
elseif ma_yy2<=ma_y[d1][d2] then ma_yy2=ma_y[d1][d2];
end;
end;-- tip <
else-- d2 >
-- pos.
ma_x[d1][d2]=ma_x[d1][0]; ma_y[d1][d2]=ma_y[d1][0];
-- tip
ma_tip[d1][d2]=ma_tip[d1][0];
end;-- d2 <
-- radius
if ma_tip[d1][d2]=="=" then-- tip >
if d2==0 then ma_rx[d1][d2]=(ma_rr/2); ma_ry[d1][d2]=5;else ma_rx[d1][d2]=2; ma_ry[d1][d2]=2;end;
elseif ma_tip[d1][d2]=="|" then-- tip >
if d2==0 then ma_rx[d1][d2]=5; ma_ry[d1][d2]=(ma_rr/2);else ma_rx[d1][d2]=2; ma_ry[d1][d2]=2;end;
elseif ma_tip[d1][d2]=="1" or ma_tip[d1][d2]=="2" or ma_tip[d1][d2]=="3" or ma_tip[d1][d2]=="4" then-- tip >
-- radius
ma_rx[d1][d2]=5; ma_ry[d1][d2]=5;
-- pos.
if d2==1 then if ma_tip[d1][d2]=="3" or ma_tip[d1][d2]=="4" then ma_x[d1][d2]=ma_x[d1][0]; ma_y[d1][d2]=ma_y[d1][0]-(ma_ry[d1][0]*2);end;
elseif d2==2 then if ma_tip[d1][d2]=="1" or ma_tip[d1][d2]=="3" then ma_x[d1][d2]=ma_x[d1][0]+(ma_rx[d1][0]*2); ma_y[d1][d2]=ma_y[d1][0];end;
elseif d2==3 then if ma_tip[d1][d2]=="1" or ma_tip[d1][d2]=="2" then ma_x[d1][d2]=ma_x[d1][0]; ma_y[d1][d2]=ma_y[d1][0]+(ma_ry[d1][0]*2);end;
elseif d2==4 then if ma_tip[d1][d2]=="2" or ma_tip[d1][d2]=="4" then ma_x[d1][d2]=ma_x[d1][0]-(ma_rx[d1][0]*2); ma_y[d1][d2]=ma_y[d1][0];end;
end;
elseif ma_tip[d1][d2]=="<" or ma_tip[d1][d2]==">" then-- tip >
if d2==0 then ma_rx[d1][d2]=(ma_rr/2); ma_ry[d1][d2]=5; else ma_rx[d1][d2]=2; ma_ry[d1][d2]=2;end;
end;-- tip <
end-- for <
end-- for <
-- options
ma_rastx=zx-ma_xx1; ma_rasty=zy-ma_yy1; ma_radx=((ma_xx2-ma_xx1)/2); ma_rady=((ma_yy2-ma_yy1)/2); ma_xx1=10000; ma_yy1=10000; ma_xx2=-10000; ma_yy2=-10000;
for d1=0,ma_kl1-1 do-- for >
for d2=0,ma_kl2-1 do-- for >
-- pos.
ma_x[d1][d2]=ma_x[d1][d2]+ma_rastx-ma_radx; ma_y[d1][d2]=ma_y[d1][d2]+ma_rasty-ma_rady;
-- pos. 2
ma_x2[d1][d2]=ma_x[d1][d2]; ma_y2[d1][d2]=ma_y[d1][d2];
end-- for <
end-- for <
end-- dost >
end
--______________________________________________________________________________________________
function map_pos()
for d1=0,ma_kl1-1 do-- for >
for d2=0,ma_kl2-1 do-- for >
-- pos.
ma_x[d1][d2]=ma_x2[d1][d2]+ma_x3[d1][d2]+(map_x+map_x2);
ma_y[d1][d2]=ma_y2[d1][d2]+ma_y3[d1][d2]+(map_y+map_y2);
end-- for <
end-- for <
end
--______________________________________________________________________________________________
function map_image()
-- color
col=(250/1); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
for d1=0,ma_kl1-1 do-- for >
for d2=0,ma_kl2-1 do-- for >
---- image
--love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
--love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
--love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
--love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
-- image
if d2==0 then-- d2 >
if ma_tip[d1][d2]=="=" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
elseif ma_tip[d1][d2]=="|" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
elseif ma_tip[d1][d2]=="1" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+(ma_rx[d1][d2]*3),ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+(ma_rx[d1][d2]*3),ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+(ma_ry[d1][d2]*3));
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+(ma_ry[d1][d2]*3));
elseif ma_tip[d1][d2]=="2" then-- tip >
love.graphics.line(ma_x[d1][d2]-(ma_rx[d1][d2]*3),ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-(ma_rx[d1][d2]*3),ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+(ma_ry[d1][d2]*3));
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+(ma_ry[d1][d2]*3));
elseif ma_tip[d1][d2]=="3" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+(ma_rx[d1][d2]*3),ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+(ma_rx[d1][d2]*3),ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-(ma_ry[d1][d2]*3),ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-(ma_ry[d1][d2]*3),ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
elseif ma_tip[d1][d2]=="4" then-- tip >
love.graphics.line(ma_x[d1][d2]-(ma_rx[d1][d2]*3),ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-(ma_rx[d1][d2]*3),ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-(ma_ry[d1][d2]*3),ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-(ma_ry[d1][d2]*3),ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
elseif ma_tip[d1][d2]=="<" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
elseif ma_tip[d1][d2]==">" then-- tip >
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]-ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
love.graphics.line(ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]-ma_ry[d1][d2],ma_x[d1][d2]+ma_rx[d1][d2],ma_y[d1][d2]+ma_ry[d1][d2]);
end;-- tip <
end;-- d2 <
end-- for <
end-- for <
---- text
--col=(250/1); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
--love.graphics.print("map: "..map,10,20,0,1,1);
--love.graphics.print("ma_len: "..ma_len,10,40,0,1,1);
end
--______________________________________________________________________________________________
function object_options()
if dost[2]==0 then dost[2]=1;-- dost >
-- dim
ob_kl1=ma_pl; ob_kl2=9; ob_x={}; ob_y={}; ob_rx={}; ob_ry={}; ob_tip={}; ob_kas={}; ob_x2={}; ob_y2={}; ob_x3={}; ob_y3={}; ob_dost={}; ob_my={}; ob_my2={}; ob_xx={}; ob_yy={}; ob_xx1={}; ob_yy1={}; ob_xx2={}; ob_yy2={}; ob_xx3={}; ob_yy3={}; ob_xx4={}; ob_yy4={}; ob_n={}; ob_s={}; ob_i1={}; ob_i2={};
-- options
ob_sky1=3; ob_sky2=0.1; ob_nakl=0; ob_rr=5;
for d1=0,ob_kl1-1 do-- for >
-- options
ob_x[d1]={}; ob_y[d1]={}; ob_rx[d1]={}; ob_ry[d1]={}; ob_tip[d1]={}; ob_kas[d1]={}; ob_x2[d1]={}; ob_y2[d1]={}; ob_x3[d1]={}; ob_y3[d1]={}; ob_dost[d1]={}; ob_my[d1]={}; ob_my2[d1]={}; ob_xx[d1]=0; ob_yy[d1]=0; ob_xx1[d1]=0; ob_yy1[d1]=0; ob_xx2[d1]=0; ob_yy2[d1]=0; ob_xx3[d1]=0; ob_yy3[d1]=0; ob_xx4[d1]=0; ob_yy4[d1]=0; ob_n[d1]=0; ob_s[d1]={}; ob_i1[d1]={}; ob_i2[d1]={};
for d2=0,ob_kl2-1 do-- for >
-- options
ob_x[d1][d2]=0; ob_y[d1][d2]=0; ob_rx[d1][d2]=0; ob_ry[d1][d2]=0; ob_tip[d1][d2]=0; ob_kas[d1][d2]=0; ob_x2[d1][d2]=0; ob_y2[d1][d2]=0; ob_x3[d1][d2]=0; ob_y3[d1][d2]=0; ob_dost[d1][d2]=0; ob_my[d1][d2]=0; ob_my2[d1][d2]=0; ob_s[d1][d2]=1; ob_i1[d1][d2]=0; ob_i2[d1][d2]=0;
end-- for <
end-- for <
-- options
ob_nn=0;
for d=0,ma_kl1-1 do-- for >
if ma_tip[d][0]=="p" then
-- pos.
ob_x[ob_nn][0]=ma_x[d][0]; ob_y[ob_nn][0]=ma_y[d][0]--+14;
-- tip
if ma_tip[d][0]=="p" then ob_tip[ob_nn][0]="player";
elseif ma_tip[d][0]=="o" then ob_tip[ob_nn][0]="object";
end;
ob_nn=ob_nn+1;
end;
end-- for <
for d1=0,ob_kl1-1 do-- for >
for d2=0,ob_kl2-1 do-- for >
-- tip
if d2>=1 then ob_tip[d1][d2]=ob_tip[d1][0];end;
-- pos. and radius
if d2==0 then ob_rx[d1][d2]=10; ob_ry[d1][d2]=10;
elseif d2==1 then ob_rx[d1][d2]=9-0; ob_ry[d1][d2]=5; ob_x[d1][d2]=ob_x[0][0]; ob_y[d1][d2]=ob_y[0][0]-(ob_ry[0][0]*1)+ob_ry[d1][d2];
elseif d2==2 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=9-0; ob_x[d1][d2]=ob_x[0][0]+(ob_rx[0][0]*1)-ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0];
elseif d2==3 then ob_rx[d1][d2]=9-0; ob_ry[d1][d2]=0; ob_x[d1][d2]=ob_x[0][0]; ob_y[d1][d2]=ob_y[0][0]+(ob_ry[0][0]*1)-ob_ry[d1][d2];
elseif d2==4 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=9-0; ob_x[d1][d2]=ob_x[0][0]-(ob_rx[0][0]*1)+ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0];
elseif d2==5 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=5; ob_x[d1][d2]=ob_x[0][0]+(ob_rx[0][0]*1)-ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0]-(ob_ry[0][0]*1)+ob_ry[d1][d2];
elseif d2==6 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=5; ob_x[d1][d2]=ob_x[0][0]+(ob_rx[0][0]*1)-ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0]+(ob_ry[0][0]*1)-ob_ry[d1][d2];
elseif d2==7 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=5; ob_x[d1][d2]=ob_x[0][0]-(ob_rx[0][0]*1)+ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0]+(ob_ry[0][0]*1)-ob_ry[d1][d2];
elseif d2==8 then ob_rx[d1][d2]=5; ob_ry[d1][d2]=5; ob_x[d1][d2]=ob_x[0][0]-(ob_rx[0][0]*1)+ob_rx[d1][d2]; ob_y[d1][d2]=ob_y[0][0]-(ob_ry[0][0]*1)+ob_ry[d1][d2];
end;
-- pos. 2
ob_x2[d1][d2]=ob_x[d1][d2]; ob_y2[d1][d2]=ob_y[d1][d2];
end-- for <
end-- for <
end-- dost <
col=(250/1); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
for d1=0,ob_kl1-1 do-- for >
-- keyboard
if k_right==1 then ob_xx[d1]=ob_x[d1][0]+(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0];end;
if k_left==1 then ob_xx[d1]=ob_x[d1][0]-(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0];end;
if k_up==1 then ob_xx[d1]=ob_x[d1][0]; ob_yy[d1]=ob_y[d1][0]-(ob_ry[d1][0]/1);end;
if k_down==1 then ob_xx[d1]=ob_x[d1][0]; ob_yy[d1]=ob_y[d1][0]+(ob_ry[d1][0]/1);end;
if k_up==1 and k_right==1 then ob_xx[d1]=ob_x[d1][0]+(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0]-(ob_rx[d1][0]/1);end;
if k_right==1 and k_down==1 then ob_xx[d1]=ob_x[d1][0]+(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0]+(ob_rx[d1][0]/1);end;
if k_down==1 and k_left==1 then ob_xx[d1]=ob_x[d1][0]-(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0]+(ob_rx[d1][0]/1);end;
if k_left==1 and k_up==1 then ob_xx[d1]=ob_x[d1][0]-(ob_rx[d1][0]/1); ob_yy[d1]=ob_y[d1][0]-(ob_rx[d1][0]/1);end;
end-- for <
-- map and object
for d1=0,ob_kl1-1 do-- for >
for d2=0,ob_kl2-1 do-- for >
-- options
ob_kas[d1][d2]=0;
end-- for <
end-- for <
-- map and object
for d3=0,ma_kl1-1 do-- for >
for d4=0,ma_kl2-1 do-- for >
if ma_tip[d3][d4]=="=" or ma_tip[d3][d4]=="|" or ma_tip[d3][d4]=="1" or ma_tip[d3][d4]=="2" or ma_tip[d3][d4]=="3" or ma_tip[d3][d4]=="4" or ma_tip[d3][d4]=="<" or ma_tip[d3][d4]==">" then-- tip >
for d1=0,ob_kl1-1 do-- for >
for d2=0,ob_kl2-1 do-- for >
if ob_x[d1][d2]+ob_rx[d1][d2]+ob_s[d1][d2]>=ma_x[d3][d4]-ma_rx[d3][d4] and ob_y[d1][d2]+ob_ry[d1][d2]+ob_s[d1][d2]+ob_my2[d1][d2]>=ma_y[d3][d4]-ma_ry[d3][d4] and ob_x[d1][d2]-ob_rx[d1][d2]-ob_s[d1][d2]<=ma_x[d3][d4]+ma_rx[d3][d4] and ob_y[d1][d2]-ob_ry[d1][d2]-ob_s[d1][d2]<=ma_y[d3][d4]+ma_ry[d3][d4] then-- kas >
-- kas
ob_kas[d1][d2]=1;
end;-- kas <
end-- for <
end-- for <
end;-- tip <
end-- for <
end-- for <
for d1=0,ob_kl1-1 do-- for >
for d2=0,ob_kl2-1 do-- for >
if ob_tip[d1][d2]=="player" then-- player >
-- keyboard
if ob_kas[d1][1]==1 then k_up=0;end;
if ob_kas[d1][2]==1 then k_right=0;end;
if ob_kas[d1][3]==1 then k_down=0;end;
if ob_kas[d1][4]==1 then k_left=0;end;
-- right
if ob_kas[d1][2]==0 then
if k_right==1 and k_up==0 and k_down==0 then
ob_x3[d1][d2]=ob_x3[d1][d2]+ob_s[d1][d2];
if d2==0 then
map_x=map_x-ob_s[d1][d2];
ob_nakl=2;
end;
end;
end;
-- left
if ob_kas[d1][4]==0 then
if k_left==1 and k_up==0 and k_down==0 then
ob_x3[d1][d2]=ob_x3[d1][d2]-ob_s[d1][d2];
if d2==0 then
map_x=map_x+ob_s[d1][d2];
ob_nakl=4;
end;
end;
end;
---- up
--if ob_kas[d1][1]==0 then
--if k_up==1 and k_right==0 and k_left==0 then
--ob_y3[d1][d2]=ob_y3[d1][d2]-ob_s[d1][d2];
--if d2==0 then map_y=map_y+ob_s[d1][d2];end;
--end;
--end;
--
---- down
--if ob_kas[d1][3]==0 then
--if k_down==1 and k_right==0 and k_left==0 then
--ob_y3[d1][d2]=ob_y3[d1][d2]+ob_s[d1][d2];
--if d2==0 then map_y=map_y-ob_s[d1][d2];end;
--end;
--end;
-- up and right
if ob_kas[d1][5]==0 then
if k_up==1 and k_right==1 then
ob_x3[d1][d2]=ob_x3[d1][d2]+ob_s[d1][d2];
--ob_y3[d1][d2]=ob_y3[d1][d2]-ob_s[d1][d2];
if d2==0 then
map_x=map_x-ob_s[d1][d2];
--map_y=map_y+ob_s[d1][d2];
ob_nakl=2;
end;
end;
end;
-- up and left
if ob_kas[d1][8]==0 then
if k_up==1 and k_left==1 then
ob_x3[d1][d2]=ob_x3[d1][d2]-ob_s[d1][d2];
--ob_y3[d1][d2]=ob_y3[d1][d2]-ob_s[d1][d2];
if d2==0 then
map_x=map_x+ob_s[d1][d2];
--map_y=map_y+ob_s[d1][d2];
ob_nakl=4;
end;
end;
end;
-- down and right
if ob_kas[d1][6]==0 then
if k_down==1 and k_right==1 then
ob_x3[d1][d2]=ob_x3[d1][d2]+ob_s[d1][d2];
--ob_y3[d1][d2]=ob_y3[d1][d2]+ob_s[d1][d2];
if d2==0 then
map_x=map_x-ob_s[d1][d2];
--map_y=map_y-ob_s[d1][d2];
ob_nakl=2;
end;
end;
end;
-- down and left
if ob_kas[d1][7]==0 then
if k_down==1 and k_left==1 then
ob_x3[d1][d2]=ob_x3[d1][d2]-ob_s[d1][d2];
--ob_y3[d1][d2]=ob_y3[d1][d2]+ob_s[d1][d2];
if d2==0 then
map_x=map_x+ob_s[d1][d2];
--map_y=map_y-ob_s[d1][d2];
ob_nakl=4;
end;
end;
end;
-- jump
if ob_dost[d1][d2]==0 then-- dost >
if k_enter==1 then ob_dost[d1][d2]=1; ob_my[d1][d2]=ob_sky1;end;
end;-- dost <
if ob_kas[d1][1]==1 then ob_my[d1][d2]=0;end;
if ob_kas[d1][3]==0 then
ob_y3[d1][d2]=ob_y3[d1][d2]-ob_my[d1][d2]+ob_my2[d1][d2]; ob_my2[d1][d2]=ob_my2[d1][d2]+ob_sky2;
else
ob_my[d1][d2]=0; ob_my2[d1][d2]=0; ob_dost[d1][d2]=0;
end;
-- angle
if k_right==0 and k_left==0 or ob_kas[d1][2]==1 or ob_kas[d1][4]==1 then ob_nakl=0;end;
end-- player <
-- image
if d2==0 then-- d2 >
-- pos.
ob_xx1[d1]=ob_x[d1][d2]+((ob_rx[d1][d2]+5)*math.sin((math.pi/4)+ob_n[d1]));
ob_yy1[d1]=ob_y[d1][d2]-((ob_ry[d1][d2]+5)*math.cos((math.pi/4)+ob_n[d1]));
ob_xx2[d1]=ob_x[d1][d2]+((ob_rx[d1][d2]+5)*math.sin(math.pi-(math.pi/4)+ob_n[d1]));
ob_yy2[d1]=ob_y[d1][d2]-((ob_ry[d1][d2]+5)*math.cos(math.pi-(math.pi/4)+ob_n[d1]));
ob_xx3[d1]=ob_x[d1][d2]+((ob_rx[d1][d2]+5)*math.sin(math.pi+(math.pi/4)+ob_n[d1]));
ob_yy3[d1]=ob_y[d1][d2]-((ob_ry[d1][d2]+5)*math.cos(math.pi+(math.pi/4)+ob_n[d1]));
ob_xx4[d1]=ob_x[d1][d2]+((ob_rx[d1][d2]+5)*math.sin((math.pi*2)-(math.pi/4)+ob_n[d1]));
ob_yy4[d1]=ob_y[d1][d2]-((ob_ry[d1][d2]+5)*math.cos((math.pi*2)-(math.pi/4)+ob_n[d1]));
-- angle
if ob_nakl==0 then ob_n[d1]=0;
elseif ob_nakl==2 then ob_n[d1]=ob_n[d1]+0.1;
elseif ob_nakl==4 then ob_n[d1]=ob_n[d1]-0.1;
end;
end;-- d2 <
-- text
--love.graphics.print(ob_kas[d1][d2],ob_x[d1][d2],ob_y[d1][d2],0,1,1);
--love.graphics.print(d2.." ".."ob_kas: "..ob_kas[d1][d2],10,20+(d2*20),0,1,1);
end-- for <
end-- for <
end
--______________________________________________________________________________________________
function object_pos()
for d1=0,ob_kl1-1 do-- for >
for d2=0,ob_kl2-1 do-- for >
-- pos.
ob_x[d1][d2]=ob_x2[d1][d2]+ob_x3[d1][d2]+(map_x+map_x2);
ob_y[d1][d2]=ob_y2[d1][d2]+ob_y3[d1][d2]+(map_y+map_y2);
end-- for <
end-- for <
end
--______________________________________________________________________________________________
function object_image()
col=(250/2); love.graphics.setColor((col*2),(col*1),(col*1),alpha);
for d1=0,ob_kl1-1 do-- for >
---- image - help
--love.graphics.line(ob_xx[d1]-ob_rr,ob_yy[d1]-ob_rr,ob_xx[d1]-ob_rr,ob_yy[d1]+ob_rr);
--love.graphics.line(ob_xx[d1]+ob_rr,ob_yy[d1]-ob_rr,ob_xx[d1]+ob_rr,ob_yy[d1]+ob_rr);
--love.graphics.line(ob_xx[d1]-ob_rr,ob_yy[d1]-ob_rr,ob_xx[d1]+ob_rr,ob_yy[d1]-ob_rr);
--love.graphics.line(ob_xx[d1]-ob_rr,ob_yy[d1]+ob_rr,ob_xx[d1]+ob_rr,ob_yy[d1]+ob_rr);
--if ob_my2[d1][0]==0 then
-- image
love.graphics.line(ob_xx1[d1],ob_yy1[d1],ob_xx2[d1],ob_yy2[d1]);
love.graphics.line(ob_xx2[d1],ob_yy2[d1],ob_xx3[d1],ob_yy3[d1]);
love.graphics.line(ob_xx3[d1],ob_yy3[d1],ob_xx4[d1],ob_yy4[d1]);
love.graphics.line(ob_xx4[d1],ob_yy4[d1],ob_xx1[d1],ob_yy1[d1]);
--end;
for d2=0,ob_kl2-1 do-- for >
--if d2==0 then-- d2 >
----if d2==0 or d2>=5 then-- d2 >
---- image
--love.graphics.line(ob_x[d1][d2]-ob_rx[d1][d2],ob_y[d1][d2]-ob_ry[d1][d2],ob_x[d1][d2]-ob_rx[d1][d2],ob_y[d1][d2]+ob_ry[d1][d2]);
--love.graphics.line(ob_x[d1][d2]+ob_rx[d1][d2],ob_y[d1][d2]-ob_ry[d1][d2],ob_x[d1][d2]+ob_rx[d1][d2],ob_y[d1][d2]+ob_ry[d1][d2]);
--love.graphics.line(ob_x[d1][d2]-ob_rx[d1][d2],ob_y[d1][d2]-ob_ry[d1][d2],ob_x[d1][d2]+ob_rx[d1][d2],ob_y[d1][d2]-ob_ry[d1][d2]);
--love.graphics.line(ob_x[d1][d2]-ob_rx[d1][d2],ob_y[d1][d2]+ob_ry[d1][d2],ob_x[d1][d2]+ob_rx[d1][d2],ob_y[d1][d2]+ob_ry[d1][d2]);
--end;-- d2 <
end-- for <
end-- for <
-- text
col=(250/1); love.graphics.setColor((col*1),(col*1),(col*1),alpha);
love.graphics.print("Press button: ".."Up, Right, Down, Left",10,scry-25,0,1,1);
love.graphics.print(" ".."Enter - jump",10,scry-10,0,1,1);
end
I'd prefer if you stick with smaller maps for now, so they hold on one screen. If your map is just slightly bigger than the screen, you might consider increasing the screen resolution.toaster468 wrote:Can I do the camera first? I would like to see the whole map and stuff. If not I am fine with making walls