How do I fix my " 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
  • Hey!

    This event is working, my player follows the movement of my "movable ring" when he grabs it. But i dont know why. with the event " is overlapping " so every frame. The player makes a little movement when moving, really weird.

    So, my player is set to be at Movablering.Y +25. But when the movable ring is " simulate up " control with 8 direction behavior. My player is like Movablering.Y +23 and when going down, my player is like set to Movablering.Y+28

    Tagged:

  • Hi, it might be because of the order the events are checked at runtime, try to put the events that move the ring above the one that set the player in position

    Edit : I think the moveTo behavior is not needed here, you can simply set the player to the position you want by checking a boolean (for ex, Grabbing=True, set position to Ring.X, Ring.Y+15)

  • Hi, it might be because of the order the events are checked at runtime, try to put the events that move the ring above the one that set the player in position

    Edit : I think the moveTo behavior is not needed here, you can simply set the player to the position you want by checking a boolean (for ex, Grabbing=True, set position to Ring.X, Ring.Y+15)

    It didnt work..

    The mopveto2 behavior is for a smoother teleport to the object.

  • The problem is that it will constantly updating the position, hence the lag effect;

    Are you familiar with lerp()?

  • The problem is that it will constantly updating the position, hence the lag effect;

    Are you familiar with lerp()?

    Not really :/

  • I can explain it to you, it's not hard to use once you get the logic of it;

    It means Linear Interpolation, basically moving a object from A to B in set time, in application it looks like this : lerp(A, B, x), x being the progress of the movement, it goes from 0 to 1, 0 means it didn't start, 1 means it's complete, 0.5 being the middle;

    I believe that can solve your lag problem, because once the destination is reached, it wont need to update the movement every tick;

    I'll take some time to craft a template once I'm home

  • I can explain it to you, it's not hard to use once you get the logic of it;

    It means Linear Interpolation, basically moving a object from A to B in set time, in application it looks like this : lerp(A, B, x), x being the progress of the movement, it goes from 0 to 1, 0 means it didn't start, 1 means it's complete, 0.5 being the middle;

    I believe that can solve your lag problem, because once the destination is reached, it wont need to update the movement every tick;

    I'll take some time to craft a template once I'm home

    would be better for a creation of a movable grappling hook ?

    Because, my very big problem with the 8direction of it. I have two triggers. Once it reaches it, it change his direction. I want to change is speed to add challenge.

    But when i make it faster, it will cross the triggers and do shit

  • That's another problem tho, have you tried the sine behavior with vertical movement instead?

    (Btw you don't need For Each with a collision event, it will automatically pick the ring the player collided with)

  • That's another problem tho, have you tried the sine behavior with vertical movement instead?

    (Btw you don't need For Each with a collision event, it will automatically pick the ring the player collided with)

    sine can be useful yes. I try and it makes me the same effect as before as moving my character weirdly.

    But the problem with sine, i want to be really " precise " with my ring because its a platformer. I want to set a position A and B positioned by the rules of tiles 32x32 and set speed.

  • That's another problem tho, have you tried the sine behavior with vertical movement instead?

    (Btw you don't need For Each with a collision event, it will automatically pick the ring the player collided with)

    we.tl/t-d4Q2DlDNFq

    heres the project if u want

  • I prefer to not mess with your code as it looks already very detailed, instead I made an example file with the lerp method, and sine behavior for the rings with grid accurate movement :

    drive.google.com/file/d/1rPMGTzKkj-CLR1s7wsYTbTqDoTtI8v_u/view

    I didn't implement plateforming in this example, free to you to adapt this to your project, but it works the way you're looking for ~

  • I prefer to not mess with your code as it looks already very detailed, instead I made an example file with the lerp method, and sine behavior for the rings with grid accurate movement :

    https://drive.google.com/file/d/1rPMGTzKkj-CLR1s7wsYTbTqDoTtI8v_u/view?usp=sharing

    I didn't implement plateforming in this example, free to you to adapt this to your project, but it works the way you're looking for ~

    Thanks a lot ! i dont know how to implement that into my game. I dont know how to create a specific grid based on my game but i will try.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem ~ For the grid movement just follow my example for how I setup the rings with Sine behavior, since it uses a global variable as a grid size reference, just adjust it to your desired grid size;

    For the player, I used a On Object Clicked, in your project this must be triggered by Player On Collision with Ring, then refer to the events in the example

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