How to use 2 camera at the same time?

How do I use two camera at the same time on screen.I have a topdown game, and I want to add a minimap on bottom. So is there an option to use two camera’s at the same time.

Not exactly, no. The renderer used (PixiJS) only supports a single viewport. Each layer has a unique camera that van be scrolled or zoomed independently, but they are only going to display content on the same scene.

You could try building out your own logic using the rendertosprite extension, or ypu can try to do it via a lot of positionsl math as I have done in my ild example here: GDevelop Metroidvania Camera Example by Silver-Streak

It is going to be specific to your game though. So you will need to figure out the complexities.

1 Like

Yeah it’s hard to make mini maps like that, but you could make a object that is invis and when. Your collisioned with it it makes a minimap like screen, but it would probably take alot of positioning, Never tried it myself but that’s an idea

I remember one of the first versions of GDevelop used to include an example of simple 2D racing game for two players with splitted screen. I know that was before huge changes to the engine were made and that those projects are obsolete now… but it used to be so easy, what happened to that approach?

That was an entirely different renderer that supported multiple canvases/viewports. It’s not something PixiJS currently supports natively, or at least not the version currently in GDevelop.

PixiJS has a pretty huge overhaul over the next year or so, so maybe it becomes more viable then, however there’s no telling when those versions would get implemented in GDevelop.

3 Likes

I know this was awhile ago but Google brought me here today lol. I tried using the RenderToSprite extension and it does “kind of” work. In a 3D game I can basically screenshot a layer and paste it onto an invisible sprite (on the UI layer as not to get in the way of the screenshot) at the bottom corner. The only issue is every time it renders the layer, it keeps the old render and just pastes every render it has taken. Meaning when a sprite has moved it will show everywhere the sprite has been on the frames it takes the snapshots. Do you happen to know where that extension saves the layer snapshot so i can delete it in between the new renders? Or if that’s even possible?