Get help using Construct 2

### » Fri May 29, 2015 5:33 pm

How can I get an object using the platform behavior to jump to a specific position? i.e. an enemy jumps from right side of the screen to the left or jumps from the right or left side to the middle.

There's a parabola example around here somewhere that can do this well, but I just wanted to see if it can be done with the platform behavior and minimal variables because I'll be using it often and with a number of different objects.
B
254
S
32
G
13
Posts: 1,795
Reputation: 19,270

### » Fri May 29, 2015 5:59 pm

I guess you would have to use some math to calculate the vectorX and vectorY of the platform behaviour..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Sat May 30, 2015 4:14 am

Well yeah.
B
254
S
32
G
13
Posts: 1,795
Reputation: 19,270

### » Sat May 30, 2015 6:29 am

To get the launch speed you can do the following. Be sure to set deceleration to 0.

Vector x = (x1-x0)/t
Vector y = (y1-y0)/t-0.5*gravity*t

X1,y1 is the destination
X0, y0 is the start
Gravity is whatever the behavior's Gravity is
T is how long you want the jump to take in seconds.

Overall the math should be the same as in that example you're referring to. The actual path will vary a bit due to the variable delta time but it should be pretty consistent.
B
100
S
38
G
134
Posts: 5,551
Reputation: 85,315

### » Sat May 30, 2015 12:16 pm

Great, @R0J0hound.

I had a similar problem. ^^
B
39
S
9
G
3
Posts: 261
Reputation: 4,383

### » Sat May 30, 2015 5:22 pm

Thanks man I'll try it out soon
B
254
S
32
G
13
Posts: 1,795
Reputation: 19,270

### Who is online

Users browsing this forum: Google [Bot] and 4 guests