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
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

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
193
S
6
G
7
Posts: 213
Reputation: 10,203

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
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

Post » Fri Feb 03, 2012 7:06 pm

B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

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
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

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
292
S
115
G
96
Posts: 7,293
Reputation: 70,769

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
32
S
7
G
2
Posts: 164
Reputation: 3,774

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
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

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
32
S
7
G
2
Posts: 164
Reputation: 3,774

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
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

Next

Return to How do I....?

Who is online

Users browsing this forum: divsyntax, pmerineau and 10 guests