View Full Version : Loading scenes in runtime?
06-10-2003, 11:40 AM
How to do this correctly? I tried the example at caperaven.co.za but it didn't work at all.
Now could someone explain how to do this. For example if my base scene has a cube and a camera and I want to load my level1.gls witch has the cube and the camera and some other objects. Now if I call glscene1.loadfromfile('level1.gls');
It gives me an error "invalid enumerant". What's going wrong?
Hi Bylkki ..
i don't know exactly whay your code doesn't work . ?
but i think maybe there are a small mistake .
You can TRY :
1- Add "ExtractFilePath(ParamStr(0))" to your Path , to be shore that you are working in the curint path ..
Like this :
2- you must reDefine some Parameters after calling ..:. (( GLNavigators for example)) :
Like This :
my be there are some other things ......
but at any rate this is a code i wrote .. and it is working correctly :
if IsKeyDown('s') then begin
01-11-2003, 08:29 PM
A bit of an improvement. Just downloaded the newest CVS-version of glscene and now it loads my scene well without errors but...
The problem now is that glscene doesn't referr to my newly loaded objects. It loads the scene but all the positions I have set in code wont work. For example I have a hudtext and in code i set its position to
hudtext.position.y := 5;
Now when i load the scene it doesn't set the position. :cry:
I tried to do like in the demo at caperaven.co.za
hudtext := glscene1.findsceneobject('hudtext');
If i do that the code wont compile and it says: " incompatible types: TGLHUDText and TGLBaseSceneObject "
How can they be incompatible? :x
Could someone help me?
Thanks in advance.
where you put the position code ... ?
if the code is in (Form create) ,
simply separate the position code Lines on a new procedure .
and recall the procedure after loading the new scene .
i think that will be usefull .
03-11-2003, 06:43 AM
recall the procedure after loading the new scene .
No luck. I tried that too but it just wont work. :(
The actors wont load even if I load them after the scene loading.
this code from my game and it work so good
try some think like it >> it must work ?
// we also call this procedure on form create
Actor1.Scale.SetVector(0.01, 0.02, 0.02, 0);
Actor2.Scale.SetVector(0.06, 0.06, 0.06, 0);
Actor3.Scale.SetVector(0.06, 0.06, 0.06, 0);
Actor4.Scale.SetVector(0.06, 0.06, 0.06, 0);
Actor5.Scale.SetVector(0.06, 0.06, 0.06, 0);
// the load scene procedure
if IsKeyDown(VK_F5) then begin
05-11-2003, 06:22 PM
Yeah! got it working :D . Thanks orwa. I tried again to load and set everything again and it worked. I wonder why it didn't work before :?
BTW: If you want to check what the game looks like then heres a couple of pictures.
07-11-2003, 06:19 PM
Having minor problems, again. Now the scene loads but the Gui isn't working correctly. You can drag the gui around but the buttons dont react. What i mean that the buttons dont have their events anymore. How can I assign them again?
Powered by vBulletin® Version 4.1.10 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.