User Tools

Site Tools


en:examples:orx_scroll:collisions_with_scrollobjects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:examples:orx_scroll:collisions_with_scrollobjects [2022/07/14 05:55 (3 years ago)] – created sausageen:examples:orx_scroll:collisions_with_scrollobjects [2024/11/06 05:00 (5 months ago)] (current) – Probably GetName change is premature but saves me forgetting later sausage
Line 3: Line 3:
 Collisions can be tested in ScrollObjects using the ''OnCollide'' function. The incoming ''_poCollider'' is the ScrollObject that is colliding with ''this'' ScrollObject. Collisions can be tested in ScrollObjects using the ''OnCollide'' function. The incoming ''_poCollider'' is the ScrollObject that is colliding with ''this'' ScrollObject.
  
-Also, the parts of both ScrollObjects that are colliding are available in the function.+Also, the individual parts of both ScrollObjects that are colliding are available in the function.
  
 <code c> <code c>
-orxBOOL Enemy::OnCollide(ScrollObject *_poCollider,+void Enemy::OnCollide(ScrollObject *_poCollider,
  orxBODY_PART *_pstPart,  orxBODY_PART *_pstPart,
  orxBODY_PART *_pstColliderPart,  orxBODY_PART *_pstColliderPart,
Line 16: Line 16:
  }  }
  
- const orxSTRING colliderName = _poCollider->GetModelName();+ const orxSTRING colliderName = _poCollider->GetName();
  if (orxString_SearchString(colliderName, "Ship") != orxNULL) {  if (orxString_SearchString(colliderName, "Ship") != orxNULL) {
  const orxSTRING shipPartName = orxBody_GetPartName(_pstColliderPart);  const orxSTRING shipPartName = orxBody_GetPartName(_pstColliderPart);
Line 22: Line 22:
  }  }
  
- return orxTRUE; 
  }  }
 } }
 </code> </code>
en/examples/orx_scroll/collisions_with_scrollobjects.1657803307.txt.gz · Last modified: 2022/07/14 05:55 (3 years ago) by sausage