how to change layers for the same background scene - menu

I am making a menu for my cocos2d game. I would like to know if there is a way I can change layers within the same scene, similar to the pop and replace scene? I want to use this approach to keep the background unchanged as I navigate through the main menu hierarchy. How can I achieve this? I wouldn't mind another approach that would be more effective. Thanks.

As far as I know, there's no specific mechanism; just keep a reference to each layer inside your class, add them to the root scene, and show/hide them in the right moment.

Related

How to create a menu in a Qt3d scene

I want to build a game and therefore I would like to create a game menu. This menu should be in front of the scene, but not totally hide it, somehow sticking at the lens of the camera. My first idea was to create planes as buttons and position them at the same position as the nearplane and move it with the camera.
Is there also a easier way to do this?
(I also saw this, but I don't know how to do it without qml)
The way games make HUDs or menus is by (I think) using orthographic projection which makes it unnecessary to have them at the near-plane (and gets rid of some side effects). I didn't find anything nicer than this to describe orthographic projections.
So to implement this you would have two framegraph branches:
Draw your objects as normal
Draw your menu using orthographic projection
The elements of the menu could be planes like you said. You can add QObjectPickers to the planes and then react to the clicks.
I have implemented an example for the opposite thing: I created a framegraph that draws a background image behind the 3D scene. It needs adjusting for rescaling the window but should give you the general idea. You can find the project here.
(This is a related question regarding how to put normal Qt widgets like QPushButton in a Qt3D window.)

Slide Animation when switching to another scene in Godot Game Engine

I'm making a GUI using godot and I want transition animation when switching to another scene instead of instant change (No animation) when using get_tree().change_scene("MyOtherScene")
I am trying to mimic the ios feel when switching to another scene. Is there any function to accomplish this?
As i know both the function change_scene and change_scene_to cant be animated. But you can easily achieve the animation you need by using a common ancestor node and manage the transition there.
You can use an AnimationPlayer in both the transitioning scenes or a Tween node.

MapView - how to disable it and keep it swipeable to left and right fragments?

What I'm trying to do is to make an "untouchable map". I need to be it kind of a background instead of a real map, and I need to keep it swipeable to left and right fragments. How can I implement that? I've tried to put a layer overlay, but it doesn't work, it's keep focusing on the map when I try to swipe to other fragment. Maybe there is a "switch" for the XML part? Thanks!
map.getUiSettings().setAllGesturesEnabled(false); - this is exactly what I was looking for.

Draw flowchart on webpage as navigation menu

I need to draw a simple "flow chart" that is used to navigation on my site. What I have been doing now is that I've drawn this MSPaint, then I add pixelmaps so that it navigate the user to different pages according to where in the pictures he clicks.
What I also want is that the page the user is on, changes colour (for instance, if user clicks on step 3, he navigates to page 3, and the page 3 changes colour to to green).
What is the best method to implement this? SVG? Canvas? JavaScript? CSS?
All answers that can point me to the right direction is very welcome.
Your first mistake here, I'd say, is that you're using pixelmaps; for something as simple as this, I'd recommend just making it a pure HTML/CSS entity, then giving a .active class or some equivalent to whatever page you're actually on. This is the easiest way of doing things in my books, and it has the benefit of degrading gracefully if the image fails to load for whatever reason.
That said, if you don't want to do it that way and are really attached to the static image for whatever reason, you could have variants of that image where the specific step is highlighted, and display whatever image is appropriate for that page. That would accomplish what you're looking for, but I wouldn't recommend it--it's very heavy in terms of network usage when compared with an HTML solution.
Now, bear in mind you could draw this with canvas, but that seems like overkill in this situation if you're basically just drawing a navbar; if you were drawing a full flowchart already and just wanted to reuse that code, well, that would be a different story; but in this case, with static imagery, just use HTML--it's just faster and easier.

How do I make a circle move on events?

I'm pretty new to javafx so I'm trying to learn here so please be reasonable and don't dis away my question, I really appreciate any help at all, thanks!
I would like to know how I could move an object, let's say this circle on different events, like keypress or mouseclick, mousemove, whatever.
Circle circle = new Circle();
circle.setCenterX(100.0f);
circle.setCenterY(100.0f);
circle.setRadius(50.0f);
Do I need to use that KeyFrame thing I saw on the javafx site tutorial, or how does this work?
I would not have asked this here if I weren't feeling so lost, honestly.
So to make this clear: What is the code for moving objects that I created, by using events?
EDIT: By moving it I mean, press up key and it moves up by a few pixels, transform it maybe, with another key, or click somewhere on the scene and make it move there instantly or travel there with a certain speed. I don't have to redraw it like you need to with html5 canvas, I hope, right?
I don't have to redraw it like you need to with html5 canvas, I hope, right?
Not if you are using a standard JavaFX scene graph as opposed to a JavaFX canvas.
I would like to know how I could move an object, let's say this circle on different events, like keypress or mouseclick, mousemove, whatever
There are three ways to move a Shape:
You can adjust the shape's geometry (e.g. the centerX/centerY properties of a circle).
You can adjust the shape's layout (e.g. it's layoutX/layoutY properties).
You can adjust the shape's translation (e.g. it's translateX/translateY properties).
You can think of the layout as the home position for the object; i.e. where it should normally be in the context of it's parent group. You can think of it's translation transform as a temporary position for an object (often used when the object is being animated).
If you are using a layout pane such as a VBox or TilePane, then the layout pane will handle setting the layout co-ordinates of the child node for you. If you are using a simple Group or a plain Pane or Region, then you are responsible for setting the correct layout values for the child nodes.
To listen for events, set event handlers on Nodes or Scenes.
Here is a small sample app which demonstrates the above. It places the object to be moved inside a Group and modifies the position of the object within a Group in response to various events.

Resources