Search code examples
godotgdscript

How do I add the sliding transitions in games such as Mega Man,The Legend of Zelda, and Metroid in my Godot game?


Sorry for the long question title. I'm pretty new here.

So my question is just as it the title above. I've tried mostly everything and have searched everywhere on the internet. Some pseudo leads I've tried were .linear_interpolate("my screen width" , "my screen height) or even examining other people's code studying it and maybe looking for a way to use it.

What I'm trying to accomplish is at least allowing the player to move around part of a larger level scroll the camera up to that bound of the level then scroll the camera using tween to another bound of the same scene and so on and so forth.

I don't really even need the whole thing with tweens all I need is a way to implement Camera2D bounds that allow me to implement a tween node to complete it.

Please help!


Solution

  • I don't really even need the whole thing with tweens all I need is a way to implement Camera2D bounds that allow me to implement a tween node to complete it.

    Limiting the Camera2D is the easy part. Either the camera does not follow the player at all (e.g. Zelda for NES), in which case you only need the tweens.

    Or…

    What I'm trying to accomplish is at least allowing the player to move around part of a larger level scroll the camera up to that bound of the level then scroll the camera using tween to another bound of the same scene and so on and so forth.

    The camera follows the player, until it reaches some limits… Which you can define with the properties limit_left, limit_top, limit_right and limit_bottom of the Camera2D. Set them to the bounds of the rectangle you want to limit the Camera2D to.


    I remind you that the Camera2D hitting the limit is not what should trigger the transition. What should trigger the transition is the player character hitting the limit… And you can handle that with Area2D since the player character - usually - is a physics object.

    So you would handle the signals of the Area2D and form there you update the camera limits, do any tweens you need, or whatever the case might be.