Funky Koval's Forum Posts

  • I have a weird issue with using Distort Map that could be related to the Object Pairer.

    I have a family Family which is made up of two separate objects ObjA and ObjB. At the start of the layout, for each Family I spawn a third object ObjC and pair it to the Family, all in the same event.

    Later in the Event Sheet, I have a condition which picks the paired ObjC for each paired Family, compares a private variable in Family and based on the result either performs a Distort Map operation or deletes both the Family member and the paired ObjC.

    This all works fine when using Relative Distortion, but as soon as I switch to Absolute Distortion, it seems like the system forgets the pairing and deletes all the Family objects, regardless of the private variable check.

    I thought that the problem lies with pairing ObjC to a family instead of explicidly to an object, but I have a "For Each" condition, so the system should only pair to the currently iterated member of Family, right?

  • Thank you. That clears things up quite a bit.

  • I'm having a bit of a trouble getting LoopIndex and LoopLength to work as expected - LoopLength first:

    Say I have a condition of For "TestLoop" from 0 to 1 - I'd assume LoopLength("TestLoop") would be 2, since the system would first run through loop 0 and then loop 1, however LoopLength returns 1.

    If the condition is For "TestLoop" from 1 to 2, it returns 2 as expected. Does looping only work for positive integers?

    As for LoopIndex, does it return the currently processed loop number or the nth iteration of a loop? Say if I have For "TestLoop" from 2 to 3 and I have an action that makes use of LoopIndex("TestLoop") and the system is running through the first loop (number 2), would LoopIndex return 1 or 2?

    Sorry for possibly asking obvious questions, but the Wiki is very scarce on the topic of loop evaluation. Using Construct Classic 1.2

  • [quote:3rex9113]But by that logic wouldn't ceil(1.9) return 1?

    Mistake on my part. I meant "not less".

  • I'm aware of how the ceiling function works. It returns the smallest integer not larger than the input. In the example I posted, ceil(0/2) gives 1. 0 divided by 2 is 0, which is an integer, so ceil should return 0.

    EDIT:

    I see what you mean. Whenever a number formated as a non-integer is passed to ceil, it takes the next one, even if that was a whole number. Ceil (1.0) will give 2. I still consider that wrong behavior, since even written as 1.0, 1 is an integer.

    Additionally, the floor function works as expected. floor(1.0) will give 1, not 0.

    Thanks for the explanation.

  • Posted. Bug 3305933 for those interested.

  • Ok. Found the issue. It has to do with the ceil function.

    If

    ceil(0)=0

    and

    0/2=0

    then

    ceil(0/2)=0

    right?

    Well, for Construct, ceil(0/2) is actually 1.

    And that's causing the Distortion Map to actually pull values out of the array's range...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm aware that Construct array are 1-indexed, that's why all of the distortion array coordinates have a +1, like so:

    X Distortion: Array((floor(LoopIndex/2)+1),((ceil(LoopIndex/2)-(LoopIndex/2))*2+1),1)

    I'll try the nested loops approach, though. Thanks for the help.

  • I have a sprite with a 1x1 distortion map. The vertex positions are thus (0,0) (0,1) (1,0) (1,1). Four points in total. I also have a 2x2x3 array which stores precalcualted distortion values. X is Column, Y is Row, Z is distortion in X,Y and Z. Since I have 4 points, I have a looping event (looping 4 times) which updates each vertex with the proper distortion values. The problem is, no matter what I do, the last row never acquires the displacement values at all. They are in the array.

    For"" from 0 to (Sprite.MeshRows+1)*(Sprite.MeshCols+1)-1

    ->

    Set Absolute Displacement at

    Row: floor(LoopIndex/2)

    Col: (ceil(LoopIndex/2)-(LoopIndex/2))*2

    X Distortion: Array((floor(LoopIndex/2)+1),((ceil(LoopIndex/2)-(LoopIndex/2))*2+1),1)

    Y Distortion: Array((floor(LoopIndex/2)+1),((ceil(LoopIndex/2)-(LoopIndex/2))*2+1),2)

    Z Distortion: Array((floor(LoopIndex/2)+1),((ceil(LoopIndex/2)-(LoopIndex/2))*2+1),3)

    The formulae seem correct to me. The only way I found to mitigate the problem, was to add another row to the distortion map - basically adding empty space to the sprite and doubling its height -then my second row would acquire the distortion values while the third one would not.

    Any help would be most apprectiated. Thanks.

  • The problem doesn't seem to be related to the codec. I've just tried an uncompressed AVI, but the issue persists.

  • I'm having a problem with the AVI object. Basically, I need to play a movie file then skip to the next layout and then exit the game.

    I'm using the Timer behaviour to check the time passed since layout start, and as soon as it reaches the duration of the AVI file, I tell it to switch to the next layout. The problem is the AVI object does not dissapear - it is still visible on top of my second layout. In addition, when the second layout finishes and the game is supposed to exit, it crashes with a program error, which seems to be AVI-related - without the AVI object, the game exits fine. I've already tried various forum suggestions, such as disabling the XAudio2 object, but it doesn't help.

    I'm running Windows XP 64-bit with Service Pack 2 and the latest stable Construct. Tried it with the .44 unstable build, but the problem persists. The video was encoded in Mpeg-4.

    Any solutions would be much appreciated.

  • The Destroy action for the AVI object seems to be missing.