Skip to content

Commit 90693e9

Browse files
authored
Merge pull request #18 from BrandoZhang/master
Fix bug of set_bomb
2 parents 483ce12 + 00a10d1 commit 90693e9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

BombingAdventure/Classes/Entity.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ void Entity::bind_sprite(Sprite *sprite) {
2020
this->addChild(entity_sprite);
2121

2222
/* Reset the content size and fit the mid-points */
23-
Size entity_size = entity_sprite->getContentSize();
24-
entity_sprite->setPosition(Vec2(entity_size.width * 0.5f, entity_size.height * 0.5f));
25-
this->setContentSize(entity_size);
23+
24+
Size entity_size = entity_sprite->getContentSize();
25+
entity_sprite->setAnchorPoint(Vec2(0.5,0.5));
26+
this->setAnchorPoint(Vec2(0.5, 0.5));
27+
entity_sprite->setPosition(Vec2(entity_size.width * 0.5f, entity_size.height * 0.5f));
28+
this->setContentSize(entity_size);
29+
2630
}
2731
void Entity::reset_position() {
2832
if(get_sprite() != NULL) {

0 commit comments

Comments
 (0)