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: Hold foreground object still while background scrolls  (Read 2908 times)

0 Members and 1 Guest are viewing this topic.

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Hold foreground object still while background scrolls
« on: June 27, 2008, 05:49:28 PM »

Hi all

This is the second time I've typed this one - if you find the other version (coz I can't), please delete it.

Im using a scroll to pan across a background 2048 x 768. What I want to do is hold some foreground object static while the background pans behind it. Is there a standard way of doing that?

If not, do I have to move a node in the opposite direction to the scroll - and if so, how do I ensure the speed is exactly synchronised so the foreground does not appear to move?

Anybody got any ideas for me?

Thanks
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Hold foreground object still while background scrolls
« Reply #1 on: June 27, 2008, 06:03:27 PM »

Any layer with the same dimensions as the game viewport will not scroll. Does that solve your problem?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Hold foreground object still while background scrolls
« Reply #2 on: June 27, 2008, 07:23:45 PM »

It did indeed Mnem, thanks. Perfect.

Now what I'd like to do is to alpha the objects in and out while the scroll is happening. The Scene.ScrollTo is an absolute is it not? Once started, it carries on and the next line of code executes when the scroll finishes, it would appear.

Is there any way within Wintermute to run a for(a = etc) thingy.AlphaColor = MakeRGBA(255,255,255,a) (youknowhatImean) while the scroll is happening?

Cheers
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Hold foreground object still while background scrolls
« Reply #3 on: June 27, 2008, 07:33:25 PM »

There's Scene.ScrollToAsync(), which doesn't block the script flow.
And generally speaking, you can fake multiple "threads" by using events:

Code: WME Script
  1. ...
  2. this.ApplyEvent("fade_code");
  3. Scene.ScrollTo(something);
  4. ...
  5.  
  6.  
  7. on "fade_code"
  8. {
  9.   // code put here will run in parallel with the scolling
  10. }
  11.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Hold foreground object still while background scrolls
« Reply #4 on: June 27, 2008, 08:00:30 PM »

Works perfectly, and I can see other uses for what you've taught me this evening. Perhaps the game should say "the titles of Chapter One are brought to you by Mnemonic's code examples", for 'tis the truth indeed.

Cheers
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com
 

Page created in 0.043 seconds with 25 queries.