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,400

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,400

Post » Fri Feb 03, 2012 7:06 pm

B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

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,400

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

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: 157
Reputation: 3,735

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,400

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: 157
Reputation: 3,735

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,400

Next

Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Braus, Kagubro, zeneizel and 18 guests