How do i make scenes seamlessly wrap around like the game Yume Nikki? Essentialy centering the player on camera while they warp from one side to another, on a top down perspective.
I’m not sur about your request, can you share an image/video to help me (us) to understand.
The most simpy solution to center the camera is to add an action:
for every frame → “center camera on object” and the object is the player.
something like this. notice how the objects loop continuously both horizontally and vertically, while maintaining the camera centered on the player. the player gets teleported to the opposite locations, “wrapping” the scene, while staying centered
yes i am aware on how to center the camera on an object, but i am using an extension that allows for room-based camera movement, locking the camera between rooms. however, i want to make it so that if the player goes to the right side, for example, they teleport to the left side, wrapping the screen. however the camera stops following the player at the room border, meaning the effect i showed in the video is impossible.
this image shows the player at the edge of the right side of the screen. the camera stopped following them already, because the room ends there.i was hoping there is a way to seamlessly wrap the player from right to left or from top to bottom using a way where the camera still follows them, without having to stop at the borders
There’s an “Enforce camera boundaries” action you can use alongside the “Center the camera on an object” one. That’ll allow the player to reach the edge of the room like in your screenshot.
As for teleporting the player from one side to the other, there’s a “Screen wrap” extension you can use: Screen Wrap [GDevelop wiki] Or you can try building it yourself using the Asteroids example: Asteroids [GDevelop wiki]
If you want to build your own mechanics to wrap the room eternally, this would be the full approach:
As an example for the horizontal scene wrap, you’d need to make sure that whenever the player moves across a certain line it moves at exactly the same spot where it stood but on the other side of the room. So you need to move it by exactly the room width. Also to make sure that it looks that it looks like the room loops eternally and you don’t see the black space where the room ends, you would need to create the room background four times in a row, perfectly lined up to each other!
So it would look something like this:
Whenever player reaches a certain x on the left side, you reset it the player back with the exact room width. Since everything is identical, it will look like the room just keeps scrolling.
Then you need to do the same for the y movement, resulting in at least 12 room sprites lined unto each other:
I might add that if you have smooth camera movement or something similar, you will have to save the offset between the camera and the player as well, and reset the offset with the players new coordinates after a jump. Otherwise the camera will smoothly move to the new position instead of staying on the player like it would without a jump and it will become obvious that you made a jump.
You might also need to fine tune, the transition between each jump to make it look fluid.
Instead of that, you could also make the room floor a tileable sprite on a separate layer. Then you just change the room sprite’s image offset coordinates in relation to the player (or camera) position, and also make the objects reappear on the other side when the player walks past them. (e.g. for a room of a size of 1000 pixels: if object.Y() < Player.Y()-500 then object.Y() = Object.Y() + 1000)
oooo that sounds good, i’ll try it out, thanks a ton!!
No problem! For the manual setup of it I also updated the images, because you’ll need 12 room sprites for it to work.
I was trying to figure out how to do it with layers and cameras. I don’t have enough knowledge yet. It seems like you can move between cameras and layers. Do a sort of moving side-by-side split screen when transitioning and only loop objects when they cross the boundary. IDK.
easiest method would be to use a tileable sprite on a separate layer for the ground still.
Here I made the endless loop for the x axis in this example.
You can use it for reference.
It’s a 640x440 size room sprite, and a 320x220 game resolution.
You can also drag the yellow objects around and place them whereever you want and you’ll see that the repeating room works with the changed positiion as well.
above comment was meant as a reply to you actually lol
Hey! Your “demo” file seems extremely helpful. Could you resend it? I’ve been looking for something like this for ages. That old one is expired