Browse Source

Arrumando bug das bolas triplas explodindo antes da hora

capellaresumo 7 years ago
parent
commit
59788f5616

+ 1 - 2
Classes/BeginScene.cpp

@@ -36,8 +36,7 @@ Scene* BeginScene::createScene() {
 bool BeginScene::init() {
     //////////////////////////////
     // 1. super init first
-    if ( !Layer::init() )
-    {
+    if (!Layer::init()) {
         return false;
     }
     

+ 2 - 2
Classes/GameScene.cpp

@@ -215,8 +215,8 @@ void GameScene::caseBallCore (Node *core, Node *ball) {
     core->runAction(scaleBy);
     auto audio = CocosDenshion::SimpleAudioEngine::getInstance();
     audio->playEffect("win.wav");
+    
     auto callbackRotate = CallFunc::create([=](){
-        removeBallsAndPowersUP();
         level = level + 1;
         auto menu_item_start = MenuItemFont::create(MSG_NEXT_LEVEL, CC_CALLBACK_1(GameScene::NextLevel, this));
         menu_item_start->setFontNameObj(FONT);
@@ -229,7 +229,7 @@ void GameScene::caseBallCore (Node *core, Node *ball) {
     // create a sequence with the actions and callbacks
     auto seq = Sequence::create(scaleBy, callbackRotate, nullptr);
     core->runAction(seq);
-    ball->removeFromParentAndCleanup(true);
+    removeBallsAndPowersUP();
 }
 
 void GameScene::caseSaveLevel(Node *powerup_ball) {

+ 7 - 3
Classes/GameScene/Ball.cpp

@@ -29,9 +29,6 @@ bool Ball::init() {
     physicsBody->setLinearDamping(0.0);
     physicsBody->setMass(1000.0f);
     
-    physicsBody->setContactTestBitmask(0xFFFFFFFF);
-    physicsBody->setGroup(-5);
-    
     addComponent(physicsBody);
     setTag(BALL_TAG);
     
@@ -59,3 +56,10 @@ void Ball::resetNormalball() {
     ball_draw->setVisible(true);
     superball_draw->setVisible(false);
 }
+
+void Ball::setPosition(float x, float y) {
+    Node::setPosition(x, y);
+    auto physicsBody = getPhysicsBody();
+    physicsBody->setContactTestBitmask(0xFFFFFFFF);
+    physicsBody->setGroup(-5);
+}

+ 1 - 0
Classes/GameScene/Ball.h

@@ -11,6 +11,7 @@
 class Ball : public cocos2d::Node {
     public:
         virtual bool init();
+        virtual void setPosition(float x, float y);
         void throwBall();
         CREATE_FUNC(Ball);
         bool superball;

+ 1 - 1
Classes/params.h

@@ -46,7 +46,7 @@
 
 // Probabilities
 #define DROP_LEVEL_SAVE 0.035
-#define DROP_TRIPLE_BALL 0.06 // Aumenta com o tempo
+#define DROP_TRIPLE_BALL 1//0.06 // Aumenta com o tempo
 #define DROP_PADDLE_BALL 0.07
 #define DROP_SUPER_BALL 0.04
 

BIN
proj.ios_mac/RedCore.xcodeproj/project.xcworkspace/xcuserdata/capella.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 3
proj.ios_mac/RedCore.xcodeproj/xcuserdata/capella.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -90,11 +90,11 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "../Classes/GameScene.cpp"
-            timestampString = "518887459.470865"
+            timestampString = "518888697.258506"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "350"
-            endingLineNumber = "350"
+            startingLineNumber = "338"
+            endingLineNumber = "338"
             landmarkName = "GameScene::caseSuperBall(Node *powerup_ball)"
             landmarkType = "7">
          </BreakpointContent>