Game Development Community

Background GUI (Old)

by Justin Proffitt · in Technical Issues · 08/13/2009 (5:16 pm) · 3 replies

Been a while since I've had to come here for help, but I'm absolutely stumped. I am working on a game that revolves around ship-to-ship combat in space, and I have finally reached the stage where I can sort of create a test level with some scenery and other ships. I am trying to implement a static background (that doesn't change when you move/zoom the camera) and I cannot program a scene object to simply follow the camera. The only other option is to use a GUI background, which would probably be easier to use. However, I discovered that GUI objects are (in hindsight obviously) hidden when placed behind the scenewindow2d, and I do not know how or even if I can safely change the sceneWindow's image from the default black to something else.

Also, I do not own the source code so I can't make any modifications to the engine for this.

So, can anyone help me out? :P

About the author

I am a college student majoring in physics. As it so happens I like programming, a hobby which extends my profession in web design.


#1
08/13/2009 (8:04 pm)
In mainscreen.gui, you can add a second scenewindow called "BackgroundWindow2D". You can then load a level into that scene window the same way, "BackgroundWindow2D.LoadLevel(%TheBackgroundLevel);", When the camera moves for one level, the background will remain static. Hope that helps.

And there's no engine mod necessary.
#2
08/13/2009 (8:09 pm)
I see, if that works that would make creating a more dynamic level (with planets and perhaps layers of stars) MUCH easier. I shall begin implementing that now.

Edit: How might I specify a scene object to be placed in that window?

Edit2: Nevermind, I didn't read that carefully enough :p

Edit3: Okay it works, it is important to note that the backgroundWindow should be created BEFORE the sceneWindow, besides that I think its great! ^_^

Thanks!
#3
08/14/2009 (11:23 am)
New issue: I want to have a parallax foreground, but even if I place it in the new backgroundWindow, it would only be able to scroll with the ship, not the camera. Since the two are moving at different velocities most of the time, the effect would not look right. So is there a way I can retrieve the 'velocity' of the camera without modifying source code? I understand that the camera never really moves, but it has to have some method of appearing to move which I can apply to the foreground.

Edit: Okay, after hours of searching all the forums, I have come to the conclusion that the camera system is not perfect and few people know how to get around a problem like this. I have a proposal which might work but I am not sure.. If I mounted the camera to an invisible scene object and programmed that to follow my ship, then I could grab the velocity of that object and use that as a substitute (or rather representative) of the camera's velocity. Is there any problems this might cause later down the road, or anything I'd have to be wary of if I decided on this work-around?

Thanks so far :)