Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Voliotis on August 06, 2008, 08:14:23 PM

Title: Change background
Post by: Voliotis on August 06, 2008, 08:14:23 PM
Hello there i have just started using wintermute and i want to create a photography game. So my question is, can i change background (or layer what is better?) without changing scene? i have a photo of an object in it and when i click on this object i want to load the other photo i have without this object in it.

Thank you for your time
Title: Re: Change background
Post by: Daniel on August 06, 2008, 09:49:14 PM
Hi Voliotis and welcome!

Well, it is indeed possible but in your case you don't really need two different backgrounds. All you need is one background (without the object) and one entity (of just the object). You need to place the entity of the object at the correct place over the background and then show/hide it according to your scene's logic.

Is that the effect you were after?
Title: Re: Change background
Post by: warmblood on August 07, 2008, 04:19:37 AM
I think Daniels suggestion to cut the object out of the photo is usually best.

But if for some reason you don't want to cut the object out of the background, you can have two different background images. Since the background is an entity, you can change its sprite in script using the SetSprite method:

Code: WME Script
  1. ...
  2. var bkgrndEntity=Scene.GetNode("background");
  3. bkgrndEntity.SetSprite("scenes\room\background1.bmp");
  4. Sleep(1000);
  5. bkgrndEntity.SetSprite("scenes\room\background2.bmp");...
  6.  
  7. ...
  8.  

 
Or you could create a sprite entity and use the SetSprite method to change the photo at the appropriate time.

Or you could also create two sprite entities --one for each of the photos -- and make one or the other visible or invisible at the appropriate time (using the active attribute.)

Or you could make a sprite entity with two frames -- one for each of the photos -- and set the current frame at the appropriate time (using the CurrentFrame attribute).

Or...

I could go on, but I think you see there are many ways to achieve the same thing. As to which you should use, IMO, it depends on what you are trying to do.
Title: Re: Change background
Post by: Voliotis on August 07, 2008, 06:40:44 PM
Thank you all! I will give it a shot