How do I get value of distance from top of viewport?

0 favourites
  • 3 posts
From the Asset Store
Check preview, download and add value to your games.
  • How do I change a value based on distance from top of viewport (or top of screen)? I want to know the sprites X & Y value based on the distance from the top not its X & Y value in the game layout / canvas. Imagine a huge canvas which the camera can only see a small part of and that camera follows a character around the canvas so what is at the top of the screen is always changing.

    What I wanted to do with this is change the new Z elevation of sprites based on their screen position. o things as then moved in the viewport would change z elevation. Think of some old pseudo 3d racing games.

  • well you just drawn yourself the answer .. :D

    check if the object is in the screen area in that specific spot of the -50 Z and give it elevation based on it( if you don't have the elevation sorted out yet, use scale... is kinda the same thing you make things bigger or smaller based on the position of the logic doesn't have to be real like in a 3d engine as long as it fakes the effect and works).

    or wait for the new update where you get the Z elevation expression that was featured in the latest upcoming post.

    however you will still need to keep track of the position where the player is at in order to elevate it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes using the r133 but haven't used the viewport function before so I was thinking:

    Z elevation = ViewportTop-"SpriteName".Y

    or something like that but can't get the argument to work. I'll keep messing around but not sure even if ViewportTop is the correct place to start.

    Thanks for the help!

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