Cocos2dx Context Menu

Hello!

What would be the best way to make a simple “menu”/“toolbar” that swipes from the top when a swipe event occurs?
I want something like this:

When You swipe down the menu will show up, when You swipe up the menu hides. The menu will contain some sprites that will help You in navigation. Any ideas? :smile:

You could implement the menu as a layer (it will be easier to transfer data between the menu and the game) or you could make it a scene and do pushscene() to open it and popscene() to close it.

Yes, first idea is you want to get to the new eventDispatcher and to the swipe gesture.
Then load your Sprites, position these and assign to a touchEvent.

To get it actually “sliding” out, you will need to create a moveTo action or something similar for the Y point.
These are just some ideas, that you’ve asked for.

Here are some topics on that:

http://discuss.cocos2d-x.org/t/cclayer-with-gestures-tap-double-tap-swipe-supported-ios-android-should-also-work/5823/3

@SonarSystems has this video tutorial https://www.youtube.com/watch?v=aof2QOab56M

1 Like

If you make it a scene you’ll have to use TransitionSlideInT although I’m not sure how you would do the slide out as there’s no transition for that. Maybe you can make your own :wink:

Check this out CCLayer with gestures (TAP,DOUBLE TAP, SWIPE supported) IOS (Android should also work)

Almost forgot about this… check my repo:

Now its 2.2.2 (not updated to 3.6), but go ahead and adapt it.
The logic is the same here. Check how the menu buttons slide in, when you start the game. It does exactly what you try to do, only with other sprites.

Also included in this demo:

  • Parallax scrolling
  • Endless scrolling background
  • Sprite positioning
  • Sprite rotation
  • Sprite movement
  • Sound effects
  • Background music loop
  • Bitmap fonts usage

Hope that gives you a better understanding. @i__d__k As i said before, this could be done with the new eventDispatcher and simple sprite movement to create the “slide” animation.

Cheers

Yes if it’s implemented as a layer, but not if it’s implemented as a scene because there can only be one running scene at a time.
It’s definitely a better idea to use a layer :+1:

I see the the project is made using windows.

Could you share the game with us… !!
or may be if you have and apk with you, that would be great. :wink:

I would like to check the app in first hand, then I will upgrade it to lastest version of cocos2d-x :smile:

@pabitrapadhy Did you even read above the pictures? :smile:

Could you share the game with us

Again, the demo is located at:

It would be really great if you update it to 3.6 and post back here.
This could be maybe a good demo for the guide as well.

In fact I did and thought something fascinating would be there in the repo.
I tried to run it in the latest version and I have an android build.

But, I find nothing related to what the originial post is seeking help for.
Just scene transitions, normal sprites, sound effects.

Where is the swipe down gesture of the menu ?
do you have it in your repo… ??

@pabitrapadhy Hmm…interesting.

But, I find nothing related to what the originial post is seeking help for.
Just scene transitions, normal sprites, sound effects.

Yes, just all these little things together.

In fact I did and thought something fascinating would be there in the repo.
I tried to run it in the latest version and…

Great! How is the performance with your Android?

Where is the swipe down gesture of the menu ?
do you have it in your repo… ??

Be more polite next time! I don’t owe you nothing.

@sonarsystems made this beautiful example of the swipe gestures here:

Ofcourse you dont owe me nothing because what you had in that repo is simply NOTHING.
ha ha… :smile:

I have been asking politely only.

May be you should keep your head calm and listen to others, I was not blaming you.
Just simply asking, as you are posting under the question, the answers should have some relation, other than that we have Programmers Guide ( if you have ever heard of it) to enrich our knowledge.

Anyway, thanks for contributing to the community.

@pabitrapadhy Had a bad day? Why are you trolling?

Ofcourse you dont owe me nothing because what you had in that repo is simply NOTHING.

What? Ok, please then go ahead and make a better demo, then share it with us. Please. I am sorry nobody wrote that game for you that you’re trying to write for one year now. That’s the real joke here. What are you talking about?

we have Programmers Guide ( if you have ever heard of it)

Currently, i am working with @slackmoehrle and @ricardo on it, writing new articles and redesigning the UI. 3.7 is going to be awesome, you have my word on this.

Stay productive and have a good day!

Well good luck then @Eschmelax

All we both are trying to make cocos2d-x better and making the community more productive.
we should put off this.

Not needed really of that introduction though. :smile:
We both are doing our parts.

could find my handle over there.
Have a good day ahead.