Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Transferring Reverse Motion Between Scenes

Mack_DundeeMack_Dundee Posts: 31Member
edited November -1 in Working with GS (Mac)
Tshirtbooth made an interesting GameSalad Cookbook video called "Transferring Motion between Scenes in games made with GameSalad."

In the video, he shows how to send a ball actor off the left side of one screen only to reappear on the right side of a second scene continuing the motion toward the left from scene one. Controlling where the ball actor reappears in either the x or y positions in the second scene is simple enough (and explained in the above video). However, my question is how would one reverse the motion in, let's say, the x position as if the ball actor were passing through a mirror? That is, how would one carry the right to left motion of scene one into a left to right motion in scene two?

I'm guessing it has something to do with self.motion.linear velocity.x and the "linear velocity X" attribute (made at the game level in the Tshirtbooth video), but I'm not sure. Maybe I'm thinking about this all wrong, but is it possible to go from a positive x velocity to a negative x velocity? Is the expression editor the answer?

Thanks for you time, guys.


  • Mack_DundeeMack_Dundee Posts: 31Member
    I think I've got it. Firemaplegames has a "Magnitude DEMO" which has some clues. I think instead of using the "linear velocity x" attribute, one could just use the change attribute of self.motion.linear velocity.x to -self.motion.linear.velocity.x. I'll keep testing.
  • tenrdrmertenrdrmer Posts: 9,934Member, Sous Chef, Senior Sous-Chef
    Yep that should take care of it. When you save the linearvelocity.x from scene one if it is moving from right to left it will be a - number so all you need to do is use another - and it will go positive making it move left to right.

    It's not my fault I never learned to take responsibility for anything. ;)

  • Mack_DundeeMack_Dundee Posts: 31Member
    Thanks for the verification, tenrdrmer. It's always good to know when you're on the right track. I've tested various methods and the way that tenrdrmer and I describe seems to work best.

    By the way, I just want to clarify something for those who come across the same issue. If we're using Tshirtbooth's example of moving from scene to scene, let me correct something from my post previous to this one. You would have the following:

    Change Attribute: game.LinVolX to -self.motion.linear.velocity.x

    The above would allow the mirror effect to carry between separate scenes. I hope that helps.
This discussion has been closed.