Rect PopSpike::GetPhysicsBound(){ if(!isActive){ return Rect(0,0,0,0); } Rect rect; if(direction == Vec2(1,0)){ // left rect = Rect(0, TILE_SIZE*0.5f+phyHeight*0.5f, phyWidth, phyHeight); } else if(direction == Vec2(-1,0)){ // right rect = Rect(TILE_SIZE-phyWidth, TILE_SIZE*0.5f+phyHeight*0.5f, phyWidth, phyHeight); } else if(direction == Vec2(0, 1)){ // down rect = Rect(TILE_SIZE*0.5f-phyWidth*0.5f, 0, phyWidth, phyHeight); } else if(direction == Vec2(0, -1)){ // up rect = Rect(TILE_SIZE*0.5f-phyWidth*0.5f, TILE_SIZE-phyHeight, phyWidth, phyHeight); } return RectApplyAffineTransform(rect, getNodeToParentAffineTransform()); }
Rect Node::getBoundingBox() const { Rect rect = Rect(0, 0, _contentSize.width, _contentSize.height); return RectApplyAffineTransform(rect, getNodeToParentAffineTransform()); }
Rect HopeEnergy::GetPhysicsBound(){ Rect rect = Rect(-phyWidth*0.5f, -phyHeight*0.5f, phyWidth, phyHeight); return RectApplyAffineTransform(rect, getNodeToParentAffineTransform()); }
Rect MoMo::GetPhysicsBound(){ Rect rect; rect = Rect(TILE_SIZE*0.5f-phyWidth*0.5f, TILE_SIZE*0.5f-phyHeight*0.5f, phyWidth, phyHeight); return RectApplyAffineTransform(rect, getNodeToParentAffineTransform()); }