topdown RPG, camera must move only when character hits the edge.
Asked Answered
S

19

0

howdy, I'm a newbie, starting at gamedev and godot right now. sorry for the bad english, tho.
I'm following the devworm tutorials:
but I need a very specific camera feature. the camera needs to be fixed, like in old games, and move only when the character hits the border, so instead of making many tilemaps and linking them, I must do only one, avoiding some very unpratical scene "swapping" at all.
but the problem is I am a newbie, and don't know much about the engine, so I was trying to find a tutorial, template or even a code snippet can help in this case.

like, camera must be fixed inside the "rectangle", and move to another "rectangle" just in side of the original position. like in older games.

Skirmish answered 8/11, 2023 at 13:56 Comment(0)
J
0

Skirmish Not sure I understand. Do you mean like in the very first Zelda game where you touch the screen border or walk out of the screen and then level gets replaced by another screen and the camera is not moving at all? Or do you want to scroll with the player but just when the player is close to the screen border?

Jespersen answered 8/11, 2023 at 14:6 Comment(0)
S
0

Lots of ways to do this, but it is going to depend on how you've structured your game - that is, pick one 😉

For this game, each section had its own scene with an area that fired a signal when the player entered/exited the boundary, which enables the camera in that room. But that's essentially putting lots of scenes together to form a map (there's no need to have all the scenes loaded, but that's a different thing). It looked like this in the editor with all the scenes enabled:

Another could be just to move the camera X/Y +/- its height/width when the player leaves the visible area (e.g. +/- a width/height, hitting a boundary trigger, visibility notifier...), or just to never move it at all and move the world instead. I also wonder if you could adjust the drag_* properties of the camera and its configuration so it moves the screen dimensions when necessary? No code at all, just camera configuration.

Solvolysis answered 8/11, 2023 at 14:12 Comment(0)
S
0

Jespersen well... I want to scroll the camera on the map, only when the character hits the screen border.
I was thinking about make many scenes and "linking" them after that, but instead I want it to move on the map at only one scene.

a friend on discord send me this tutorial, but it's a little outdated (fr, it's from godot 2) but it's that what I mean, tho.

Skirmish answered 8/11, 2023 at 14:19 Comment(0)
S
0

Solvolysis can you explain it beter? I didn't understand exactly what you mean in the last part.

Skirmish answered 8/11, 2023 at 14:24 Comment(0)
S
1

you could use camera boundaries

Sculpt answered 8/11, 2023 at 14:33 Comment(0)
J
0

Skirmish So like in the old NES Zelda? Do you also want to scroll over to the next room or simply swap it?

I remember there being a HeartBeast tutorial recently about doing something like this.

Jespersen answered 8/11, 2023 at 14:33 Comment(0)
S
0

Sculpt the problem is... I'm a newbie, like, I started using godot last month and I know almost nothing about the program.
how do I do it?

Skirmish answered 8/11, 2023 at 14:36 Comment(0)
S
0

Jespersen thank you! I will see this. 🫰

Skirmish answered 8/11, 2023 at 14:37 Comment(0)
S
0

Jespersen and yes, is exactly like in the NES Zelda!

Skirmish answered 8/11, 2023 at 14:42 Comment(0)
S
0

Jespersen not exactly the way I tought, but until then, it worked. gracias. 🤝❤️

Skirmish answered 8/11, 2023 at 16:40 Comment(0)
S
0

Skirmish it wouldn’t be complicated if each level was a different scene, but it may take some coding and trial and error to do a map like that

Sculpt answered 8/11, 2023 at 19:6 Comment(0)
S
0

Sculpt I was trying to make only one "map", but my knowledge level is quite poor. so I'm doing this way, tho.

Skirmish answered 8/11, 2023 at 19:9 Comment(0)
J
0

Skirmish I was trying to make only one "map", but my knowledge level is quite poor. so I'm doing this way, tho.

May I ask why you want to have only one scene instead of going the probably easier route of making each screen its own scene? It seems like you are trying to make your life harder than it needs to be.

Jespersen answered 8/11, 2023 at 20:0 Comment(0)
S
0

Jespersen well, I'm unexperienced. for me, it looked easier at first.
I was thinking that changing the scene many times had a chance to make the game "laggy" or calling many commands maybe should crash, or be harder to do.
as I said, idk what's the best for me, or my project. sorry. It's my first try at all. 😞

Skirmish answered 8/11, 2023 at 20:32 Comment(0)
J
0

Skirmish Ah, sure. In that case don't worry about it and experiment. Making mistakes and getting into problems is the best way to learn because it means you are pushing your boundaries. But don't worry about performance as long as you are still a beginner.

Jespersen answered 8/11, 2023 at 20:54 Comment(0)
S
0

Jespersen sure thing, bro. well, I got more issues after all. XD
but it's part of the work. thank you btw.

Skirmish answered 8/11, 2023 at 20:55 Comment(0)
S
0

Skirmish you could always back your project up in a private github repo so you can always revert back if something breaks

Sculpt answered 8/11, 2023 at 23:18 Comment(0)
J
0

Sculpt For that you don't even need to push your code anywhere else. Just create a local repository and commit your changes. Now you can always go back to previous versions.

Jespersen answered 9/11, 2023 at 9:50 Comment(0)
S
0

Jespersen sometimes i just push the old files to a new folder inside the project, something like "old goodies".

Skirmish answered 9/11, 2023 at 13:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.