Documentation

CollisionGetCurrent

CollisionGetCurrent(id[],current[],&angle,&dist,&rect,&type)

Retrieves current collision from generated list.

Argument 'id[]': Entity ID.

Argument 'current[]':String to store colliding entity ID.

Argument '&angle':Variable to store angle.

Argument '&dist':Variable to store distance.

Argument '&rect':Variable to store rectangle that being colliding with.

Argument '&type':Variable to store type of rectangle that your colliding with.

True if a collision 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