Ok,
I've been thinking about it... and I came to a solution... I created a new procedure SyncAnim, which I right now manualy set using a button on my form... after DrawLevel, I execute it and all my tiles are synced. (later I plan to make the AnimStart variable be read from the map.anim_start[] 2d array.
Code:
procedure TMain.SyncAnim;
var i, j: Integer;
begin
for j:= 0 to 14 do
begin
for i:=0 to 19 do
begin
BackGround[i,j].AnimPos:=0;
end;
end;
end;
Right now I'm thinking about where to put this code , so that It would execute automagically , each time I go up and down on the level, or add a new tile....
I'm thinking about using another boolean variable
Code:
var something_happened : boolean;
and if I go up or down, or add a new tile , something_happened :=true ...
then on AsphyreDevice1Render after DrawLevel I add
Code:
if something_happened = true then
begin
SyncAnim;
Something_happened:=false;
end;
Right now i don't know if there is a better way to do this? I think this should not slow things down, since I'm not re-drawing twice, I just sync the animpos for all my tiles to 0 right now...
UPDATE :
changed my code to see how this works , but it seems this is not the right solution...during scrolling the animpos is always reset to 0, the game will move trough the world by 1 instead of 32 , which will make my water animation along with the rest of the animation still...
UPDATE2 :
Code:
if Update_Anim = true then
begin
DrawLevel;
SyncAnim;
Update_Anim:=false;
end;
Attached is my code with the executable, and a sample level02.map , next step if this is OK, to create a level test sorta thing... that scrolls trough the level smoothly.
I think I've got it this seems to work quiet good
Greetings
Robert
Bookmarks