Tween starting from inaccurate Values

0 favourites
  • 12 posts
From the Asset Store
Calculate parabolic trajectories and tween objects over them.
  • With the recent update (beta 203.2), the bugs in the Tween behavior were supposed to have been fixed. Either there is still an unresolved issue that got overlooked or I'm dealing with a separate matter...

    I'm using Tween behavior to adjust elements of the HUD map system. Each element (Quadrant, Hallway, Boss room, and Sector) share the same exact instance variables per a Family.

    Depending on where in the environment the Player is, the elements of the HUD map Tween to their new size and position according to the values of their copies of the instance variables.

    So the map will look something like this when in action:

    When the Player moves from one area to the next, whichever area is occupied has its map counterpart expanded to its relative size of the actual area. The origin point of each HUD map element is in the top left. So, in the image above, the top-right Quadrant would Tween from its current position to a number of pixels to its left. At the same time, its size would expand at the same Tween rate that it moves. (Some objects, like the top-left Quadrant, would have the same X/Y values all the time or only part of the time depending on which area is accessed. And the same for the sizes, as well...some values will change while others will not.)

    This system was working perfectly prior to the recent update. Even after the apparent Tween behavior bug fix, the problem persists. However, the ONLY thing I changed recently has been the VALUES of the instance variables. Because I reduced size of EVERYTHING - layout, objects, etc - I had to update where the HUD elements appear on the HUD layer. I also had to update the X/Y and size values that the elements Tween to. That's it.

    The problem is that, when I Tween to certain areas, the size of the element will START at a value GREATER than it was at before the Tween. For example, if I'm moving from Quadrant 2 (top-right) to Quadrant 1 (top-left), the width will Tween to its correct size but its height will start out at more than double its original size prior to the Tween (and its height isn't even supposed to change!).

    The max size any element will reach is 45x45 pixels. The minimum is 15x15. But I'm seeing cases where the height and/or width starts out at as much as 90. In other cases I'm seeing where it will Tween from a smaller size to its target size when it shouldn't have changed sizes at all. As per my illustration above, moving left to right will keep the top two Quadrants the same height. But the Quardant 1 element will Tween from 15 pixels to 45. But I have quadruple checked the values for the instance variables to confirm that it shouldn't be Tweening to or from anything different.

    Here is the .c3p file: https://drive.google.com/file/d/11fTotgPQCiQDkq5UtETuYOpfyLBgkuI9/view?usp=sharing

    CONTROLS:

    - WASD to move

    - MOUSE to move the targeting reticule (make sure it's around the middle of the screen

    In the project window, look for the HUD_Elements Family to find the variables being referenced here.

    The event lines are on the "E Gameplay" event sheet and are at event lines 218-230.

  • Have you tried opening the project in stable release 197.2? Unpack and change "savedWithRelease" to 19720 in project.c3proj

    Another test you can do is open the old project (before you changed those variables) in r203.2, this will tell you if the bug is in your code or in Construct.

  • dop2000 - I will try, but I'm 99.999999999999% certain that it's not in my code. Since, as I mentioned, I changed absolutely nothing EXCEPT the object image sizes, the positions in the layout, and the instance variable values. That shouldn't break how the Tween behaves.

    The curious thing is, as I go about finishing the updates to the aforementioned details, all the other objects are working - it's literally only the Quad_HUD objects (the yellow squares in my mini-map) that are behaving like this.

    Off to test your suggestion...

  • ...yeah, that's not getting me anywhere. I am afraid I have only kept a single of the project and I'm unable to open it in older versions of C3.

  • DiegoM - This is the issue I'm having...

    As I mentioned in my comment above, the strange thing is that this is an issue only for on particular object instance and not the others that all are included in a Family and following the same exact action instructions.

  • I'm unable to open it in older versions of C3.

    I can open it in r197.2, but I don't understand where and how to look for this bug. Here is the project file for r197.2:

    dropbox.com/s/iqsw4p7qear9ome/Anti-Virus%20Tween%20help.c3p

  • I tested this out in r197.2 by manually changing .c3proj file, and it seems to be doing the same thing as in r203.2

    Still need to look at this more closely because there are a ton of things going on. It does look like it is easy to make a mistake if you try to make any changes.

  • In the project window, look for the HUD_Elements Family to find the variables being referenced here.

    The event lines are on the "E Gameplay" event sheet and are at event lines 218-230.

    The only changes made were

    - to the instance variable values that I made in the parameters window and not through the event sheet.

    - to the position of the objects on their respective layers.

    - to the original size of the objects before manually resizing them in the layout to set them for their initial size once the game is run.

    No changes were made to the event sheet. And it's only happening to TWO of the Family objects (the top two yellow "Quadrant_HUD" Objects). Everything else is working fine after getting their instance variable values updated.

  • The way you are describing it makes it seem there is a problem with at least one of the things you changed, either instance variables or layout size and position. I am more inclined to believe there is something going on with the instance variables, but that is just a hunch, there are so many of them that it just makes me wonder if there is a hidden problem there.

    It is very unlikely that everything else would still be working properly if there was a problem with the Tween behaviour itself.

  • DiegoM - I'm inclined to agree completely. I have continued to scour my variable but it doesn't explain why it will start a Tween at a smaller value and then Tween to its larger end value or vise versa.

    For example, as you saw, if I'm moving to the top-left Quadrant (#1) the MAX height for that Quad should be 45. But it will start the Tween at a value much larger than 45 and Tween its height smaller. In other instances it will start smaller and Tween larger.

    In addition, I've taken all instance of the objects and clicked the "Make 1:1" button just to make sure there was no residual issue when I resized the image art, itself (I've noticed in the past that can sometimes cause problems).

    I'll keep looking things over and checking my variables and finish writing the bug issue if I can't find a resolution...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • & DiegoM - As always, I'm grateful for your assistance. This time, however, I must apologize, too, because I rather sent you all on a wild goose chase when the answer was - apparently - not related to the Tween or my variables. I checked the image of the Quad_HUD object again and I realized I had a second animation that - despite playing quite clearly in the preview of the game - I had missed entirely when I resized the first animation.

    Since the second animation was still twice the size of the new resize, when the animations were changed, they appeared to be starting out larger or smaller than their target Tween value. So when it was to Tween to a larger size, it was switching animations and appearing initially larger and thus Tweening smaller. At any rate, I've tested all the main areas and things are working.

    The only "bug" was in my brain.

  • I was just now trying by disabling the size tweens to see what was going to happen, and it looked like something else was changing the size of the instances.

    Glad you could fix it. Often times you just need to try and explain what is going on to someone, to be able to see the problem from a different perspective.

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