I DID IT!!!!!!!!!!!!!!!!!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Code:
procedure TMain.TestExecute(Sender: TObject);
var x,y : integer;
new_line : boolean;
begin
if Offset < Map.map_length-14 then // -14 , Number of Tile Lines Drawn on Screen
begin
inc(Counter,1); // I'm using this to check if I've scrolled down one tile Height (32), if I did
if Counter = 32 then // then I'm increasing Offset by 1 and reseting Counter to 0, Offset is used to tell the new line of sprites which Line of TileData
begin // to read from the array
Inc(offset,1);
Counter:=0;
end;
for y:=0 to 15 do
begin
for x :=0 to 19 do
begin
BackGround[x,y].Y:=BackGround[x,y].Y-1;
BackGround[x,y].AnimPos:=AnimTable[y+Offset,x];
Edit2.Text:=formatfloat('####.##',AnimTable[y+Offset,x]);
if BackGround[x,y].Y = -32 then
begin
BackGround[x,y].Dead;
new_line := true;
end;
if new_line = true then
begin
BackGround[x,y]:= TBackGround.Create(SpriteEngine);
Edit9.Text:=inttostr(offset);
BackGround[x,y].ImageName:= Images.Item[map.Lines[offset+15,x].ImageIndex].Name;
if BackGround[x,y].PatternCount = 1 then
begin
BackGround[x,y].DoAnimate:=false;
end
else
begin
BackGround[x,y].AnimStart:=0;
BackGround[x,y].AnimCount:=map.Lines[offset+15,x].AnimCount;
BackGround[x,y].AnimSpeed:=map.Lines[offset+15,x].AnimSpeed;
BackGround[x,y].AnimPos:=AnimTable[y+Offset,x];
BackGround[x,y].DoAnimate:=true;
BackGround[x,y].AnimLooped:=true;
end;
BackGround[x,y].X:=x*32;
BackGround[x,y].Y:=480;
BackGround[x,y].Z:=1;
new_line:=false;
end;
end;
end;
end;
end;
Had it reversed on AnimTable[x,y]... [y+Offset,x] is correct... damn I'm getting lost on my arrays... anyway I'll clean up the code a bit... and post the full source with the exe here... I've tried it again just to make sure...it works...no matter what I do
I scroll down a bit ...wait....scroll again....or scroll completely to the end... the result...perfectly synced sprites the way I like em...
EDIT : something is still off... I'll need to check the code ...I'm getting lost in my arrays.... I'm not reading the animpos correctly from the array for the vertical line... will recheck
Greetings
Robert
Bookmarks