jumping tutorial?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

vrld wrote:
zac352 wrote:Is anyone else wondering about this? >_>

Code: Select all

tile[map[y] [x]]
No, what's wrong with that?
Last time I tried that, Lua puked errors all over my console. :cry:
Hello, I am not dead.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: jumping tutorial?

Post by TechnoCat »

zac352 wrote:Is anyone else wondering about this? >_>

Code: Select all

tile[map[y] [x]]

Code: Select all

tile[ map[y][x] ]
Does that help?
tile[] is the array of prefab tile information (i presume images).
map[y][x] is the location of a tile and returns the prefab type.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: jumping tutorial?

Post by zac352 »

TechnoCat wrote:
zac352 wrote:Is anyone else wondering about this? >_>

Code: Select all

tile[map[y] [x]]

Code: Select all

tile[ map[y][x] ]
Does that help?
tile[] is the array of prefab tile information (i presume images).
map[y][x] is the location of a tile and returns the prefab type.
Oh, now I see. I hate whitespace. :|
Hello, I am not dead.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

My code so far:

Code: Select all

-- Office Man Stan --



function love.load()


	love.graphics.setCaption( "Office Man Stan" )

	stan_right = love.graphics.newImage( "P.PNG" )
	ground = love.graphics.newImage( "X.png" )
	stan_left = love.graphics.newImage( "P_left.png" )
	-- game variables
	
	player_X = 0
	player_Y = 0
	player_direction = "r"
	
	-- debug stuff delete later
	mouse_x = love.mouse.getX()
	mouse_y = love.mouse.getY()
	canDrawHUD = true
	-- background color
	--love.graphics.setBackgroundColor(104, 136, 248)

	-- map stuff
	
	-- map variables 
	map_x = 0
	map_y = 0
	map_w = 320
	map_h = 320
	map_display_w = 7
	map_display_h = 5
	tile_w = 32
	tile_h = 32
	
	map={ 
	 
   { 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0},
   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
    
}
	
	love.graphics.setFont(12)
	
	--tiles
	tile = {}
	for i=0,1 do
		tile[i] = love.graphics.newImage( "tile_image"..i..".png" )
	end
end

function draw_map()

   for y=1, map_display_h do
      for x=1, map_display_w do
         love.graphics.draw(tile[ map[y] [x] ], x*tile_w, y*tile_h)
      end
   end
end

function love.update(dt)
	
	mouse_x = love.mouse.getX()
	mouse_y = love.mouse.getY()
	
if love.keyboard.isDown( "left" ) then
	player_X = player_X - 1
	player_direction = "l"
	map_y = map_y-1
	map_x = math.max(map_x-1, 0)
	end
	
if love.keyboard.isDown( "right" ) then
	player_X = player_X + 1
	player_direction = "r"
	map_x = math.min(map_x+1, map_w-map_display_w)
	end

	
if love.keyboard.isDown( "down" ) then
	player_Y = player_Y + 1
	player_direction = "d"
	if map_y > map_h-map_display_h then map_y = map_h-map_display_h; end
	end
	
if love.keyboard.isDown( "up" ) then
	player_Y = player_Y - 1 
	player_direction = "u"
	if map_y < 0 then map_y = 0; end
	end
end

function love.draw()

if player_direction == "r" then
	love.graphics.draw( stan_right, player_X, player_Y )
	end

if player_direction == "l" then
	love.graphics.draw( stan_left, player_X, player_Y )
	end

if player_direction == "u" then
	love.graphics.draw( stan_right, player_X, player_Y )
	end
	
if player_direction == "d" then
	love.graphics.draw( stan_right, player_X, player_Y )
	end
	
	--love.graphics.draw( ground, 0, 260 )
	
	draw_map()
	
	love.graphics.print( player_X, 35, 10 ) 
	love.graphics.print( player_Y, 60, 10 )

	love.graphics.print( mouse_x, 190, 10)
	love.graphics.print( mouse_y, 210, 10)

end


User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

I see a couple small things around. Random comments follow:

The map has one extra '0' on the first line, and one comma at the end that doesn't go there.

You are doing 'up' and 'down' already... interesting. You will have to change 'up' soon :)

Remove the map_x and map_y parts. For example here:

Code: Select all

if love.keyboard.isDown( "left" ) then
   player_X = player_X - 1
   player_direction = "l"
   map_y = map_y-1
   map_x = math.max(map_x-1, 0)
   end
Leave it like this:

Code: Select all

if love.keyboard.isDown( "left" ) then
   player_X = player_X - 1
   player_direction = "l"
end
And then remove the declarations of map_x and map_y.


Also, make map_display_w and map_display_y calculated with map; move them below map= { ... and do:

Code: Select all

map = {
 -- all the 0s and 1s here, as before
}
map_display_w = #map[1]
map_display_h = #map 
That is all I could think about for now.

Bonus point: make draw_map() 'not draw nothing' when the tile inside map[x][y] is 0.
When I write def I mean function.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

Sweet! thanks, that last bit fixed my problem. OK, now what do you mean exactly in the bonus points?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

It isn't really important, if you already have a 'background' tile for the 0, and a 'foreground' tile for the 1s.

If you don't, then you can save some work if you just leave the 0s as 'empty space'; you don't draw any tiles on the cells with 0; you just leave the black background. So your player can use the other numbers (1,2,3) as platforms and walls and the 0 for 'empty air'.

But only if you want, nothing mandatory.
When I write def I mean function.
User avatar
toaster468
Citizen
Posts: 77
Joined: Sat Nov 06, 2010 11:30 pm

Re: jumping tutorial?

Post by toaster468 »

OK, well I don't think I need that just yet. So, how do I make my character spawn on top of the background on below it( I'm talking about layers)?

Also, whats the next step? :crazy:
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: jumping tutorial?

Post by kikito »

toaster468 wrote:So, how do I make my character spawn on top of the background on below it( I'm talking about layers)?
You just draw it after you draw the map, so it appears 'on top' of the map. If you draw him before, he will appear 'under' the map.
toaster468 wrote:Also, whats the next step? :crazy:
This one: Walls.
When I write def I mean function.
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: jumping tutorial?

Post by com_1 »

I do not know whether to post it here but look at my source code.

I think that the code of the map should look like this.
Just copy and paste into your project.

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests