User Tools

Site Tools


en:examples:orx_scroll:delete_bodypart_from_scrollobject_by_name

Delete a BodyPart from a ScrollObject by Name

void Ship::DeleteBodyPartByName(const orxSTRING partName) {
    orxOBJECT *ship = this->GetOrxObject();
    orxBODY *body = orxOBJECT_GET_STRUCTURE(ship, BODY);
 
    for (orxBODY_PART *part = orxBody_GetNextPart(body, orxNULL); part; part = orxBody_GetNextPart(body, part)) {
        if (orxString_Compare(orxBody_GetPartName(part), partName) == 0) {
            orxBody_RemovePart(part);
        }
    }
}

en/examples/orx_scroll/delete_bodypart_from_scrollobject_by_name.txt · Last modified: 2018/02/14 00:47 (4 years ago) (external edit)