heres the code i tested with andorra
Code:
//cam stuff
cx := camx div 16;
cy := camy div 16;
cxl := cx+blockw;
cyl := cy+blockh;
//update grass
updGrass := updGrass+1;
if updGrass > 60*2 then begin
updGrass := 0;
updateGrass(false);
end;
//draw blocks
for y := cy to cyl do begin
for x := cx to cxl do begin
if not(blocks[x,y,0] = 0) then begin
images.Items[1].Draw(dxdraw, (x*16)-camx, (y*16)-camy, blocks[x,y,0]-1);
blockRect.Left := (x*16)-camx;
blockRect.Top := (y*16)-camy;
blockRect.Right := blockRect.Left+16;
blockRect.Bottom := blockRect.Top+16;
images.Items[5].DrawAlpha(dxdraw, blockRect, 0, blocks[x,y,1]);
end;
end;
end;
its a tile based game yes, and it draws first all the tiles, then bllack boxes with various alpha levels to create shadows
i got a solution to some of my problems, i kinda cached all the blocks in an array with 15 diffrent light values instead of drawing alpha blended images over them. but i still need to alpha blend the sky, becus the dude will be walking there and i want him to be dark and also there will be water so i definatly need it
and here screenshot of my game (this is done in delphix)
Bookmarks