Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Scroll Scene  (Read 3185 times)

0 Members and 1 Guest are viewing this topic.

MrArgh

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Scroll Scene
« on: October 15, 2010, 01:12:53 PM »

Hi!

I'm currently working on a two week project in Wintermute and I'm trying to get my scene to scroll to a given position - so far with no success.
I have looked at all previous post yet i still won't work so probably I'm doing something fundamentally wrong, which I will be ashamed of later =)

I have got a scene where the main layer is 1280x800 and where the background sprite is 3200x2000, ergo only a piece of the background is seen.

Right now my code looks like this (and it's placed in the scene_init script):

Code: [Select]
Game.Interactive = false;
Scene.AutoScroll = true;
Scene.MainObject = null;
Scene.ScrollTo(1500, 1500);
Game.Interactive = true;

I have also tried to place this within a while loop but nothing happens. In neither of the cases do I get any errors.
I would be very thankful for any help!








Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Scroll Scene
« Reply #1 on: October 15, 2010, 01:24:48 PM »

The engine doesn't care about the size of your image, it only cares about the size of the scene layers. So if you want it to scroll in the whole 3000 range, you need to set the layer size to 3000 pixels.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Scroll Scene
« Reply #2 on: October 15, 2010, 01:25:57 PM »

In other words, scene scrolling happens when the layer dimensions are different from scene viewport dimensions.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

MrArgh

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: Scroll Scene
« Reply #3 on: October 15, 2010, 01:41:26 PM »

I see.

So, I changed the main layer to 3200x2000 (the same size as the image).
The game resolution is 1280x800 - so all non scrolling scenes have that size.

Still - nothing happens. I changed the current viewport to 800x600 but still no success.

Edit: There must be some concept that goes me by. When I set the viewport to something very small (200x100) I can see that the scene scrolls. However when I set it to the desired size (1280x800) nothing happens.

Edit: Finally made it work! I wrote Game.MainObject instead of Scene. and it worked.
« Last Edit: October 15, 2010, 03:24:54 PM by MrArgh »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Scroll Scene
« Reply #4 on: October 15, 2010, 04:17:09 PM »

Ah, right! I missed that in your original post.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.042 seconds with 24 queries.