Portals?!

delorianhayzedelorianhayze Member Posts: 55
edited November -1 in Working with GS (Mac)
Hey all.
Crazy question. Can someone explain how to make portals in GS. I am of course referring to the game Portal. I obviously realize that GS doesn't do true 3D, etc. But I'm looking to have an element of it in my game (which is 2D). Cut The Rope (magic box) even has it too! And that's what I'm looking to do (like the magic hats in Cut The Rope).
Essentially I need objects entering one portal and exiting another portal (retaining the angle and velocity of its entrance)
Thanks so much!

Comments

  • TheBoss_123TheBoss_123 Member Posts: 60
    I have a WIP of the project - Because I was making a port of Portal Flash, but I never finished it. If you are interested email me on:
    Xtenstudios@hotmail.co.uk
    Cheers
  • JPickardJPickard Member Posts: 477
    there are a couple of demo templates in the gamesalad "new" section. Search "teleport"
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Basically, set up custom attributes that record the x and y velocities, and the rotation angle of the actor when it enters one portal, and load those attributes along with x and y positional coordinates you want it to spawn from.
  • delorianhayzedelorianhayze Member Posts: 55
    Apparently a while back there was a post on this and "JohnPapiomitis" (wanted to give him credt) answered it as follows... (But I still have questions below)...

    "...Make 4 real attrributes: portalx, portaly, playermotx, and playermoty
    in the 2nd portal have to change attribute behaviors
    change portalx to self position x and change portaly to self position y
    then in the player have a rule when it collides with the first portal
    change self postion x to portal x
    change self position y to portaly
    change playermotx to self motion linear x
    change playermoty to self moition linear y
    then put a timer in that rule after .1 seconds run to complterion checked
    change self motion linear x to playermotx
    and change self motiion linear y to player mot y"

    I'm still a newbie to GameSalad so I only half understand this. But I tried it and it works- sort of.
    >This seems to work only one way (i.e. its not vice versa. it only works if player hits portal x it will pop out portal y- not both ways)
    >I'm doing this with gravity (physics based) and doesn't seem to address this following issue... If I place portal X lets say on the ground and I place portal Y on the left hand wall. I want the players "ball" to drop into portal X and then launch outward of portal Y on the wall. The way the above "code" is set up, it doesn't take into account the direction of the portal facing.

    ANy help on this would be greatly appreciated! "SlickZero" you may or may not have answered this but I'm new and that's a bit too advanced for my understanding- but a zillion thank yous for it (I'm sure it'll help those more advanced). And thanks everyone else for the input also!
  • delorianhayzedelorianhayze Member Posts: 55
    Essentially the biggie here is, how can the object falling through portal 1 change it's direction when coming out portal 2. Meaning, let's say portal 1 is on the ground and portal 2 is on the left hand side but ANGLED towards the UPPER RIGHT of the screen. The idea would be, ball falls (building momentum) and then shoots out (with some momentum) out of portal 2 BUT at the NEW ANGLE of portal 2 (i.e. upper right direction).

    Another example to be even more understandable.
    Portal 1 is on the floor.
    Portal 2 is on the left hand wall and it is facing the RIGHT HAND WALL.
    Ball builds momentum and falls into portal 1 and shoots out of portal 2 (TO THE RIGHT HAND DIRECTION... NOT MOVING DOWNWARD). That's the trick, I don't want it to continue moving downward I want it to shoot out in the direction of the portal but maintaining it's momentum etc.

    You guys are the best thanks!
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    You can do that. It's just a matter of using custom attributes and saving and loading them. When you spawn your actor out of the new portal, you can also have it so it travels at any angle and velocity you want. When you spawn the new actor, you can have it spawn with certain attributes already applied to it, like angle of trajectory and velocity.
  • delorianhayzedelorianhayze Member Posts: 55
    Ok but how do you tell it the trajectory? I'm new and i'm not fully understanding how to tell the ball to fly out at the angle of the portal. I understand attributes. But i don't understand how to tell it the velocity and trajectory of the new portal.
  • delorianhayzedelorianhayze Member Posts: 55
    I'm so close. I got everything working EXCEPT the trajectory. RIght now I have an object that can fall into a portal and exit the other portal. What isn't happening is it flying out of the second portal at that portal's angle (and maintaining the same speed). How can I do that? thx
  • delorianhayzedelorianhayze Member Posts: 55
    magnitude seemed to be the answer to my question. well at least it appears to be working on my end.
Sign In or Register to comment.