Time for action — teleporting the ball
We're going to add an event to teleport the ball to the red portal when it hits the green portal. This will give an added challenge, but also an added reward for the skilled players.
1. Create a new event in the
Game
group for theBall
object when it overlaps thePortalIn
object.2. Add the Trigger once while true condition from the
System
object to this event.3. Insert an action to set the value of
VelocityX
for theBall
object toBall[Physics].VelocityX
. This will store its horizontal speed.4. Add another action to set the value of
VelocityY
for theBall
object toBall[Physics].VelocityY
. This will store its vertical speed.5. Create the action
Set immovable
for thePhysics
behavior of theBall
object and choose Yes.6. Use the
Set position to another object
action for theBall
object to move it to thePortalOut
object.7. Create the
Set immovable
action for theBall
again to change it back to No.8. Finally, use the
Set velocity
action of thePhysics...