Hi, I'm creating an RPG and I need to make scenes start at 2 or 3 different points depending on where you enter them from. How can I achieve this?
Thanks
Comments
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Without more info, I'd recommend - each time you want to move to a new position - using the scene.Camera.Origin.X & Y attributes, either in a couple of Change Attribute behaviours, or if you want to pan over time to the new position, use the attributes in two Interpolate behaviours.
thank you @gyroscope
So lets say I have a town where you can go into different houses, how would I make it so the character spawns at the entrance of a house he just came out of, instead of the scene's default X&Y camera origin?
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited April 2014
Hi, again, without more info it's difficult to be precise...
OK, I'll give it a go to explain: I'll assume your town with different houses (outside) is all on one scene; and when you go into a house via the entrance,you go to a new scene for each interior, then back to the main outside town scene when coming out again.
So if that's the case, one way to tackle this would be to have invisible actors at the entrances of the houses (all on the main town scene).
Make two real attributes (game), called PosX & PosY; make a game integer attribute called WhichHouse.
In each of these invisible actors at the entrances, put:
Rule: When Actor Player overlaps/collides with actor of type doorway
Change Attribute PosX to ?? --- x position outside of that particular invisible entrance actor, i.e. so when player goes back to that pos, it's not touching the invisible actor
Change Attribute PosY to ?? --- y position outside of that particular invisible entrance actor, i.e. so when player goes back to that pos, it's not touching the invisible actor
Change Attribute WhichHouse to 1 ---different number for each house entrance
Then in an actor outside of the play/screen area:
Rule: When WhichHouse = 1
Change Scene HouseInt1
Rule: When WhichHouse = 2
Change Scene HouseInt2
etc
Rule: When WhichHouse = 0
Change Attribute Actor Player.Position.X to PosX
Change Attribute Actor Player.Position.Y to PosY
Now in each of your interior scenes, an invisible actor when the player is coming out of the house this time:
Rule: When Actor Player overlaps/collides with actor of type doorway
Change Attribute WhichHouse to 0
Change Scene Main Town Scene
@gyroscope thank you so much!! I didn't completely understand your method but it gave me a simpler idea that worked perfectly, here's what I did:
On the main town scene I put an invisible actor on top of each door which just changes to house interior scene when overlapped.
Then on the inside house scene, I put an invisible actor on top of the exit door that changes the WhichHouse attribute to 1 and then changes scene back to main town when overlapped.
Back on the main town I converted the main character actor into an instance actor and gave him a rule that when WhichHouse = 1, his position changes to right in front of the house he just came out of. So there was no need to create the extra PosX & PosY attributes you suggested.
Thank you for your time and input, it's greatly appreciated!
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited April 2014
You're welcome, and glad it helped.
For the record, I used PosX and PosY as being away from the invisible actor on the doorways, so that when you returned to the town scene, and the Player was moved to the outside doorway again, it didn't overlap so as to retrigger it again to go back inside.
But if that doesn't happen with yours, all the better!
Comments
Hi @Jfg619 and welcome to the GameSalad Forums.
Without more info, I'd recommend - each time you want to move to a new position - using the scene.Camera.Origin.X & Y attributes, either in a couple of Change Attribute behaviours, or if you want to pan over time to the new position, use the attributes in two Interpolate behaviours.
thank you @gyroscope
So lets say I have a town where you can go into different houses, how would I make it so the character spawns at the entrance of a house he just came out of, instead of the scene's default X&Y camera origin?
Hi, again, without more info it's difficult to be precise...
OK, I'll give it a go to explain: I'll assume your town with different houses (outside) is all on one scene; and when you go into a house via the entrance,you go to a new scene for each interior, then back to the main outside town scene when coming out again.
So if that's the case, one way to tackle this would be to have invisible actors at the entrances of the houses (all on the main town scene).
Make two real attributes (game), called PosX & PosY; make a game integer attribute called WhichHouse.
In each of these invisible actors at the entrances, put:
Then in an actor outside of the play/screen area:
Now in each of your interior scenes, an invisible actor when the player is coming out of the house this time:
Hope that all makes sense.
@gyroscope thank you so much!! I didn't completely understand your method but it gave me a simpler idea that worked perfectly, here's what I did:
On the main town scene I put an invisible actor on top of each door which just changes to house interior scene when overlapped.
Then on the inside house scene, I put an invisible actor on top of the exit door that changes the WhichHouse attribute to 1 and then changes scene back to main town when overlapped.
Back on the main town I converted the main character actor into an instance actor and gave him a rule that when WhichHouse = 1, his position changes to right in front of the house he just came out of. So there was no need to create the extra PosX & PosY attributes you suggested.
Thank you for your time and input, it's greatly appreciated!
You're welcome, and glad it helped.
For the record, I used PosX and PosY as being away from the invisible actor on the doorways, so that when you returned to the town scene, and the Player was moved to the outside doorway again, it didn't overlap so as to retrigger it again to go back inside.
But if that doesn't happen with yours, all the better!