Game Development Community

Change LoadScene/Scene Coordinates?

by Aaron Scovel · in Torque X 2D · 09/11/2010 (5:16 am) · 5 replies

Maybe this isn't currently possible, but I am a true believer that anything logical is possible.

When loading a new scene while another scene is already loaded..
Game.Instance.SceneLoader.Load(@"data/levels/newscene.txscene");
The coordinates default to (0,0). This is great only if your camera is stationary and never moves.

Is there any way to change the new scene coordinates to the current camera location? I could manually relocate everything in the scene to the camera coordinates based on their current coordinates, but this would take an extensive amount of code.

Thanks

About the author

Previously a PHP/MySQL Programmer/Web Developer of 10 years. In Aug 2010 I decided to change careers, and this is were I landed! I also parent 3 kids full time. TopNotched.com


#1
09/11/2010 (4:31 pm)
No, you will need to move all the scene objects via your code. Or load your scene into a different sceneview with it's own camera.
#2
09/11/2010 (5:37 pm)
Thanks Duncan

I was hoping there was a way to move the scene without camera trickery. Seems a bit silly that they didn't add a coordinates property like this SceneLoader.Load(filename, vector2).

I will give sceneview a shot. I'm just not sure were to place the code as I'm using the GUI starter game and unlike the tutorials, my scenes are loaded elsewhere and I have a camera movement component added to the player. Should I setup the new camera and sceneview in game.cs even though the scene isn't loaded yet? I guess that's were I'm getting stumped at.

I'm probably making it harder then it actually is.
#3
09/11/2010 (6:20 pm)
Aaron, the issue I would have with trying to help you is its not clear what you are attempting to accomplish.

1. How many objects are in the new scene.

2. How long will the new scene be there.

3. Will the new scene need to follow around the old scene, as an overlay, or is it just a sort of dumbo drop of objects?

One suggestion I might have is a component which only does one thing, when it arrives, it adds an offset to the object, based on where it arrives, and where the camera is. basically on Register position += Old Camera.Position. Thats a pretty straight forward solution, which you can fudge around with without having to modify TX source.
#4
09/11/2010 (6:39 pm)
@Will: The scene is going to be used for a pause menu system

1) 10-20 objects
2) During Screen Pause
3) The game will be paused and the new scene will overlay.

Thanks for the suggestion, I am currently doing something like that without a component, but I like the component idea!

I just had another light turn on

I should be able to mount everything to the menu background and just move background right? But since I want this to be shared with the community upon finish, I think your component concept would be easier for others to use.
#5
09/11/2010 (7:59 pm)
Sounds great, glad I could be of assistance.