Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Change background  (Read 4374 times)

0 Members and 1 Guest are viewing this topic.

Voliotis

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
Change background
« 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
Logged

Daniel

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 124
  • I'm *not* a llama!
    • View Profile
Re: Change background
« Reply #1 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?
Logged

warmblood

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 18
    • View Profile
Re: Change background
« Reply #2 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.
Logged

Voliotis

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
Re: Change background
« Reply #3 on: August 07, 2008, 06:40:44 PM »

Thank you all! I will give it a shot
Logged
 

Page created in 0.023 seconds with 25 queries.