Documentation

CollisionCalculate

CollisionCalculate(id[],rect,type)

Generate a list of entities it's colliding with.

Argument 'id[]':Entity ID

Argument 'rect':Collision Rectangle your wish to check. -1 for all.

Argument 'type':Not Used.

True if a collisions exist.

Example Code

	if ( CollisionCalculate() )
	{
		new current[64];
		new angle;
		new dist;
		new rect;
		new _STATE:type;
		while ( CollisionGetCurrent(SELF, current, angle, dist, rect, type) )
		{
			if ( type == TYPE_AWAKING )
			{
				EntityPublicFunction(current, "Awaking", "sn", selfid, rect);
			}
			else if ( type == TYPE_ENEMY || type == TYPE_DOOR )
			{
				EntityPublicFunction(current, "Hit", "snnnnnn", selfid, angle, dist, APLAYER, 0, dx,dy, rect);
			}
			else if ( type == TYPE_TRANSPORT )
			{
				if ( EntityPublicFunction(current, "MovePlayer", "sn", selfid, _dir_) )
				{
					_state_ = STANDING;
				}
			}
			else if ( type == TYPE_PUSHABLE && _state_ == PUSHING )
			{
				EntityPublicFunction(current, "Push", "snn", selfid, rect, angle);
			}
			else if ( type == TYPE_SWITCH )
			{
				EntityPublicFunction(current, "Pressed", "s", selfid);
			}
			else if ( type == TYPE_ITEM )
			{
				if ( EntityPublicFunction(current, "Pickup", "s", selfid) )
				{
					_state_ = LIFTING;
				}
			}
		}
	}
	

Comments

Comming Soon