Looking for Cocos2D-X Popup Example for Score

General discussion about the R.U.B.E editor
Post Reply
jaxily
Posts: 8
Joined: Sat Jul 06, 2013 8:03 am

Looking for Cocos2D-X Popup Example for Score

Post by jaxily »

Hello, in the Cocos2d-X IOS example for the PlanetCuteRUBELayer demo, How do you make a popup show how many coins were collected? Any help is greatly appreciated! Thanks :D
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Looking for Cocos2D-X Popup Example for Score

Post by iforce2d »

I guess you could make a body that starts off-screen, with the popup dialog image on it. Then you could move the body onto the screen when it needs to be shown. Loading and displaying text for the numbers is not something that RUBE can help you with, but you could use RUBE to lay out the position for where the text should go.
jaxily
Posts: 8
Joined: Sat Jul 06, 2013 8:03 am

Re: Looking for Cocos2D-X Popup Example for Score

Post by jaxily »

Goal: To have 3 stars and a dialog box show up at the end of each level

Are you saying to have all the stars and dialog off screen and then add the text? If so how do I show the totals since this off screen approach is all using static images and text.

Thanks
jaxily
Posts: 8
Joined: Sat Jul 06, 2013 8:03 am

Re: Looking for Cocos2D-X Popup Example for Score

Post by jaxily »

Is there a full game example with Rube that has the levels and scores for each level just like cut the rope?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Looking for Cocos2D-X Popup Example for Score

Post by iforce2d »

Yes, you can move things around using SetTransform for the body that the dialog image is attached to. This would be in a separate layer to the main game world, so it can be made to stay in the same place on the screen even when the main game world moves. You have probably seen it already, but just in case I will give this link which shows an example of this using cocos2d: https://www.youtube.com/watch?v=JaHpmLN8DQA

Like I said, RUBE cannot help you with loading text, but cocos2d makes it very easy to make a sprite with some text on it. Then you can set the position and scale of that sprite based on something in the RUBE scene. In the past I have used a fixture to lay out the position for where I want the text sprite to go. The fixture does not get displayed, it is only used as a position marker.
jaxily
Posts: 8
Joined: Sat Jul 06, 2013 8:03 am

Re: Looking for Cocos2D-X Popup Example for Score

Post by jaxily »

That makes sense, would be great to add to the demo if possible. Thanks!
Post Reply