Hi guys,
I am new to GDevelop’s world and this is my first post. I tried to look for an answer to my question but could not find one.
I am trying to make an “expanding tiled background” in a 8-direction top-down enviroment based on the position of a moving object (player-controlled sprite).
To better explain what I am really trying to do I am posting the following image:
The circle is the moving object and the square tile is a tiled sprite acting as the floor.
I would like to expand the floor (background tiles) towards the direction the circle is moving in (in this case towards the top-left corner) while dropping the ones outside the camera (the no longer visible bottom right corner). Well I guess “deleting” the tile outside the camera view is secondary, just to avoid wasting resources.
I tried changing the floor size in relation to the camera’s width and height, and it seems to be working but only going down and right, so this doesn’t seem to be the right way to go.
For the time being the layout is very simple. I have 3 layers:
“BG” for the floor
“Base layer” for the moving circle
“Background color”
1 tiled sprite (Floor), and 1 sprite (Obj - the circle)
And the events (sorry I couldn’t post the second image this being my first post):
Always: Center camera position on Obj (the red circle);
Always: Change the X position of camera (layer: “BG”): set to CameraX();
Always: Change the Y position of camera (layer: “BG”): set to CameraY();
*Just messing around with size and cameras:
Always: Change the size of Floor set to CameraX(“BG”)xCameraY(“BG”)
Does anyone know how I could make this happen, or know perhaps some function or plug-in that I could use to achieve what I want the game to do?
Thank you in advance for your help.