This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:examples:objects:get_child_object_by_name [2018/05/12 09:49 (8 years ago)] – created sausage | en:examples:objects:get_child_object_by_name [2025/09/30 17:26 (12 days ago)] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Getting a Child Object by Name from a Parent Object ====== | ====== Getting a Child Object by Name from a Parent Object ====== | ||
- | Starting with a parent | + | Orx provides |
- | ===== Code ===== | + | ==== Paths ==== |
- | < | + | Paths are composed by object names separated by '' |
- | orxOBJECT* GetChildObjectFromScene(orxOBJECT *parentObject, orxSTRING childName) { | + | |
- | for (orxOBJECT *pstChild = orxObject_GetOwnedChild(parentObject); | + | |
- | pstChild; | + | |
- | pstChild = orxObject_GetOwnedSibling(pstChild)) | + | |
- | { | + | |
- | const orxSTRING name = orxObject_GetName(pstChild); | + | |
- | if (orxString_Compare(name, | + | |
- | return pstChild; | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | return orxNULL; | + | |
- | } | + | |
- | </ | + | |
+ | For example: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' |