Originally Posted by
catsrback321
Hi everyone,
I was just hoping someone could quickly explain pixel shift for me as the
Tutorial is out of date.
I need it to try and detect if I have stopped cutting a tree.
Thanks for reading.
edit:
This is pretty much what I've got so far
When working with pixel shift it is best to draw the box on SMART and use writeLns to debug it. Just play around with it until you get the best results (i.e. the box size can depend on zoom level).
Run this, login manually, press play, and then chop trees manually and see how accurate the debug output is:
Simba Code:
program pixelShift;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
function amIMoving(): boolean;
var
PSB: Tbox
begin
PSB := intToBox(260, 140, 310, 225);
smartImage.drawBox(PSB, false, clRed);
result := getPixelShift(PSB, 500) > 400;
if result then
writeln('We are moving')
else
writeln('We are not moving');
end;
begin
smartEnableDrawing := true;
setupSRL();
repeat
amIMoving();
until false;
end.