program Tutorial4;
var  
    time,i,delta,k,t: byte;
    x,y,z,ddx: integer = 0; 
	src,dst : pointer;   
	ds_xx, ds_yy, ds_ddx : integer;
	sine : incbin("data/sine.bin");
		@donotremove ds_ddx
	@donotremove ds_xx
	@donotremove ds_yy

@export "images/image2.flf" "images/image2.bin" 0
	data : incbin("images/image2.bin");

@spritecompiler "images/sprites.flf" "cat" 0 0 5 3


begin
	setscreenmode(mode_cga_320x200);
	time:=0;
	delta:=0;
	// Copy image to screen
	memcpy16(#data,screen_cga,8000);
	while(true) do
	begin
		for t:=0 to 6 do
		begin
			k:=t*44;
			y:=sine[(time+k)&255]/4 + 10;
			x:=sine[(time+64+delta+k)&255]/2+120;
			drawsprite_cga_cat(#data, screen_cga,x,y);
		end;
		
		time:=time+1;
		k:=time&3;
		if (k=2) then delta:=delta+1;
		waitforverticalblank();
		
	end;
end.
