How do I fix collision in with solid in this project?

  • hi everyone,

    when an object with 8direction behavior is colling with a solid object diagonally object either stat moving fast or really slow .

    herehttps://drive.google.com/file/d/17Zgp3S3Xtss7VsSrb_A_Tfb0Cr-_tPn0/view?usp=sharing

    Tagged:

  • Do you mean when controlling with the virtual joystick? Or with keyboard keys?

    When using virtual joystick, you should move the tank with 8-direction actions like "Simulate control" or "Set vector", not with "Move at angle" action.

    Also, your joystick doesn't work very well, you need at least put it on a layer without parallax. Please see a few better examples of the virtual joystick in this post:

    construct.net/en/forum/construct-3/general-discussion-7/collection-demo-projects-149701

  • Do you mean when controlling with the virtual joystick? Or with keyboard keys?

    When using virtual joystick, you should move the tank with 8-direction actions like "Simulate control" or "Set vector", not with "Move at angle" action.

    Also, your joystick doesn't work very well, you need at least put it on a layer without parallax. Please see a few better examples of the virtual joystick in this post:

    https://www.construct.net/en/forum/construct-3/general-discussion-7/collection-demo-projects-149701

    No, I mean when the tank is colliding with an obstacle moving upward it starts moving faster than usual and colliding with an obstacle moving downward it starts moving really slow and in some cases, it starts moving upward

  • Yes, I understand, but how do you control the tank when this problem happens? With keyboard keys, or with the virtual joystick?

  • For Mobile devices: virtual joystick and for desktop: keyboard

  • Ok, does this problem happen when you control the tank with the keyboard on desktop?

  • no, if I use 8direction whereas if I use bullet than the same problem

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, I'm tired of trying to tell you that the problem is not with the behavior. The problem is with your joystick code!

    I repeat what I told you in my first comment - if you want correct collisions with solids, don't use "Move at angle" action to move your tank. It's not compatible with 8direction behavior!

    Only use 8-direction native actions - "8Direction Simulate control" and "8Direction Set vector X/Y". Then your tank will move correctly up and down when touching solid walls.

    .

    Formulas for "Set vector" actions are:

    Set vector X to cos(angle(.....))*speed
    Set vector Y to sin(angle(.....))*speed
    
  • now its working fine but it starts shaking. I saw your project on the tank and i edit a little bit and added some obstacle.

    please try this on a mobile device

    here

  • Disable "Set angle" in event 16, and enable "Set angle=smooth" in behavior properties.

    Also, if you want more precise control, use "Set vector X/Y" actions (instead of "Simulate control")

  • Thanks Man its working

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