[Behavior] moveto

  • Smileh

    I don't know, lite tween is not my behavior.

  • I don't know if i found a bug or i'm using it in a way is not correct(I guess the last XD)

    Using Drag&Drop2 and PintTo Imagepoint plugins.

    I have an event called:

    Sprite set width to:

    distance(Scaler_right.DragDrop2.X,Scaler_right.DragDrop2.Y,Scaler_left.X,Scaler_left.Y)

    And event that when the sprite is selected(one time event) > Scaler_right Pinto image point 5 .

    So the idea is set the size of the sprite with the distance between the Scaler_left and the scaler_right. If i move the Scaler_right the sprite is updated no problem.

    But if when is dragging the scaler_right, i move the cursor on Y the distance that is set to the sprite is always the distance of Scaler_left and the mouse.x/y.

    Seems not matter if i pin or set position of the scaler to X point, the distance when is dragging the scaler will be with the mouse.

    I put the events before and after but nothing changes. Seems the pointer event runs more times or have always priority front the PIN or Set position and not set the distance correctly.

    I guess someway to solve the problem is to the distance expresion substract the difference of the Y or something like that but i'm very bad with maths XD.

    Here is the actual program:

    https://dl.dropboxusercontent.com/u/659 ... index.html

    Press the button circle to create one and drag the scaler in the middle-right(the one with a green square) to the right(is locked to move only to the right) and will do the resize correctly.

    But if you stop and go up on Y, the sprite also will be resized. And after some test i found that is because get the distance with the mouse and not with the scaler_right with the pint or with the set position.

  • matriax

    Please provide a very simple capx to demonstrate your requirement.

    For now, it seems that you want to resize sprite when dragging.

  • rexrainbow Here the very simple .capx <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    https://dl.dropboxusercontent.com/u/659 ... oblem.capx

  • matriax

    The steps of executing are-

    1. (before event tick) Position of scaler_right changed by dragging. Since this scaler_right could be moved in both axis, it should be put on current dragging point.

    2. (during event tick, i.e. condition: every tick) Get the distance between scaler_right (which is located at current dragging point) and scaler_left, and set the width of sprite according the disctance

    3. (after event tick) Pin the position of scaler_right to the image point, like official pin behavior. Therefor the position of scaler_right will be changed. It will not locate at current dragging point.

    4. render.

    The problem is - position of scaler_right in step2 is not equal to the final position in step4, remove the pin to image behavior to see the real position in step2.

  • rexrainbow I see, when i pinned the object i expected that the drag not affect to them or the execution was first or something.

    If i put only horizontal axis in drag&drop2 and keep the sprite at angle 0, works correct, no matter how much the mouse goes to y. But if i rotate the sprite get problems because the angle/axis of sprite/scaler are not the same.

    So, in the same way you added a restriction of Drag&Drop to horizontal/vertical, is there some way that you can add some event of "restriction by angle" or axis? So with that i can rotate the sprite and drag&drop in the Sprite.Angle without problems doing all correctly.

    Here is the same capx adding a keys to rotate the sprite left/right to see what happens when you try to resize in some angle using Both Axis or H/V:

    https://dl.dropboxusercontent.com/u/659 ... blem2.capx

    So we can say: every tick -> Drag&Drop2 Lock angle at (Sprites.angle)

    And we will can drag and drop objects at the angle desired. Is possible?

  • Update

    rex_dragdrop2 behavior:

    • add property "Axis angle" to rotate the axis, or set it by "Action:set angle".

    This feature only works when the property "Axis" is "Horizontal" or "Vertical". (sample capx)

    matriax

    Try this updated.

  • rexrainbow It's me or the axis are inversed or something? I set the Angle of the sprite to the drag but is not the same. If you drag the scalr righ the drag slide in other angle ¿? .

    https://dl.dropboxusercontent.com/u/659 ... blem3.capx

    When the sprite angle is 20, the drag is 340. And when the Sprite angle is 20, the drag angle is 340 <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">

    Or again i'm doing something wrong...

    EDIT: Well i fixed doing : Set angle > 360-Sprite.setangle to get the inverse and now the resize works perfect.

    So this is the way this have to work, or in the behaviour you added the angle in degrees inverse as construct2? I ask to put this in my program or wait to you for invert the angle degrees equal than construct2.

  • matriax

    You are right, it is a bug.

    I had fixed, please updating rex_dragdrop2 behavior again.

  • rexrainbow A lot of THANKS! Now works perfect!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow

    Hey Rex, another great plugin Im using. I'm encountering an issue with this one tho, let's see if you could help me out.

    I have those events.

    This is kinda like a dropping block from Super Mario. As you can see I just move the sprite's Y BUT whenever reaches the top it moves it's X +3 pixels, so every cycle it keeps getting further to the right. I could stop this by moving it's X to -3 but then it looks really weird.

    Do you know what could be causing this issue? Thank you!

  • Smileh

    I have no idea, could you provide a very simple capx?

  • Smileh

    I have no idea, could you provide a very simple capx?

    rexrainbow

    https://www.dropbox.com/s/a9t9qr16v1uyh ... .capx?dl=0

  • Smileh

    I guess that, the issue might come from platform behavior with (soiled) ground, since platform behavior will change the position too.

  • Smileh

    I guess that, the issue might come from platform behavior with (soiled) ground, since platform behavior will change the position too.

    Um, nope. Without the platform behaviour, they jump to, on the moment that they stop for the solid. Seems to me that the push-out-of-solids has a bug.

    https://www.dropbox.com/s/ivcdvfpsgsjin ... .capx?dl=0

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