Is it possible to change the position of the Z elevation camera?

0 favourites
  • 9 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • I am trying to use z elevation on a layout that is divided in two parts, one status window on the left side and a top-down view of the game to the right. The status window is on one layer with 0% parallax and the top down view is on another layer with 100% parallax. Both have an approximately equal width.

    Now I would like to use z elevation on the top down view to make it more interesting when scrolling. This works partially, but since the center of the top down view is not at the center of the layout, the objects aren't moving as expected when the top down view is scrolled. Instead of moving relative to the center of the top down view, they are moving relative to the center of the layout.

    Is it possible to set the position of the focus of the z elevation camera to a point other than the layout center?


  • There is a similar idea, Ashley said it's not planned..


    You can make your own z-elevation system with events - move and scale objects slightly depending on their relative angle and distance to the player.

    Or use DrawingCanvas to offset z-elevation sprites. See this demo I made:

  • I think I will try something similar to your DrawingCanvas example. That seems to be exactly what I need. Thanks!

  • dop2000, I tried to modify your example to use it in my project, but I can't get it to work. The sprites with no z elevation don't move at all, and those with a higher z elevation move in the wrong direction and the wrong distance too. I center the canvas on the screen, draw the objects and then move the canvas 400 pixels to the right. Could you take a look and see what I am doing wrong:!AmzKqSRFlvJqatvdb2fUk57-FzY?e=huqyw4


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have been doing some more experimenting. If the same events are triggered from a keypress, I get exactly the same result as before, but by adding a small wait, it works as expected:

    Wait 0 is not enough.

    According to the manual, pasting an object happens at the end of the tick, which I assume is why the wait solves the problem. However, I don't understand why dop2000's example is working and mine isn't.

  • Sorry, I don't really understand your project..

    Like I said, another option is to make your own z-elevation effect by changing scale and position of sprites. You may find it easier.

    Here is a demo:

  • Thanks for the new example. I might use that method instead.

    However, I would really like to understand why I can't get DrawingCanvas to work. I have attached a new example with only six sprites and two groups, one with z elevation and one without. There is no scrolling at the moment. How much the DrawingCanvas should be translated to the right side is controlled by the global variable Movement. Apart from that, I use exactly the same events as in your first example.

    For both groups, a Movement value of zero works as expected.

    For neither group, a Movement value other than zero works. There is no translation, and I don't understand why.!AmzKqSRFlvJqa9elDEImSJco0ho

  • Yeah, it only works if you add "Wait 0.1" before moving the canvas.

    I don't know why it doesn't require Wait in my file. Maybe the canvas size is much smaller and objects can be pasted on it in one tick.

  • Yes, I didn't understand that. Strange.

    However, I have now implemented your other solution using movement and scaling with events. This works as expected. The only problem now is that I have been mixing sprites and tilemaps on different elevations to create my map. Basically, I have used tilemaps for floors and sprites for walls, creatures and objects. With Construct 3's z elevation this wasn't a problem, but since tilemaps can't be scaled I don't think they can't be put on different elevations using events, at least not easily. Also, z-sorting tilemaps and sprites together seems to be difficult to achieve using events.

    Painting the tilemaps onto DrawingCanvases would solve the scaling issue, but not the z sorting issue. Z-sorting would be solved if DrawingCanvases could be put into the same family as sprites, and the family then being z sorted, but mixed families aren't allowed, as far as i know. I will have to think about this some more. Perhaps I will have to convert everyting to sprites instead.

    Anyway, thanks a lot for your help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)