how to fix this problem caused by (Move to) behavior

0 favourites
  • 13 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hello..

    https://youtu.be/AGBQN-87XUw

    As you can see while I'm moving the circle(or player object) by 8Direction behaviour, the circle stop moving until the other object reach its destination which is(self.X, circle.Y), and it causes frame drop, in the video i was still holding down arrow keys to move, and as you saw there is only 4 commands in the event sheet and nothing else,so why is this happening? i tried removing the transparent sprite that act as rectangle sight line and made a custom collision detection events, but it didn't solve the problem, i tried to simply set their Y axis to circle.Y, the problem is gone but its not what i want, i want the object to move in fixed speed not to teleport when i enter their sight from another place, so what is happening here? i tried many many ideas to make it work, but its taking too long,

    please help.

  • I can't really tell by the video the effect you are going for...

    but I do see that "is overlapping" is happening 60 times per second. so its issuing more than one MoveTo action. I'm not sure how that would effect your Circle sprite's movement. but if it's constant consistent movement you are going for I'd use a lerp... (you'll want to multiply the last lerp parameter by dt incase you want to pause the game).

    like this:

    drive.google.com/file/d/19nH5Mus6l980imBNxMYm17kteFWenWvS/view

    also note: I put the boundary and wall in a container so the relative one is picked

  • The rectangle shapes act as moving obstacles, so whenever Circle in in their sight line (the transparent sprite), or custom collision by events, they move on the Y axis only, i used overlapping because OnCollisionWithOtherObject will make it move once, while what i want is to move at a fixed speed in this range whenever the circle moves, and stop when rectangle.Y == Circle.Y, for that i used MoveTo behavior, now i can make some ifs statements to no make it MoveTo every frame like overlapping & Circle.Ismoving().

    What is happening in the video that when i overlap with two(transparent sprites) the circle stop from moving even while I'm holding down arrows keys until the second rectangle reach its destination(self.X, Circle.Y), after that the circle will resume moving, but that will happen again when i overlap with the third one.. on so on.

    I will try to use lerp, and tell you if its helps, and if it does, then what is causing this behavior in this example?.

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • did you see my example?

  • Not yet.

  • did you see my example?

    i saw the example.. unfortunate lerp is not what i am looking for,it's good when i'm in the boundary but when i get out from it from the top and then enter from the bottom the wall will move very fast, which is not what i want ,as i said whatever the case i want the wall to move at a fixed speed, so MoveTo behavior is the best option for me for now, however the problem that i mentioned gone using lerp.

    and in your example another weird thing happened with MoveTo behavior (at least for me), disable or delete setPosition action and set MoveTo move to position(self.X, Player.Y),

    set the Player 8Direction MaxSpeed to 650, Acceleration and deceleration to a high value 20000 for instance,

    and then move in a linear direction to the right, you should pass through them, and watch how the player speed is exceeds its maximum speed and then return to normal, and when you pass the other wall the same thing will happen.

    so does MoveTo behavior still not stable?

    p.s: the container tactic is super useful ty:D

  • you don't have to use lerp, you can just move at a constant rate instead of lerp. but still use SetPosition

    instead do:

    make a time and a speed variable..start with .1 and 100

    t = 0.1

    speed = 100

    then set the position of the bar...

    Self.Y + ((player.Y - Self.Y) / distance(Self.X,Self.Y,player.X,player.Y)) * speed * t

    EDIT: had to make some changes to the equation

    EDIT2: actually that might still have some easings built in...I don't understand what you want exactly. Do you want the wall move to only happen once (to where the plays was when they entered) while the player is in the boundary?

  • Thank for the equation, i will play with it to understand it.

    What i want is:

    make the Wall follow the player only on Y axis, the wall have a sight line(rectangle), when player enter their sight they move to Player.Y at a fixed speed,

    for that i used MoveTo behavior, this behavior have a Maxspeed and MoveToPosition action, exactly what i want, but then the problem that i mentioned from the begging start to happen, that prevent the Circle(Player) from moving until the other wall reach its destination if there is more than one.

    I tried to fix it, but i couldn't, i tried to use other ideas but none of them worked like MoveToPosition action from MoveTo behavior.

    So i asked for help, why is that happening with the behavior, am i using it wrong? how to fix it, if its a bug then tell me another way to make wall move (NOT to teleport) to Player.Y . :)

  • I haven't used MoveTo, but I added it to the example.

    I can't tell what issue you are having with it. check my example again

  • oh I think I see.. for some reason the 8-dir player speeds up when colliding with object that has MoveTo

    ... yeah I have no idea what that is about.. seems like a bug.

    Nepeo do you think this a bug?

    drive.google.com/file/d/19nH5Mus6l980imBNxMYm17kteFWenWvS/view

  • Yeah I guess it is, although I have no idea what would cause it. Something for Ashley to look at I think.

    I added a simple speedometer using the sum sqrt((player.Y - previousX) ^ 2 + (player.Y - previousY) ^ 2) / dt and the player speed appears to double when passing through the moveto instances.

  • Nepeo it feels like scope issue...maybe?

    Mohammad1115 can you fill out a bug report? or do you want me to?

  • jobel yes please do report the bug, and report about the other issue pls :)

    btw i did my own MoveTo function, that is doing what i want, inspired by the equation you gave me,

    do you want to see it? maybe you can make it better, since i'm construct3 newbie

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