How do I make working the vactor X ???

Get help using Construct 2

Post » Sun Oct 05, 2014 2:40 pm

Hi guys, somehow my Vector X is not working.....just a few pixels maybe....
in another part the vector Y is doing fine...but here the vector X is not really working...obviously my fault...but why ?
here is my code...it's like in super mario that after hiting the enemy, the player bounces away for a certain distance of pixels...


mess.jpg


sorry...I am beginner,....and I really shame in front of so tough guys like U who can code like Pros...
2 long days...I am tring to see tutorials manuals and asking help...

thanks :)
You do not have the required permissions to view the files attached to this post.
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Tue Oct 07, 2014 12:56 am

The deceleration setting is likely changing the vector x back to 0 quickly. Which it is made to do. The solution would be to set the deceleration to 0 before setting vector x. Add a wait action then set the deceleration back up to let it move for a bit.

ex.

set deceleration to 0
set vector x to 100
wait 1.0 second
set deceleration to 1000

^That will move the object 100 pixels over 1 second. You could make it only take half a second with:

set deceleration to 0
set vector x to 200
wait 0.5 second
set deceleration to 1000

You can calculate the distance moved, vector x to use and time to use with this equation:
distance = vectorX * time

You just need to have two of the values and you can calculate the other by manipulating the equation.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Post » Tue Oct 07, 2014 8:09 am

very kind thanks...is it possibile to see a small capx sample ? :)

thanks a lot
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Tue Oct 07, 2014 8:40 am

R0J0hound is best person to ask
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Tue Oct 07, 2014 8:51 am

Ah ok I maged it :) that was super helpful...how can i mange this :
...if the player hits from left the enemy, player bounces back left...if player hits enemy from tight,...it bounces to right side

anyway thanks,,,that was awesome :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,865


Return to How do I....?

Who is online

Users browsing this forum: bclikesyou, brunopalermo, kellehk, ST314 and 28 guests