0 Favourites

Need help with fake z-depth.

This forum is currently in read-only mode.
  • I�m prototyping a 2d shootergame with fake 3d depth (think double dragon).

    Right know the game knows what z-depth an object has based on what sprite its above, and that works. Problem with that though is that its hella inflexible and complex.

    Is there a way to tell an object its z-depth based on what coordinates the object has?

    You could create a private variable and tell it the object y, but that would be too exact. I would like Construct to tell the object what position it has every 20 pixels.

    So, an object placed x.20 y.460 would have 23 in z-depth.

    x.600 y.423 = z-depth 21

    x.200 y.469 = z-depth 23

    I think you get the point.

    I also would like to know if there is a way to measure the distance between two points, that would be really usefull for a multiplayer camera.

    ex = Distance between A & B = 100 pixels, the camera would then zoom out a sufficent ammount to cover both players.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Depends on what you want, but I think this is probably nearly it.

    I'd do it like this (roughly).

    For: "Order", 1 to LayoutHeight / 20

    System: Number 'Object.Y' is between LoopIndex("Order") * 20, (LoopIndex("Order") * 20) + 20

    Sprite/Family: Set 'Zorder' private variable to LoopIndex("Order")

  • You could also have a shadow object that would tell the x/z and the distance between the sprite and the shadow the y. If you don't want a shadow you could make it invisible.

    Also, there's a command dist(x, y, x2, y2) that gets the distance between two points.

  • Excellent Arima and Rich, Thank you

  • for each ordered, and you give objects a pv/use their .y pos for their depth?

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