Meanwhile I rewrote my code, to see what happens if I load entire map , which is only 7500 sprites not to much to handle on my lover end pc (e3xxx,9800GTX) . And I'm moving it down like this :
Code:
for y:=0 to 299 do
for z:=0 to 3 do
for x:=0 to 19 do
begin
if BackGround[z,x,y] <> nil then
begin
BackGround[z,x,y].Y:=BackGround[z,x,y].Y+ScrollSpeed;
{ if BackGround[z,x,y].Y = 480 then
begin
BackGround[z,x,y].Dead;
BackGround[z,x,y]:=nil;
end; }
end;
end; // X loop
The map if fixed length for this test.
And behold... the problem is still there... on the other computer it has hickups... on new lines...I'm starting to wonder if my problem is this!
if BackGround[z,x,y] <> nil .... this takes longer to compare then say if I used numbers instead , and would use the Map array to see if there is something to move or not....
if map.Layer[0].Lines[y+MapOffset,x].ImageIndex <> 0 then
UPDATE : rewrote the code that moves everything like this :
Code:
if MapOffset > 0 then
begin
LineHeight:=LineHeight+ScrollSpeed;
// Background : Layers [0..3], Tiles [0..19], Lines [0..15] of TBackGround;
// Map.Record : Layers [0..3], Lines [0..Map.Length-1] , Tiles [0..19]
// move available sprites down
for y:=0 to 299 do
for z:=0 to 3 do
for x:=0 to 19 do
begin
if Map.Layer[z].Lines[y,x].ImageIndex <> 0 then
begin
BackGround[z,x,y].Y:=BackGround[z,x,y].Y+ScrollSpeed;
end;
end; // X loop
// screen scrolled down one line
if LineHeight = 32 then
begin
Dec(MapOffset,1);
LineHeight:=0;
end;
end // if Offset
else
begin
// Start again
RanOnce:=false;
end;
Same effect... I'm right now in the process of making it full screen, load this map automagically in full screen start scrolling and see what happens...without any components on the form
Update 3:
I've removed everything from my code, it is fullscreen, just loads the map file and scrolls trough it... it's not creating sprites or anything, it just creates them once and then moves them down...and still it sometimes is choppy on the other computer
Attached the code and source, note if you do want to start it, make sure the map file is on c:\ , if you press ESC during the scroll it will go back to windows.
Greetings
Robert
Bookmarks