How do I can change the direction of box chipmunk

Get help using Construct 2

Post » Thu Mar 03, 2016 3:38 pm

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
Image
B
5
Posts: 27
Reputation: 281

Post » Thu Mar 03, 2016 5:21 pm

Message: horoblast can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Maybe you could find this link usefull? https www.scirra.com tutorials 1049 simple-swipe-on-object (add :// and / where needed, i can't post full links since i don't havve 500 rep)
B
6
Posts: 50
Reputation: 367

Post » Thu Mar 03, 2016 5:36 pm

Message: MarkeGamer can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
horoblast wrote:Maybe you could find this link usefull? https www.scirra.com 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
B
5
Posts: 27
Reputation: 281

Post » Thu Mar 03, 2016 5:55 pm

Message: horoblast can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
MarkeGamer wrote:
horoblast wrote:Maybe you could find this link usefull? https www.scirra.com 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).
B
6
Posts: 50
Reputation: 367

Post » Thu Mar 03, 2016 6:08 pm

Message: MarkeGamer can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
horoblast wrote:
MarkeGamer wrote:
horoblast wrote:Maybe you could find this link usefull? https www.scirra.com 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 :| :|
B
5
Posts: 27
Reputation: 281

Post » Sat Mar 05, 2016 1:55 am

help please =/
B
5
Posts: 27
Reputation: 281

Post » Sat Mar 05, 2016 8:20 am

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,380
Reputation: 58,442

Post » Sat Mar 05, 2016 1:27 pm

Message: MarkeGamer can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
zenox98 wrote:You might get a better response if you post in the actual thread for the behaviour https://www.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 :)
B
5
Posts: 27
Reputation: 281

Post » Sun Mar 06, 2016 8:57 pm

You asked the same question before here with normal physics, which you marked as solved after someone posted an example:
viewtopic.php?f=147&t=168560

You then asked a question similar to your op here, and got an example:
viewtopic.php?f=147&t=168667

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.
behavior-chipmunk-physics_p1015630?#p1015630


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)
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sun Mar 06, 2016 11:26 pm

Message: MarkeGamer can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
R0J0hound wrote:You asked the same question before here with normal physics, which you marked as solved after someone posted an example:
viewtopic.php?f=147&t=168560

You then asked a question similar to your op here, and got an example:
viewtopic.php?f=147&t=168667

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.
behavior-chipmunk-physics_p1015630?#p1015630


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
B
5
Posts: 27
Reputation: 281


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, OBLIVION and 16 guests