User Tools

Site Tools


en:examples:orx_scroll:collisions_with_scrollobjects

Collisions with ScrollObjects

Collisions can be tested in ScrollObjects using the OnCollide function. The incoming _poCollider is the ScrollObject that is colliding with this ScrollObject.

Also, the individual parts of both ScrollObjects that are colliding are available in the function.

void Enemy::OnCollide(ScrollObject *_poCollider,
	orxBODY_PART *_pstPart,
	orxBODY_PART *_pstColliderPart,
	const orxVECTOR &_rvPosition,
	const orxVECTOR &_rvNormal)
	{
		if (_poCollider == orxNULL) {
			return orxTRUE;
		}
 
		const orxSTRING colliderName = _poCollider->GetName();
		if (orxString_SearchString(colliderName, "Ship") != orxNULL) {
			const orxSTRING shipPartName = orxBody_GetPartName(_pstColliderPart);
			const orxSTRING enemyPartName = orxBody_GetPartName(_pstPart);
		}
 
	}
}
en/examples/orx_scroll/collisions_with_scrollobjects.txt · Last modified: 2024/11/06 05:00 (2 weeks ago) by sausage