How do I can change the direction of box chipmunk

  • Please someone help me, I have a falling box with physics behavior i want to change his direction when i swipe, the box will move to right or to left and continue to fall as the image below

    Im using the plugin of chipmunk

  • Maybe you could find this link usefull? https tutorials 1049 simple-swipe-on-object (add :// and / where needed, i can't post full links since i don't havve 500 rep)

  • Maybe you could find this link usefull? https tutorials 1049 simple-swipe-on-object (add :// and / where needed, i can't post full links since i don't havve 500 rep)

    Thanks for your reply in fact i used the same code but i have a problem about moving the box to right or left

  • > Maybe you could find this link usefull? https tutorials 1049 simple-swipe-on-object (add :// and / where needed, i can't post full links since i don't havve 500 rep)

    >

    Thanks for your reply in fact i used the same code but i have a problem about moving the box to right or left

    Ohh... ok. Unfortunately i have very limited experience with construct 2 and haven't tried anything mobile/swiping yet so i don't think i'll be able to help you further more than you can yourself (by google-ing, exactly what i do too xD).

  • >

    > > Maybe you could find this link usefull? https tutorials 1049 simple-swipe-on-object (add :// and / where needed, i can't post full links since i don't havve 500 rep)

    > >

    >

    > Thanks for your reply in fact i used the same code but i have a problem about moving the box to right or left

    >

    Ohh... ok. Unfortunately i have very limited experience with construct 2 and haven't tried anything mobile/swiping yet so i don't think i'll be able to help you further more than you can yourself (by google-ing, exactly what i do too xD).

    anyway thanks for your reply i hope if i find the solution

  • help please =/

  • You might get a better response if you post in the actual thread for the behaviour HERE. Not everyone uses plugins, so it's sometimes best to target the original plugin thread.

    You also might get a better, more helpful response if you post your .capx. That way, any helpful user will be able to test for themselves and hopefully find the solution to your problem.

    One last thing, you're not adding and deleting posts just to create a bump are you? If so, please don't.

  • You might get a better response if you post in the actual thread for the behaviour scirra.com/forum/behavior-chipmunk-physics_t110815 HERE. Not everyone uses plugins, so it's sometimes best to target the original plugin thread.

    You also might get a better, more helpful response if you post your .capx. That way, any helpful user will be able to test for themselves and hopefully find the solution to your problem.

    One last thing, you're not adding and deleting posts just to create a bump are you? If so, please don't.

    im sorry about that i just want a response on my issue but i think i was wrong ...i will not repeat that again and thanks for your useful advices

  • You asked the same question before here with normal physics, which you marked as solved after someone posted an example:

    You then asked a question similar to your op here, and got an example:

    You even already asked this in the chipmunk forum, where I responded with a general suggestion, since you weren't specific about what what was wrong other than it doesn't work.

    So in general you're just looking for a completed working example I guess. Applying forces are one of the simplest things to do with physics, and is about the same in chipmunk. The swipe direction I guess could be trickier, but it's just a matter of checking where you first touched to where you're currently touching.

    How do you know where you're currently touching? There's the Touch.x, touch.y expressions.

    How do you know where you first touched? Save the touch location to variables under a "on touch" condition.

    How do you compare the two directions to find a direction? Something simple like a "system compare" with the current touch position and where you first touched.

    I won't make a capx, but you can do events like this:

    global number firstTouchX=0

    on touch:

    --- set firstTouchX to touch.x

    is touching

    touch.x < firstTouchX

    --- apply force (-100,0)

    is touching

    touch.x > firstTouchX

    --- apply force (100,0)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You asked the same question before here with normal physics, which you marked as solved after someone posted an example:

    You then asked a question similar to your op here, and got an example:

    You even already asked this in the chipmunk forum, where I responded with a general suggestion, since you weren't specific about what what was wrong other than it doesn't work.

    So in general you're just looking for a completed working example I guess. Applying forces are one of the simplest things to do with physics, and is about the same in chipmunk. The swipe direction I guess could be trickier, but it's just a matter of checking where you first touched to where you're currently touching.

    How do you know where you're currently touching? There's the Touch.x, touch.y expressions.

    How do you know where you first touched? Save the touch location to variables under a "on touch" condition.

    How do you compare the two directions to find a direction? Something simple like a "system compare" with the current touch position and where you first touched.

    I won't make a capx, but you can do events like this:

    global number firstTouchX=0

    on touch:

    --- set firstTouchX to touch.x

    is touching

    touch.x < firstTouchX

    --- apply force (-100,0)

    is touching

    touch.x > firstTouchX

    --- apply force (100,0)

    Sorry for disturbing you in fact i was looking for a complete example or even a key which allow me to resolve my issue your suggestion seems to be logic i will try it and if i handle my problem i will share the capx thanks

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