Portal vector realignment

Get help using Construct 2

Post » Fri Feb 03, 2012 2:20 am

I just added some portals to my platformer game. However I want to achieve proper redirection of vectors (speedy thing goes in, speedy thing comes out)
The portals are side on (as in, attached to the walls.
All I need is direction/advice on the trig I need to do.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Post » Fri Feb 03, 2012 4:10 am

If you are using Platform behavior you can get the Sprite.speed as it collides with the portal. Then assign that number to a global variable. When the sprite spawns at the new portal assign the speed back to the sprite. (I think that would work...)

Something similar works for Physics.
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Fri Feb 03, 2012 10:58 am

I don't think that would work, because you need to consider the angle of both portals as well...
hmm...
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Post » Fri Feb 03, 2012 7:06 pm

B
83
S
27
G
69
Posts: 4,909
Reputation: 48,985

Post » Fri Feb 03, 2012 8:23 pm

@R0J0hound, you have done it again. Many thanks.
@Kyatric this would be good for the FAQ I'm sure.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Post » Fri Feb 03, 2012 10:23 pm

Added.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
258
S
88
G
48
Posts: 7,082
Reputation: 62,728

Post » Sun Dec 23, 2012 5:50 pm

What about an object without platform behavior?

Im trying to do with an object with physics behavior (only) and i cant do it :S
B
31
S
7
G
2
Posts: 159
Reputation: 3,739

Post » Sun Dec 23, 2012 6:06 pm

@ByR You'll need to store its X and Y vectors in two variables at portal entry, then destroy the old object and create the new one at the portal, setting its vectors again with R0j0's algorithm.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Post » Sun Dec 23, 2012 6:39 pm

Vectors are parameters from the platform behavior so i cant get these.

I tried applying a new impulse (impulse with XY and impulse at angle) using the physics.VelocityX and physics.VelocityY but the force is like 50 times stronger, the angle its ok.

Sorry for my english :)ByR2012-12-23 18:40:10
B
31
S
7
G
2
Posts: 159
Reputation: 3,739

Post » Sun Dec 23, 2012 7:07 pm

@ByR You'll want to use the 'set velocity' action which allows you to set X and Y components.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,465

Next

Return to How do I....?

Who is online

Users browsing this forum: Arekusei, dmrev, hypnorabbit, R0J0hound, UncleHo74, Yahoo [Bot] and 1 guest