Slide Animation when switching to another scene in Godot Game Engine - user-experience

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.

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.)

How to load textures from a spritesheet in Godot 3

I've just got started with Godot yesterday, and I'm starting a game. I drew a few spritesheets for it. It seems much more efficient to pack all of the frames of an animation into a single image file, right?
Anyway, in Godot I have an AnimatedSprite, who of course has a SpriteFrames property, or whatever it's called. I want to split my spritesheet up into multiple images so that I can use each image as a separate frame in the animation, but as far as I can see Godot provides no such feature. Is this the case?
I've been searching for an answer on the web for a while now, and I can't find anything relevant.
I'd be very surprised if I can't do this in Godot, since I can do it in just about every other game engine I've seen.
Thanks!
(Just to clarify, I want to (programmatically or otherwise,) split a spritesheet into multiple textures, within Godot.)
Click New SpriteFrames in the Frames property menu of the AnimatedSprite node. Now click on the just created SpriteFrames next to the name of the Frames property. Animation Frames window should appear.
Click this Add frames from a Sprite Sheet button. Select your spite sheet file, set grid sizes and finally select individual frames from that sprite sheet.
(This works for me in Godot v3.2.2)
As it says: "Sprite node that can use multiple textures for animation."
Source: http://docs.godotengine.org/en/3.0/classes/class_animatedsprite.html
What you are searching for is using normal Sprite(2D), and set regions for it if you are using AnimationPlayer at each frame.
Example: https://www.youtube.com/watch?v=IGHcscKpA7Y
If you want to do all programmically, you just have to set the sprite to Sprite(2D), and then:
func _ready():
set_region(true)
set_region_rect(Rect2(positionx,positiony,width,height))
but i guess using AnimationPlayer is better option.
This is not tested because i should be sleeping right now, but it should work.

Masking A Postprocess Unreal Engine 4.10

I was able to make a full screen blur with the depth of field post process which I want to use for the background both my pause menus and my in game HUD. The issue is that when I want to use it for my in game UI it needs to only be rendered under the HUD and not the entire screen. Is there any way the I can mask the post process to a UMG widget for simplicity?
The other solution that I thought of was to create a material and mask it off in the material. The problem is that PostProcessInput0 already has the blur applied and I can't use the SceneColor any more, so I don't have a way to get the original texture without the blur. Is there any way to do this?
Cheers.

how to change layers for the same background scene

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.

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