How do I get accurate collisions with the MoveTo behavior?

0 favourites
  • 7 posts
  • Below is the capx that will demonstrate my problem. It is very simple and only has one line of code but requires the MoveTo Behavior http://c2rexplugins.weebly.com/rex_moveto.html

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

    The problem: I want the player to be able to move to the mouse's coordinates whenever the left mouse button is held down. This works fine but when I have the player move to a solid wall without stopping they will slide really fast against it. For some reason this only happens when the player is moving against a wall on the left or top side.

    If this doesn't make sense you have to try holding the mouse button on the very left side of the screen and when the player comes into contact with the wall they will slide up at great speed. Also, the reason I have the 8direction behavior is simply so the player interacts with solids. I have also tried rex's PushOutSolid behavior but it gives the same result.

    I want the collisions to be like it is in most top down 2d games where the player will slide against the wall at a normal speed and not jitter or go too fast.

  • I don't use plugins for something as simple as direction and movement controls.

    The plugin doesn't stop when it should and continues to try and go left and it does not address acceleration properly.

    My suggestion is get rid of the plugin and use the 8 direct commands which adjust for acceleration.

  • I don't use plugins for something as simple as direction and movement controls.

    The plugin doesn't stop when it should and continues to try and go left and it does not address acceleration properly.

    My suggestion is get rid of the plugin and use the 8 direct commands which adjust for acceleration.

    Ok, that makes sense but I would like full 360 movement so should I use the custom movement behavior? Or is there a better one to use for something like this?

  • > I don't use plugins for something as simple as direction and movement controls.

    >

    > The plugin doesn't stop when it should and continues to try and go left and it does not address acceleration properly.

    >

    > My suggestion is get rid of the plugin and use the 8 direct commands which adjust for acceleration.

    >

    Ok, that makes sense but I would like full 360 movement so should I use the custom movement behavior? Or is there a better one to use for something like this?

    8 directions has a 360 in the settings if you are using a single sprite or you could use the car movement.

    Custom movements are not as well defined by acceleration as 8 direction but can be used.

  • >

    > > I don't use plugins for something as simple as direction and movement controls.

    > >

    > > The plugin doesn't stop when it should and continues to try and go left and it does not address acceleration properly.

    > >

    > > My suggestion is get rid of the plugin and use the 8 direct commands which adjust for acceleration.

    > >

    >

    > Ok, that makes sense but I would like full 360 movement so should I use the custom movement behavior? Or is there a better one to use for something like this?

    >

    8 directions has a 360 in the settings if you are using a single sprite or you could use the car movement.

    Custom movements are not as well defined by acceleration as 8 direction but can be used.

    I want the player to move without having their angle changed, doesn't the 8dir behavior force that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want the player to move without having their angle changed, doesn't the 8dir behavior force that?

    If you don't want the angle changed set 360 smooth to off in the 8 direction settings.

    You can also set it to move in 4 directions or 2 directions.

    It can be used either way.

  • >

    >

    > I want the player to move without having their angle changed, doesn't the 8dir behavior force that?

    >

    If you don't want the angle changed set 360 smooth to off in the 8 direction settings.

    You can also set it to move in 4 directions or 2 directions.

    It can be used either way.

    Thank you for your help. I ended up using the 8 Direction behavior like you said and took the angle from the player to the mouse to get the X and Y Vectors that I need to get the player moving.

    Vector.X = cos(angle(Player.X,Player.Y,Mouse.X,Mouse.Y)-180)

    Vector.Y = sin(angle(Player.X,Player.Y,Mouse.X,Mouse.Y)-180)

    Works great

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