Just found another interesting question

  • MoseHas
    Likes 0

    Problem Description

    Hi there. I have just discovered another interesting question.

    In the episode “7.Spawning Pipes” of Flappy Bird project, we created the pipes and the gap between them.

        bottomPipe->setPosition( Point( topPipe->getPositionX(), topPipePositionY - ( Sprite::create( "Ball.png" )->getContentSize( ).height * PIPE_GAP ) - topPipe->getContentSize().height ) );

    And I just realized that there were something wrong.

    In my own project, I used a different Sprite name for my Faby, which is “Bird.png” instead of Ball.png, but I forgot to change the name in the code. Strange things happened.

    With my diagnosis, if the compiler could not find the file I had set up, the value of its size should be 0. However, it worked properly. I was so surprised.

    And then I tried to delete the sprite-get-size part and just :

        bottomPipe->setPosition( Point( topPipe->getPositionX(), topPipePositionY - topPipe->getContentSize().height ) );

    And then there was no gap between them! So my faby had no choice but bumped into the pipe and died.

     

    The question is, why the compiler could not find “Ball.png” and yet still could get its content size?

     

    Seems like I got tons of problems with my developing environment.


  • Sonar Systems admin
    Likes 0

    never had that before.


    This reply has been verified.
  • MoseHas
    Likes 0

    Looks like another unsolved problem.

    Thank you for replying!

  • Sonar Systems admin
    Likes 0

    is this still an issue?

  • barabasandras1
    Likes 0

    Do you use Eclipse?


    This reply has been verified.
  • MoseHas
    Likes 0

    Nope I used Visual Studio for editing.

    I guess it will be fixed if I clean up project and rebuild it by Eclipse. But I have’nt tried.

  • Sonar Systems admin
    Likes 0

    Try Eclipse and then let us know

Login to reply