marpis
2009-12-07 09:32:41
[#40] Animation.SCAR
Includes functions that help you detect wheter some objects on screen are moving!
[php]
//—————————————————————–//
//– Scar Standard Resource Library –//
//– ยป Animation Routines –//
//—————————————————————–//
// * Function PixelShiftMulti(B: TBoxArray; T: Integer): TIntegerArray; // * by marpis
// * Function PixelShift(B: TBox; Time: Integer): Integer; // * by marpis
// * Function AnimatingMulti(B: TBoxArray; Time, MinCount: Integer): TBooleanArray; // * by marpis
// * Function Animating(B: TBox; Time, MinCount: Integer): Boolean; // * by marpis
// * Function IsMoving: Boolean; // * by marpis
[/php]
PixelShift(B: TBox; Time: Integer): Integer;
- Returns the number of pixels that have changed color in "Time"-milliseconds.
- Usage: Detect if many colors have changed in box "B" in "Time"-milliseconds.
- Example:
Function Animating(B: TBox; Time, MinCount: Integer): Boolean;
- Returns True if there is a constant animation in box B in "Time"-milliseconds and at least "MinCount"-pixels change every 50 milliseconds. The 50ms is built in the function, I think it's the best frequency.
- Usage: Detect wheter an object is an NPC/otherwise animating.
Function IsMoving: Boolean;
The old one didn't work, so here's a fixed one! :)
—
The "Multi"-versions of the functions are found in Animation.SCAR, but I made this tutorial userfriendly so I didn't explain those. They're bit more complicated.
Enjoy! :)
Includes functions that help you detect wheter some objects on screen are moving!
[php]
//—————————————————————–//
//– Scar Standard Resource Library –//
//– ยป Animation Routines –//
//—————————————————————–//
// * Function PixelShiftMulti(B: TBoxArray; T: Integer): TIntegerArray; // * by marpis
// * Function PixelShift(B: TBox; Time: Integer): Integer; // * by marpis
// * Function AnimatingMulti(B: TBoxArray; Time, MinCount: Integer): TBooleanArray; // * by marpis
// * Function Animating(B: TBox; Time, MinCount: Integer): Boolean; // * by marpis
// * Function IsMoving: Boolean; // * by marpis
[/php]
PixelShift(B: TBox; Time: Integer): Integer;
- Returns the number of pixels that have changed color in "Time"-milliseconds.
- Usage: Detect if many colors have changed in box "B" in "Time"-milliseconds.
- Example:
B := GetTPABounds(TPA);
If (PixelShift(B, 200) > 10) Then
WriteLn('Over 10 pixels in box "B" have changed color in 200ms!');
Function Animating(B: TBox; Time, MinCount: Integer): Boolean;
- Returns True if there is a constant animation in box B in "Time"-milliseconds and at least "MinCount"-pixels change every 50 milliseconds. The 50ms is built in the function, I think it's the best frequency.
- Usage: Detect wheter an object is an NPC/otherwise animating.
Function IsMoving: Boolean;
The old one didn't work, so here's a fixed one! :)
—
The "Multi"-versions of the functions are found in Animation.SCAR, but I made this tutorial userfriendly so I didn't explain those. They're bit more complicated.
Enjoy! :)