Camera movement when player reaches an area


#1

Hello,

suppose I create a topdown game that has a very large map and I would create each section in a separate scene.

How can I make it so that as soon as the player stands at one of the (camera) “edges” of the section (he reaches an area), that the camera moves to the next section like in Zelda?

This is independent of whether the player wants to walk to the right/left/top or even down.


#2

:thinking: I believe @Entropy404 was working on an extension for this


#3

And without an extension, how to do it?


#4

Adding sprites to act as zones then limit the camera to the zone that player is in collision, like in metroidvania style games, i think @Silver-Streak has some sample of that with a minimap

Here is a game here you can check i don’t know if is this what you want to achieve in the Red Laura game the player can move through zones and the camera is limited to the zone that Laura is. If you want i can share some of the event to do it.


#5

@UlisesFreitas
Thanks, but it’s not how the camera moves like in zelda game (or the camera moving is very fast).


#6

Take a look here https://www.youtube.com/watch?v=J7enVnNQPnU maybe helps.


#7

@UlisesFreitas
Have found this video too, but this is only if the “map” is big (one scene).
Mine isn’t it (because i will have more scenes)!


#8

You will not be able to do the type of transition you are attempting (Zelda-overworld room “sliding”) for different scenes.

However, as UlisesFreitas mentioned, you can probably do this with objects that act as a “Room” for your camera, then set up an event whenever you transition from one to the other. You can see an example of the basic idea here: https://silver-streak.itch.io/gd5-metroid-camera


#9

If you use External Layouts for each of the “level segments” in your larger meta-level, then you could develop logic to load the external layout for the next scene at the current offset, then slide the camera over, and then remove all the objects from the previous scene.
If you are a beginner then this is probably a lot to learn (I’m not sure anyone has done this, but I’m convinced it’s the best way to do an open world game) and you should consider whether you really need to slide transition between scenes.


#10

@UlisesFreitas
I would love to take you up on your offer of sharing the events.:blush:
Could you do this with scenes and not with only one big map?:heart_eyes:

@krunkster
I know i’ve to learn a lot of gdevelop first… but the idea of loading the next scene on an current offset to slide the camera - like in zelda - to the new area is interesting.:wink:


#11

I’ve never played zelda, but I assume if you are just looking to smoothly transition the camera you could have a “camera center” object, and have the camera center on it, and add a force when the player goes into a new level