Simulating fluid scaling & depth with layers

  • Construct 3 file: Tanks

    Below is my current set of instructions for scaling an "elevator" platform in a top-down perspective between layers, or "floors", amongst buildings of various heights. Each floor is scaled a factor of 0.1 larger than the floor below it, so that objects on each layer appear closer and larger, just as you might expect when looking at things up close or far away. No parallax is used.

    As seen below, each grayscale block, from black (and the brown roads) to light-gray, seen here represents a floor (on its own layer in the layout). Each layer used for the buildings is scaled from 1 (layer: GroundLevel) to 1.9 (layer: TenthLevel). The Elevator object is currently on the layer dubbed ThirdLevel (not necessarily the third layer, as the Tank and turrets get their own layer between layers GroundLevel and SecondLevel).

    The Set Up

    I have a 2D Array, ListOfFloors, which lists floors 1-10, starting at index 1 (for simplicity I simply do not use or store any value in index 0).

    There are two X axes. For each Y axis, Y(0) is the floor/layer value (tracked by the Elevator object instance variable Floor) and Y(1) sets the corresponding scale value for that layer. All of these values for the array are set at the start of the layout.

    So, for instance, if the Elevator.Floor value is 2, then the Array.At(X(2)Y(0)) value has the name of the layer, "SecondLevel". And the X(2)Y(1) value is 1.2 which sets the scale value for that layer (again, set at the start of the layout).

    The Flow

    This is how the I intend for it to work...

    • When the Elevator variable WaitTimeAtEachFloor reaches 0, whether moving up or down a floor, the Elevator object is automatically moved to the next floor/layer.
    • If the Elevator object moves up a floor, at the same time, its scale value is set to 0.1 less than that floor/layer's scale value. So if the floor has a scale value of 1.2, then the Elevator object is set to 1.1. This is because the Elevator is technically already moving up and above any object below it. Even if it is not yet to its target "elevation" of 1.2 on the second floor, it is still above the floor below. This is also so that any objects meant to be below it do not appear above it while the Elevator is in the process of "scaling up". The reverse is true while moving down. Once this is done, the TriggerFloorChange boolean of the Elevator object is set to false so to prevent continual floor changes during scaling.
    • While scaling, the Elevator object's scale value is tracked by its instance variable CurrentScale. Once it reaches its target scale value (as defined through the Array), the WaitTimeAtEachFloor is reset.

    The Problem

    The issue I'm having is that during the scaling and floor changing process, the Elevator object 1) occasionally seems to shift in its X/Y position (which I don't see with any of the other objects that represent the floors of the "buildings") and 2) the Elevator simply jumps from one scale size to the next instead of the gradual change as if it were steadily moving up and down in a smooth motion.

    The Elevator does appear to jump between floors/layers properly, simply without the gradual/fluid scaling I intended.

    Can anyone help me, please? Thank you very much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)