Stop.cycling

From AGI Wiki
Jump to navigationJump to search

The stop.cycling command stops an object from cycling.

Syntax

stop.cycling(obj oA);

Remarks

The stop.cycling command disables screen object oA's cycling property. It does not change the cycling mode. When the cycling property is disabled, the object's cel will not change.

Use the start.cycling command to re-enable the cycling property.

Possible Errors

AGI does not check that object number oA is a valid screen object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.

Example

Code:
[ AGI doesn't automatically stop cycling objects
[ when they stop moving; we have to do it manually

#define egoX v38
#define egoY v39
#define oldEgoX v40
#define oldEgoY v41
#define oldEgoDir v42
#define neverAnimateEgo f30
#define alwaysAnimateEgo f31
#define STOPPED 0

get.posn(ego, egoX, egoY); [ get ego's current position

if(alwaysAnimateEgo) 
  {
  [ force cycling regardless of direction or motion type
  start.cycling(ego);
  }
else
  {
  if((egoDir == STOPPED || neverAnimateEgo)) 
    {
    [ if not moving, or no cycling is forced, stop cycling
    stop.cycling(ego);
    }
  else
    {
    [ check to see if ego has stopped moving
    if(egoDir == oldEgoDir && 
        egoX == oldEgoX && 
        egoY == oldEgoY) 
      {
      [ ego hasn't moved or changed direction since last cycle
      stop.cycling(ego);
      }
    else
      {
      [ ego is moving compared to last cycle; enable cycling
     start.cycling(ego);
      }
    }
  }
  
[ save ego motion data to compare in next cycle
oldEgoX = egoX;
oldEgoY = egoY;
oldEgoDir = egoDir;

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 70 (0x46 hex)

See Also

start.cycling