Discuss Scratch

funni_stuff334
Scratcher
41 posts

Portals and Player Velocity

Currently making a 2d version of portal, and as of right now the physics engine I've implemented uses seperate X Vel and Y Vel variables to determine movement.

The problem with this is that I can't find an easy way to change a player's velocity to match the directions of the blue and orange portals.

Is there anyway I can easily correct player velocity when exiting a portal?
awesome-llama
Scratcher
1000+ posts

Portals and Player Velocity

You'll want to find the velocity relative to the portal you entered (taking into account its orientation). The velocity relative to the exit portal will be the same so you can convert it back into world space using the orientation of the exit portal.

This article has some useful information on vectors: https://en.scratch-wiki.info/wiki/Using_Vectors

Powered by DjangoBB